Export with dep repos
All checks were successful
Unit tests / Unit tests (latest) (push) Successful in -1m59s
Unit tests / Unit tests (lts/hydrogen) (push) Successful in -2m0s
Distribution check / Generated files check (push) Successful in -1m58s
NPM Audit Check / Check NPM audit (push) Successful in -2m10s
Unit tests / Unit tests (lts/*) (push) Successful in -2m0s
All checks were successful
Unit tests / Unit tests (latest) (push) Successful in -1m59s
Unit tests / Unit tests (lts/hydrogen) (push) Successful in -2m0s
Distribution check / Generated files check (push) Successful in -1m58s
NPM Audit Check / Check NPM audit (push) Successful in -2m10s
Unit tests / Unit tests (lts/*) (push) Successful in -2m0s
This commit is contained in:
@@ -31,6 +31,8 @@ outputs:
|
|||||||
description: whether a deletion is required or not
|
description: whether a deletion is required or not
|
||||||
destination:
|
destination:
|
||||||
description: destination repo
|
description: destination repo
|
||||||
|
deps:
|
||||||
|
description: which repos to enable while building
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
|
|||||||
18
dist/index.js
vendored
18
dist/index.js
vendored
@@ -41396,6 +41396,7 @@ async function parse(previous, current) {
|
|||||||
build: false,
|
build: false,
|
||||||
move: [],
|
move: [],
|
||||||
delete: [],
|
delete: [],
|
||||||
|
deps: getDepRepo(actions.addRepo),
|
||||||
actions,
|
actions,
|
||||||
};
|
};
|
||||||
// can't delete if there's nothing to delete/no previous success
|
// can't delete if there's nothing to delete/no previous success
|
||||||
@@ -41422,9 +41423,6 @@ function parseRepoContents(repoContents, repository) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getDropped(oldPackages, newPackages) {
|
|
||||||
return oldPackages.filter(p => newPackages.filter(np => np.package === p.package).length === 0);
|
|
||||||
}
|
|
||||||
function isDelete(actions) {
|
function isDelete(actions) {
|
||||||
return !!(actions.removeRepo && actions.addRepo === null);
|
return !!(actions.removeRepo && actions.addRepo === null);
|
||||||
}
|
}
|
||||||
@@ -41434,6 +41432,19 @@ function isAdd(actions) {
|
|||||||
function isMove(actions) {
|
function isMove(actions) {
|
||||||
return !!(actions.removeRepo && actions.addRepo);
|
return !!(actions.removeRepo && actions.addRepo);
|
||||||
}
|
}
|
||||||
|
function getDepRepo(destination) {
|
||||||
|
const split = (destination || '').split('-');
|
||||||
|
switch (split[split.length - 1]) {
|
||||||
|
case 'testing':
|
||||||
|
case 'gremlins':
|
||||||
|
return 'testing';
|
||||||
|
case 'staging':
|
||||||
|
case 'goblins':
|
||||||
|
return 'staging';
|
||||||
|
default:
|
||||||
|
return 'stable';
|
||||||
|
}
|
||||||
|
}
|
||||||
async function tryRead(location) {
|
async function tryRead(location) {
|
||||||
try {
|
try {
|
||||||
const contents = isUrl(location) ? await (await distribution.get(location)).text() : await promises_namespaceObject.readFile(location, { encoding: 'utf-8' });
|
const contents = isUrl(location) ? await (await distribution.get(location)).text() : await promises_namespaceObject.readFile(location, { encoding: 'utf-8' });
|
||||||
@@ -41518,6 +41529,7 @@ async function doParse() {
|
|||||||
core.setOutput('move', diff.move.length > 0);
|
core.setOutput('move', diff.move.length > 0);
|
||||||
core.setOutput('delete', diff.delete.length > 0);
|
core.setOutput('delete', diff.delete.length > 0);
|
||||||
core.setOutput('destination', diff.actions.addRepo);
|
core.setOutput('destination', diff.actions.addRepo);
|
||||||
|
core.setOutput('deps', diff.deps);
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=router.js.map
|
//# sourceMappingURL=router.js.map
|
||||||
;// CONCATENATED MODULE: ./lib/src/index.js
|
;// CONCATENATED MODULE: ./lib/src/index.js
|
||||||
|
|||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "pkgbase-yaml-parser",
|
"name": "pkgbase-yaml-parser",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "pkgbase-yaml-parser",
|
"name": "pkgbase-yaml-parser",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pkgbase-yaml-parser",
|
"name": "pkgbase-yaml-parser",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "compare Artix `pkgbase.yaml` files",
|
"description": "compare Artix `pkgbase.yaml` files",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"artix",
|
"artix",
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { type PathLike } from 'fs';
|
|
||||||
import fsp from 'fs/promises';
|
import fsp from 'fs/promises';
|
||||||
import { URL } from 'url';
|
import { URL } from 'url';
|
||||||
import ky from 'ky';
|
import ky from 'ky';
|
||||||
import * as YAML from 'yaml';
|
import * as YAML from 'yaml';
|
||||||
|
|
||||||
|
export type DependencyRepo = 'stable' | 'testing' | 'staging';
|
||||||
|
|
||||||
export interface PackageInfo {
|
export interface PackageInfo {
|
||||||
package: string;
|
package: string;
|
||||||
repository: string;
|
repository: string;
|
||||||
@@ -25,6 +26,7 @@ export interface Result {
|
|||||||
build: boolean;
|
build: boolean;
|
||||||
move: PackageInfo[];
|
move: PackageInfo[];
|
||||||
delete: PackageInfo[];
|
delete: PackageInfo[];
|
||||||
|
deps: DependencyRepo;
|
||||||
actions: Actions;
|
actions: Actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,6 +63,7 @@ export async function parse(previous: string, current: string): Promise<Result>
|
|||||||
build: false,
|
build: false,
|
||||||
move: [],
|
move: [],
|
||||||
delete: [],
|
delete: [],
|
||||||
|
deps: getDepRepo(actions.addRepo),
|
||||||
actions,
|
actions,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -91,10 +94,6 @@ function parseRepoContents(repoContents: RepoContents, repository: string): Pack
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDropped(oldPackages: PackageInfo[], newPackages: PackageInfo[]): PackageInfo[] {
|
|
||||||
return oldPackages.filter(p => newPackages.filter(np => np.package === p.package).length === 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function isDelete(actions: Actions): boolean {
|
function isDelete(actions: Actions): boolean {
|
||||||
return !!(actions.removeRepo && actions.addRepo === null);
|
return !!(actions.removeRepo && actions.addRepo === null);
|
||||||
}
|
}
|
||||||
@@ -107,6 +106,20 @@ function isMove(actions: Actions): boolean {
|
|||||||
return !!(actions.removeRepo && actions.addRepo);
|
return !!(actions.removeRepo && actions.addRepo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getDepRepo(destination: string): DependencyRepo {
|
||||||
|
const split = (destination || '').split('-');
|
||||||
|
switch(split[split.length - 1]) {
|
||||||
|
case 'testing':
|
||||||
|
case 'gremlins':
|
||||||
|
return 'testing';
|
||||||
|
case 'staging':
|
||||||
|
case 'goblins':
|
||||||
|
return 'staging';
|
||||||
|
default:
|
||||||
|
return 'stable';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export async function tryRead(location: string): Promise<PkgBase | null> {
|
export async function tryRead(location: string): Promise<PkgBase | null> {
|
||||||
try {
|
try {
|
||||||
const contents = isUrl(location) ? await (await ky.get(location)).text() : await fsp.readFile(location, { encoding: 'utf-8' });
|
const contents = isUrl(location) ? await (await ky.get(location)).text() : await fsp.readFile(location, { encoding: 'utf-8' });
|
||||||
|
|||||||
@@ -78,4 +78,5 @@ async function doParse() {
|
|||||||
core.setOutput('move', diff.move.length > 0);
|
core.setOutput('move', diff.move.length > 0);
|
||||||
core.setOutput('delete', diff.delete.length > 0);
|
core.setOutput('delete', diff.delete.length > 0);
|
||||||
core.setOutput('destination', diff.actions.addRepo);
|
core.setOutput('destination', diff.actions.addRepo);
|
||||||
|
core.setOutput('deps', diff.deps);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { describe, expect, it } from 'vitest';
|
import { describe, expect, it } from 'vitest';
|
||||||
import { parse, type Result } from '../src/pkgbase.js';
|
import { parse, getDepRepo, type Result } from '../src/pkgbase.js';
|
||||||
|
|
||||||
describe('pkgbase parser', () => {
|
describe('pkgbase parser', () => {
|
||||||
it('can detect an add operation', async () => {
|
it('can detect an add operation', async () => {
|
||||||
@@ -8,6 +8,7 @@ describe('pkgbase parser', () => {
|
|||||||
build: true,
|
build: true,
|
||||||
move: [],
|
move: [],
|
||||||
delete: [],
|
delete: [],
|
||||||
|
deps: 'staging',
|
||||||
actions: {
|
actions: {
|
||||||
addRepo: 'system-goblins',
|
addRepo: 'system-goblins',
|
||||||
removeRepo: null,
|
removeRepo: null,
|
||||||
@@ -27,6 +28,7 @@ describe('pkgbase parser', () => {
|
|||||||
build: true,
|
build: true,
|
||||||
move: [],
|
move: [],
|
||||||
delete: [],
|
delete: [],
|
||||||
|
deps: 'stable',
|
||||||
actions: {
|
actions: {
|
||||||
addRepo: 'world',
|
addRepo: 'world',
|
||||||
removeRepo: null,
|
removeRepo: null,
|
||||||
@@ -65,6 +67,7 @@ describe('pkgbase parser', () => {
|
|||||||
"version": "2.14.14-3",
|
"version": "2.14.14-3",
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
deps: 'stable',
|
||||||
actions: {
|
actions: {
|
||||||
addRepo: 'world',
|
addRepo: 'world',
|
||||||
removeRepo: null,
|
removeRepo: null,
|
||||||
@@ -96,6 +99,7 @@ describe('pkgbase parser', () => {
|
|||||||
"repository": "world",
|
"repository": "world",
|
||||||
"version": "1:7.9.1-1",
|
"version": "1:7.9.1-1",
|
||||||
}],
|
}],
|
||||||
|
deps: 'stable',
|
||||||
actions: {
|
actions: {
|
||||||
addRepo: 'world',
|
addRepo: 'world',
|
||||||
removeRepo: 'world-gremlins',
|
removeRepo: 'world-gremlins',
|
||||||
@@ -147,6 +151,7 @@ describe('pkgbase parser', () => {
|
|||||||
"version": "2.14.14-3",
|
"version": "2.14.14-3",
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
deps: 'stable',
|
||||||
actions: {
|
actions: {
|
||||||
addRepo: 'world',
|
addRepo: 'world',
|
||||||
removeRepo: 'world-gremlins',
|
removeRepo: 'world-gremlins',
|
||||||
@@ -158,7 +163,7 @@ describe('pkgbase parser', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const rDir = 'move-with-dropped';
|
const rDir = 'move-with-dropped';
|
||||||
await expect(parse(`https://git.sanin.dev/packages_test/pkgbase-yaml-parser/raw/branch/master/test/resources/${rDir}/pkgbase.old.yaml`, path.join('test', 'resources', rDir, 'pkgbase.new.yaml'))).resolves.toEqual(expected);
|
await expect(parse(`https://git.sanin.dev/packages_infra/pkgbase-yaml-parser/raw/branch/master/test/resources/${rDir}/pkgbase.old.yaml`, path.join('test', 'resources', rDir, 'pkgbase.new.yaml'))).resolves.toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can detect a delete operation', async () => {
|
it('can detect a delete operation', async () => {
|
||||||
@@ -185,6 +190,7 @@ describe('pkgbase parser', () => {
|
|||||||
version: "3.13.0-2",
|
version: "3.13.0-2",
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
deps: 'stable',
|
||||||
actions: {
|
actions: {
|
||||||
addRepo: null,
|
addRepo: null,
|
||||||
removeRepo: 'world',
|
removeRepo: 'world',
|
||||||
@@ -198,4 +204,10 @@ describe('pkgbase parser', () => {
|
|||||||
const rDir = 'remove';
|
const rDir = 'remove';
|
||||||
await expect(parse(path.join('test', 'resources', rDir, 'pkgbase.old.yaml'), path.join('test', 'resources', rDir, 'pkgbase.new.yaml'))).resolves.toEqual(expected);
|
await expect(parse(path.join('test', 'resources', rDir, 'pkgbase.old.yaml'), path.join('test', 'resources', rDir, 'pkgbase.new.yaml'))).resolves.toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('can handle Arch repos', async () => {
|
||||||
|
expect(getDepRepo('core')).to.be.equal('stable');
|
||||||
|
expect(getDepRepo('core-testing')).to.be.equal('testing');
|
||||||
|
expect(getDepRepo('extra-staging')).to.be.equal('staging');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user