forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
37 lines (31 loc) · 1.18 KB
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const fsx = require('fs-extra');
const child_process = require('child_process');
const path = require('path');
const process = require('process');
function executeCommand(command) {
console.log('---> ' + command);
child_process.execSync(command, { stdio: 'inherit' });
}
// Clean the old build outputs
console.log(`==> Starting build.js for ${path.basename(process.cwd())}`);
fsx.emptyDirSync('dist');
fsx.emptyDirSync('lib');
fsx.emptyDirSync('temp');
// Run the TypeScript compiler
executeCommand('node node_modules/typescript/lib/tsc');
// Run the API Extractor command-line
if (process.argv.indexOf('--production') >= 0) {
executeCommand('node node_modules/@microsoft/api-extractor/lib/start run');
} else {
executeCommand('node node_modules/@microsoft/api-extractor/lib/start run --local');
}
// Run the API Documenter command-line
executeCommand(
'node node_modules/@microsoft/api-documenter/lib/start ' +
'generate --input-folder etc --output-folder etc/yaml'
);
executeCommand(
'node node_modules/@microsoft/api-documenter/lib/start ' +
'markdown --input-folder etc --output-folder etc/markdown'
);
console.log(`==> Finished build.js for ${path.basename(process.cwd())}`);