Skip to content

Commit 50e6646

Browse files
committed
Update definitionsCheck.js
1 parent a419a83 commit 50e6646

File tree

1 file changed

+3
-24
lines changed

1 file changed

+3
-24
lines changed

ci/definitionsCheck.js

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,19 @@
11
const fs = require('fs').promises;
22
const { exec } = require('child_process');
33
const core = require('@actions/core');
4-
const { nextTick } = require('process');
5-
const { AbortController } = require("node-abort-controller");
4+
const util = require('util');
65
(async () => {
76
const [currentDefinitions, currentDocs] = await Promise.all([
87
fs.readFile('./src/Options/Definitions.js', 'utf8'),
98
fs.readFile('./src/Options/docs.js', 'utf8'),
109
]);
11-
exec('npm run definitions');
12-
const ac = new AbortController();
13-
const { signal } = ac;
14-
const watcher = fs.watch('./src/Options/docs.js', {signal});
15-
let i = 0;
16-
// eslint-disable-next-line
17-
for await (const _ of watcher) {
18-
i++;
19-
if (i === 3) {
20-
ac.abort();
21-
break;
22-
}
23-
}
24-
await new Promise(resolve => nextTick(resolve));
10+
const execute = util.promisify(exec);
11+
await execute('npm run definitions');
2512
const [newDefinitions, newDocs] = await Promise.all([
2613
fs.readFile('./src/Options/Definitions.js', 'utf8'),
2714
fs.readFile('./src/Options/docs.js', 'utf8'),
2815
]);
2916

30-
if (currentDefinitions !== newDefinitions) {
31-
console.log(JSON.stringify(currentDefinitions, null, 2));
32-
console.log(JSON.stringify(newDefinitions, null, 2));
33-
}
34-
if (currentDocs !== newDocs) {
35-
console.log(JSON.stringify(currentDocs, null, 2));
36-
console.log(JSON.stringify(newDocs, null, 2));
37-
}
3817
if (currentDefinitions !== newDefinitions || currentDocs !== newDocs) {
3918
console.error(
4019
'\x1b[31m%s\x1b[0m',

0 commit comments

Comments
 (0)