Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(function (shouldBuild) {
if (!shouldBuild) {
return true;
}
console.log('Rebuilding native modules for Electron...'); // eslint-disable-line no-console
return rebuild.installNodeHeaders(electronPackage.version)
.then(function () {
return rebuild.rebuildNativeModules(electronPackage.version, pathToElectronNativeModules);
});
})
.then(function () {
export async function rebuild(
executablePath: string, version: string, arch: string
): Promise {
let modulesDir = path.join(__dirname, '../node_modules');
console.log(`Rebuilding native node-inspector modules for Electron ${version}`);
await installNodeHeaders(version, null, null, arch);
console.log(`Rebuilding ${modulesDir}/v8-profiler`);
await rebuildNativeModules(version, modulesDir, 'v8-profiler', null, arch);
// `node-inspector` will be launched in a "run as node" Electron process,
// so `node-pre-gyp` will be looking for a `node-vXX-platform-arch` directory
await preGypFixRun(path.join(modulesDir, 'v8-profiler'), true, executablePath);
console.log(`Rebuilding ${modulesDir}/v8-debug`);
await rebuildNativeModules(version, modulesDir, 'v8-debug', null, arch);
await preGypFixRun(path.join(modulesDir, 'v8-debug'), true, executablePath);
console.log(`Done.`);
}
.then(function (shouldBuild) {
if (!shouldBuild) {
return true;
}
console.log('Rebuilding native modules for Electron...');
return rebuild.installNodeHeaders(electronPackage.version)
.then(function () {
return rebuild.rebuildNativeModules(electronPackage.version, pathToElectronNativeModules);
});
})
.then(function () {
electronVersion = electronVersion.match(/v(\d+\.\d+\.\d+)/)[1];
let hadError = false;
return foldersToRebuild.reduce((soFar, currentFolder) => {
return soFar
.then(() => {
console.log(` ${currentFolder}`);
return electronRebuild.rebuildNativeModules(electronVersion, currentFolder);
})
.then(() => electronRebuild.preGypFixRun(currentFolder, true, electron))
.catch((e) => {
hadError = true;
console.error(e);
});
}, electronRebuild.installNodeHeaders(electronVersion))
.then(() => {
if (hadError) {
throw new Error();
}
});
})
.then(() => {
.then(shouldBuild => {
if (!shouldBuild) {
return true
}
console.log('Rebuilding native modules for Electron...')
return rebuild
.installNodeHeaders(electronPackage.version)
.then(() =>
rebuild.rebuildNativeModules(
electronPackage.version,
pathToElectronNativeModules,
),
)
})
.then(() => {
.then(function (shouldBuild) {
if (!shouldBuild) {
return true
}
console.log('Rebuilding native modules for Electron...')
return rebuild.installNodeHeaders(electronPackage.version)
.then(function () {
return rebuild.rebuildNativeModules(electronPackage.version, pathToElectronNativeModules)
})
})
.then(function () {