|
@@ -17,6 +17,14 @@ const args = require('minimist')(process.argv.slice(2), {
|
|
|
string: ['only']
|
|
|
});
|
|
|
|
|
|
+const getNodeGypVersion = () => {
|
|
|
+ const nanPackageJSONPath = path.join(NAN_DIR, 'package.json');
|
|
|
+ const nanPackageJSON = JSON.parse(fs.readFileSync(nanPackageJSONPath, 'utf8'));
|
|
|
+ const { devDependencies } = nanPackageJSON;
|
|
|
+ const nodeGypVersion = devDependencies['node-gyp'];
|
|
|
+ return nodeGypVersion || 'latest';
|
|
|
+};
|
|
|
+
|
|
|
async function main () {
|
|
|
const outDir = utils.getOutDir({ shouldLog: true });
|
|
|
const nodeDir = path.resolve(BASE, 'out', outDir, 'gen', 'node_headers');
|
|
@@ -90,7 +98,8 @@ async function main () {
|
|
|
env.LDFLAGS = ldflags;
|
|
|
}
|
|
|
|
|
|
- const { status: buildStatus, signal } = cp.spawnSync(NPX_CMD, ['node-gyp', 'rebuild', '--verbose', '--directory', 'test', '-j', 'max'], {
|
|
|
+ const nodeGypVersion = getNodeGypVersion();
|
|
|
+ const { status: buildStatus, signal } = cp.spawnSync(NPX_CMD, [`node-gyp@${nodeGypVersion}`, 'rebuild', '--verbose', '--directory', 'test', '-j', 'max'], {
|
|
|
env,
|
|
|
cwd: NAN_DIR,
|
|
|
stdio: 'inherit',
|