Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip #45

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

wip #45

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 17 additions & 20 deletions citester/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46772,15 +46772,6 @@ function linkVersions(parent, child) {
if (parent === child) {
throw new Error('Cannot link a node to itself.');
}
if (child.parent) {
if (child.parent === parent) {
return child;
}
else {
throw new Error('Child already has a parent.');
}
}
child.parent = parent;
if (!parent.children.includes(child)) {
parent.children.push(child);
}
Expand Down Expand Up @@ -46878,7 +46869,6 @@ function scanRoots(uniqueVersions, getVersion) {
const roots = new Set(uniqueVersions);
for (const v of roots) {
v.children = [];
v.parent = null;
v.type = 'unknown';
}
for (const v of discoverAndLinkManifestChildren(roots, getVersion)) {
Expand Down Expand Up @@ -46962,7 +46952,7 @@ class GithubPackageRepo {
return token;
}
else {
throw new Error(`ghcr.io login failed: ${token.response.data}`);
throw new Error(`ghcr.io login failed: ${tokenResponse.data}`);
}
}
else {
Expand Down Expand Up @@ -46991,6 +46981,9 @@ class GithubPackageRepo {
throw error;
}
}
else {
throw error;
}
}
}
async init() {
Expand All @@ -47003,6 +46996,18 @@ class GithubPackageRepo {
*/
async fetchVersions(fn) {
// Function to retrieve package versions.
const { fetch, fetch_params } = this.resolveFetchAndParams();
// Iterate over all package versions.
for await (const response of this.config.octokit.paginate.iterator(fetch, fetch_params)) {
for (const packageVersion of response.data) {
const version0 = parsePackageVersion(JSON.stringify(packageVersion));
const manifest = await this.fetchManifest(version0.name);
const version = new PackageVersionExtModel(version0, manifest);
fn(version);
}
}
}
resolveFetchAndParams() {
let fetch;
// Parameters for the function call.
let fetch_params;
Expand Down Expand Up @@ -47035,15 +47040,7 @@ class GithubPackageRepo {
per_page: 100
};
}
// Iterate over all package versions.
for await (const response of this.config.octokit.paginate.iterator(fetch, fetch_params)) {
for (const packageVersion of response.data) {
const version0 = parsePackageVersion(JSON.stringify(packageVersion));
const manifest = await this.fetchManifest(version0.name);
const version = new PackageVersionExtModel(version0, manifest);
fn(version);
}
}
return { fetch, fetch_params };
}
addVersion(version) {
this.versions.set(version.name, version);
Expand Down
2 changes: 1 addition & 1 deletion citester/index.js.map

Large diffs are not rendered by default.

41 changes: 19 additions & 22 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45776,15 +45776,6 @@ function linkVersions(parent, child) {
if (parent === child) {
throw new Error('Cannot link a node to itself.');
}
if (child.parent) {
if (child.parent === parent) {
return child;
}
else {
throw new Error('Child already has a parent.');
}
}
child.parent = parent;
if (!parent.children.includes(child)) {
parent.children.push(child);
}
Expand Down Expand Up @@ -45882,7 +45873,6 @@ function scanRoots(uniqueVersions, getVersion) {
const roots = new Set(uniqueVersions);
for (const v of roots) {
v.children = [];
v.parent = null;
v.type = 'unknown';
}
for (const v of discoverAndLinkManifestChildren(roots, getVersion)) {
Expand Down Expand Up @@ -45966,7 +45956,7 @@ class GithubPackageRepo {
return token;
}
else {
throw new Error(`ghcr.io login failed: ${token.response.data}`);
throw new Error(`ghcr.io login failed: ${tokenResponse.data}`);
}
}
else {
Expand Down Expand Up @@ -45995,6 +45985,9 @@ class GithubPackageRepo {
throw error;
}
}
else {
throw error;
}
}
}
async init() {
Expand All @@ -46007,6 +46000,18 @@ class GithubPackageRepo {
*/
async fetchVersions(fn) {
// Function to retrieve package versions.
const { fetch, fetch_params } = this.resolveFetchAndParams();
// Iterate over all package versions.
for await (const response of this.config.octokit.paginate.iterator(fetch, fetch_params)) {
for (const packageVersion of response.data) {
const version0 = parsePackageVersion(JSON.stringify(packageVersion));
const manifest = await this.fetchManifest(version0.name);
const version = new PackageVersionExtModel(version0, manifest);
fn(version);
}
}
}
resolveFetchAndParams() {
let fetch;
// Parameters for the function call.
let fetch_params;
Expand Down Expand Up @@ -46039,15 +46044,7 @@ class GithubPackageRepo {
per_page: 100
};
}
// Iterate over all package versions.
for await (const response of this.config.octokit.paginate.iterator(fetch, fetch_params)) {
for (const packageVersion of response.data) {
const version0 = parsePackageVersion(JSON.stringify(packageVersion));
const manifest = await this.fetchManifest(version0.name);
const version = new PackageVersionExtModel(version0, manifest);
fn(version);
}
}
return { fetch, fetch_params };
}
addVersion(version) {
this.versions.set(version.name, version);
Expand Down Expand Up @@ -46401,7 +46398,7 @@ class CleanupAction {
const roots = this.repo.getRoots();
for (const r of roots) {
renderTree(r, v => v.children, (v, prefix) => {
core.info(`${v.parent == null ? '- ' : ' '}${prefix} ${v}`);
core.info(`${v === r ? '- ' : ' '}${prefix} ${v}`);
});
}
}
Expand Down Expand Up @@ -46557,7 +46554,7 @@ class CleanupAction {
const roots = scanRoots(new Set(versionsDelete), key => this.repo.getVersion(key));
for (const r of roots) {
renderTree(r, v => v.children, (v, prefix) => {
core.info(`${v.parent == null ? '- ' : ' '}${prefix} ${v}`);
core.info(`${v === r ? '- ' : ' '}${prefix} ${v}`);
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"package": "npx ncc build src/index.ts -o dist --source-map --license licenses.txt",
"ci-tester": "npx ncc build src/ci-tester.ts -o citester --source-map",
"package:watch": "npm run package -- --watch",
"test": "npx jest --coverage",
"test": "node --experimental-vm-modules node_modules/.bin/jest",
"all": "npm run format:write && npm run lint && npm run test && npm run coverage && npm run package"
},
"license": "MIT",
Expand Down
Loading
Loading