Skip to content

Commit ce8feaf

Browse files
bmeurerDevtools-frontend LUCI CQ
authored andcommitted
[npm] Tweaks for the npm run build script.
This addresses late feedback in https://crrev.com/c/6367220. Bug: 404192426 Change-Id: Ib514a6793c5a015021f2e6584cbe6ecbb71f5681 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6372905 Auto-Submit: Benedikt Meurer <[email protected]> Reviewed-by: Nikolay Vitkov <[email protected]> Commit-Queue: Benedikt Meurer <[email protected]>
1 parent a533a82 commit ce8feaf

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

scripts/run_build.mjs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,24 @@ const argv = yargs(hideBin(process.argv))
1515
default: 'Default',
1616
description: 'Specify the target build subdirectory under //out',
1717
})
18-
.option('watch', {
19-
alias: 'w',
18+
.option('skip-initial-build', {
2019
type: 'boolean',
2120
default: false,
22-
description: 'Monitor for changes and automatically rebuild',
21+
description: 'Skip the initial build (use with --watch)',
22+
implies: 'watch',
2323
})
24-
.option('watch-only', {
24+
.option('watch', {
25+
alias: 'w',
2526
type: 'boolean',
2627
default: false,
27-
description: 'Skip the initial build',
28+
description: 'Monitor for changes and automatically rebuild',
2829
})
2930
.usage('npm run build -- [options]')
3031
.help('help')
3132
.version(false)
32-
.parse();
33+
.parseSync();
3334

34-
const {target, watch, watchOnly} = argv;
35+
const {target, watch, skipInitialBuild} = argv;
3536
const cwd = process.cwd();
3637
const {env} = process;
3738

@@ -40,11 +41,12 @@ const outDir = path.join('out', target);
4041
if (!fs.existsSync(outDir)) {
4142
const gnExe = path.join(cwd, 'third_party', 'depot_tools', 'gn');
4243
fs.mkdirSync(outDir, {recursive: true});
43-
childProcess.spawnSync(gnExe, ['gen', outDir], {
44+
childProcess.spawnSync(gnExe, ['-q', 'gen', outDir], {
4445
cwd,
4546
env,
4647
stdio: 'inherit',
4748
});
49+
console.log(`Initialized output directory ${outDir}`);
4850
}
4951

5052
function build() {
@@ -56,12 +58,12 @@ function build() {
5658
});
5759
}
5860

59-
// Skip initial build if we should only watch.
60-
if (!watchOnly) {
61+
// Perform an initial build (unless we should skip).
62+
if (!skipInitialBuild) {
6163
build();
6264
}
6365

64-
if (watch || watchOnly) {
66+
if (watch) {
6567
let timeoutId = -1;
6668

6769
function watchCallback(eventType, filename) {

0 commit comments

Comments
 (0)