Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit 1c265a6

Browse files
authored
Add jobs option for building (#482)
1 parent 3554b11 commit 1c265a6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/build.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ optParser.addOption('d', 'debug', 'boolean', 'Whether build debug addon (Please
1919
optParser.addOption('v', 'verbose', 'boolean', 'Whether use verbose level in building');
2020
optParser.addOption('r', 'rebuild', 'boolean', 'Whether clean before build');
2121
optParser.addOption('c', 'check', 'boolean', 'Whether check after build');
22+
optParser.addOption('j', 'jobs', 'string', 'Number of concurrent build jobs');
2223

2324
const options = optParser.parseArgs(process.argv);
2425

@@ -97,7 +98,7 @@ function constructBuildEnv() {
9798
}
9899

99100
// Common build commands
100-
var cpuCount = os.cpus().length;
101+
var cpuCount = (Number(options.jobs) || os.cpus().length);
101102
logLevel = options.verbose ? 'verbose' : 'error';
102103
rebuildArgs = ['node-gyp', 'rebuild', `-j ${cpuCount}`, '--loglevel=' + logLevel];
103104
configureArgs = ['node-gyp', 'configure', '--loglevel=' + logLevel];

0 commit comments

Comments
 (0)