Skip to content

Commit d8fb3e2

Browse files
authored
Fix update script (#242)
1 parent ca7c300 commit d8fb3e2

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

scripts/get-builtin-globals.mjs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,6 @@ const getText = async url => {
2525
return text;
2626
};
2727

28-
const any = async asyncFunctions => {
29-
const errors = [];
30-
for (const function_ of asyncFunctions) {
31-
try {
32-
// eslint-disable-next-line no-await-in-loop
33-
return await function_();
34-
} catch (error) {
35-
errors.push(error);
36-
}
37-
}
38-
39-
throw new AggregateError(errors, 'All failed.');
40-
};
41-
4228
const getSpecification = async () => {
4329
let stat;
4430

@@ -54,7 +40,7 @@ const getSpecification = async () => {
5440
await fs.rm(CACHE_FILE);
5541
}
5642

57-
const text = await any(SPECIFICATION_URLS.map(url => () => getText(url)));
43+
const text = await Promise.any(SPECIFICATION_URLS.map(url => getText(url)));
5844

5945
await fs.mkdir(new URL('./', CACHE_FILE), {recursive: true});
6046
await fs.writeFile(CACHE_FILE, text);

scripts/update.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const ALL_JOBS = [
1212
{
1313
environment: 'builtin',
1414
getGlobals: getBuiltinGlobals,
15+
incremental: false,
1516
},
1617
{
1718
environment: 'nodeBuiltin',
@@ -42,7 +43,7 @@ async function run(options) {
4243
? ALL_JOBS.filter(job => job.environment === options.environment)
4344
: ALL_JOBS;
4445

45-
for (const {environment, getGlobals, incremental = false} of jobs) {
46+
for (const {environment, getGlobals, incremental = true} of jobs) {
4647
const {
4748
added,
4849
removed,
@@ -52,7 +53,7 @@ async function run(options) {
5253
environment,
5354
getGlobals,
5455
dryRun: options.dry,
55-
incremental: incremental ?? !options.clean,
56+
incremental: options.clean ? false : incremental,
5657
});
5758

5859
console.log(`✅ ${environment} globals updated.`);

0 commit comments

Comments
 (0)