Skip to content

Commit b1b242a

Browse files
mfazekaswhiteHatCip
authored andcommitted
chore: use documentation node api, gitignore tsconfig.tsbuildinfo
1 parent 7e26ce2 commit b1b242a

2 files changed

Lines changed: 9 additions & 13 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,4 @@ BOT_SETUP.md
139139
**/*-token.txt
140140

141141
# typescript
142-
**/tsconfig.tsbuildinfo
142+
**/tsconfig.tsbuildinfo

scripts/autogenHelpers/DocJSONBuilder.mjs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import fs from 'fs';
22
import path from 'path';
3-
import { exec } from 'child_process';
43
import * as url from 'url';
54

65
import dir from 'node-dir';
76
import { parse, utils } from 'react-docgen';
7+
import * as documentation from 'documentation';
88

99
import JSDocNodeTree from './JSDocNodeTree.js';
1010
import { pascelCase } from './globals.mjs';
@@ -420,15 +420,8 @@ class DocJSONBuilder {
420420

421421
generateModulesTask(results, filePath) {
422422
return new Promise((resolve, reject) => {
423-
exec(
424-
`npx documentation build ${MODULES_PATH} -f json`,
425-
(err, stdout, stderr) => {
426-
if (err || stderr) {
427-
reject(err || stderr);
428-
return;
429-
}
430-
431-
const modules = JSON.parse(stdout);
423+
documentation.build([filePath], {})
424+
.then(modules => {
432425
for (const module of modules) {
433426
const node = new JSDocNodeTree(module);
434427
const name = `${module.name
@@ -450,8 +443,11 @@ class DocJSONBuilder {
450443
}
451444

452445
resolve();
453-
},
454-
);
446+
})
447+
.catch(err => {
448+
console.log(`documentation.build failed for ${filePath}`);
449+
reject(err);
450+
});
455451
});
456452
}
457453

0 commit comments

Comments
 (0)