Skip to content

Commit 065ec62

Browse files
committed
better CRUD management
1 parent 166a17d commit 065ec62

File tree

1 file changed

+12
-3
lines changed
  • apps/svelte.dev/scripts/sync-packages

1 file changed

+12
-3
lines changed

apps/svelte.dev/scripts/sync-packages/index.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ let logsAtTheEnd: {
1818
| 'new_json_file'
1919
| 'deleted_unused_json_file'
2020
| 'outdated'
21-
| 'deprecated';
21+
| 'deprecated'
22+
| 'npm_error';
2223
pkg: string;
2324
extra: string;
2425
}[] = [];
@@ -58,7 +59,8 @@ if (jsonNotNeeded.length > 0) {
5859
logsAtTheEnd.push({ type: 'deleted_unused_json_file', pkg, extra: `deleted -> ${jsonPath}` });
5960
}
6061

61-
theEnd(1);
62+
// Let's continue
63+
// theEnd(1);
6264
}
6365

6466
// PART 3: refresh data
@@ -94,7 +96,8 @@ function theEnd(val: number) {
9496
new_json_file: 'NEW JSON',
9597
deleted_unused_json_file: 'DEL JSON',
9698
outdated: 'Outdated',
97-
deprecated: 'Deprecated'
99+
deprecated: 'Deprecated',
100+
npm_error: 'NPM Error'
98101
};
99102
console.log(
100103
` - ${logsAtTheEnd.map((l) => `${typePrints[l.type].padEnd(15)} | ${l.pkg.padEnd(35)} | ${l.extra}`).join('\n - ')}`
@@ -108,6 +111,12 @@ async function getNpmAndGitHubData(pkg: string): Promise<PackageKey & PackageNpm
108111
fetchJson(`https://registry.npmjs.org/${pkg}`),
109112
fetchJson(`https://api.npmjs.org/downloads/point/last-week/${pkg}`)
110113
]);
114+
115+
if (npmInfo.error) {
116+
logsAtTheEnd.push({ type: 'npm_error', pkg, extra: npmInfo.error });
117+
theEnd(1);
118+
}
119+
111120
// delete npmInfo.readme;
112121
// delete npmInfo.versions;
113122
// console.log(`npmInfo`, npmInfo);

0 commit comments

Comments
 (0)