Skip to content

Commit 5685d4d

Browse files
committed
Make autocomplete exit with error code
1 parent d9b4ba6 commit 5685d4d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scripts/autocomplete.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async function processDirGlobals(target) {
8383
document = new JSDOM(contents.toString()).window.document;
8484
} catch (err) {
8585
console.error(inFile, "failed", err);
86-
return;
86+
return err;
8787
}
8888

8989
const names = {};
@@ -96,6 +96,7 @@ async function processDirGlobals(target) {
9696

9797
const outFile = pathlib.join(OUT_DIR, target + '.json');
9898
await fs.writeFile(outFile, JSON.stringify(names, null, 2), 'utf-8')
99+
return undefined
99100
}
100101

101102
export default async function autocomplete() {
@@ -115,7 +116,11 @@ export default async function autocomplete() {
115116
}
116117

117118
await fs.mkdir(OUT_DIR, { recursive: true })
118-
await Promise.all(TARGETS.map(processDirGlobals))
119+
120+
// Exit with error code if the there was some error
121+
const errors = await Promise.all(TARGETS.map(processDirGlobals))
122+
if (errors.find(each => each !== undefined)) process.exit(1)
123+
119124
console.log('Finished processing autocomplete documentation')
120125
}
121126

0 commit comments

Comments
 (0)