Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Rebuilds native node modules for Electron.
// More: https://github.com/atom/electron/blob/master/docs/tutorial/using-native-node-modules.md
'use strict';
var path = require('path');
var electron = require('electron-prebuilt');
var electronPackage = require('electron-prebuilt/package.json');
var rebuild = require('electron-rebuild');
var pathToElectronNativeModules = path.join(__dirname, '../app/node_modules');
rebuild.shouldRebuildNativeModules(electron)
.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 () {
console.log('Rebuilding complete.'); // eslint-disable-line no-console
})
.catch(function (err) {
// Rebuilds native node modules for Electron.
// More: https://github.com/atom/electron/blob/master/docs/tutorial/using-native-node-modules.md
const path = require('path')
const Q = require('q')
const electron = require('electron')
const electronPackage = require('electron/package.json')
const rebuild = require('electron-rebuild')
const pathToElectronNativeModules = path.join(__dirname, '../app/node_modules')
rebuild
.shouldRebuildNativeModules(electron)
.then(shouldBuild => {
if (!shouldBuild) {
return true
}
console.log('Rebuilding native modules for Electron...')
return rebuild
.installNodeHeaders(electronPackage.version)
.then(() =>
rebuild.rebuildNativeModules(
electronPackage.version,
pathToElectronNativeModules,
),
)
// Rebuilds native node modules for Electron.
// More: https://github.com/atom/electron/blob/master/docs/tutorial/using-native-node-modules.md
'use strict'
const path = require('path')
const electron = require('electron')
const electronPackage = require('electron/package.json')
const rebuild = require('electron-rebuild')
let pathToElectronNativeModules = path.join(__dirname, '../build/node_modules')
rebuild.shouldRebuildNativeModules(electron)
.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 () {
console.log('Rebuilding complete.')
})
.catch(function (err) {
// Rebuilds native node modules for Electron.
// More: https://github.com/atom/electron/blob/master/docs/tutorial/using-native-node-modules.md
'use strict';
var path = require('path');
var Q = require('q');
var electron = require('electron-prebuilt');
var electronPackage = require('electron-prebuilt/package.json');
var rebuild = require('electron-rebuild');
var pathToElectronNativeModules = path.join(__dirname, '../app/node_modules');
rebuild.shouldRebuildNativeModules(electron)
.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 () {
console.log('Rebuilding complete.');
})
.catch(function (err) {
fs.readdirSync(p).forEach((item) => {
let fullDependencyPath = path.join(p, item);
let nodeModulesPath = path.join(fullDependencyPath, "node_modules");
if (fs.statSync(fullDependencyPath).isDirectory() && fs.existsSync(nodeModulesPath)) {
recurseFolders.push(nodeModulesPath);
}
});
recurseFolders.forEach((f) => {
cleanKnownModulesRecursive(f);
});
}
electronRebuild.shouldRebuildNativeModules(electron)
.then((shouldBuild) => {
if (!shouldBuild) {
console.log("It doesn't look like you need to rebuild");
return Promise.resolve();
}
console.log("Detecting linked modules (\"npm link\")...");
fs.readdirSync(targetDir).forEach((m) => {
let moduleRootPath = path.resolve(targetDir, m);
let stat = fs.statSync(moduleRootPath);
if (stat.isDirectory()) {
let finalLink = path.resolve(findFinalLinkTarget(moduleRootPath));
if (finalLink !== moduleRootPath) {
console.log(` Detected npm link: ${m}`);