Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}, function (err) {
// catch errors
if (plugin_directory != "./plugins/"){ //install plugin modules for Electrify builds
npm.prefix = exec_dir;
console.log(npm.prefix);
}
npm.commands.install(deps, function (er, data) {
if(er){
console.log(er);
}
console.log("Plugin preload complete");
load_plugins()
});
if (err) {
console.log("preload_plugins: " + err);
}
});
} else {
},function (err) {
if (err) {
callback(err,null);
}
else {
npm['no-optional'] = true;
npm['save-optional'] = false;
npm.production = true;
npm.silent = true;
npm.skip_post_install = true;
npm.quiet = true;
npm.prefix = prefixpath;
remove_installed_periodic_from_node_modules({prefixpath:prefixpath},(err)=>{
if (err){ throw err;}
// console.log('installMissingNodeModules npm',npm);
try{
npm.commands.i([],
function (err,data ) {
console.log('trying to restore conf in installMissingNodeModules',data);
// console.log('installMissingNodeModulesAsync extension_config_path',extension_config_path);
// console.log('installMissingNodeModulesAsync initialExtensionConf',initialExtensionConf);
fs.writeJSONSync(extension_config_path,initialExtensionConf);
console.log('restored conf in installMissingNodeModules');
if (err) {
console.log('installMissingNodeModules err',err);
callback(err,null);
}
npm.load({}, function (er) {
if (er) {
throw new Error('插件 ' + generatePluginId(obj) + ' 依赖模块下载失败');
}
// 把安装的模块安装到 ~/.spm/sources/ 插件的 node_moduels
npm.prefix = dir;
var installMods = _.keys(deps).map(function(dep) {
return dep + '@' + deps[dep];
});
npm.commands.install(installMods, function (er, data) {
if (er) {
throw new Error('插件 ' + generatePluginId(obj) + ' 依赖模块下载失败');
}
replacePluginRequire(dir, deps);
cacheModule(key, dir, obj, config);
callback();
});
})
} else {
var localInstall = packages.some(function (item) {
// this is a hack because of REEEIDD! DAMN YOU REEIIDD!
// https://github.com/isaacs/npm/commit/8b7bf5ab0c214b739b5fd6af07003cac9e5fc712
return path.resolve(item) == npm.prefix
})
npm.load(config, function (err) {
if (err) {
return setImmediate(cb, err);
}
npm.root = path.join(dappPath, 'node_modules');
npm.prefix = dappPath;
npm.commands.install(function (err, data) {
return setImmediate(cb, null);
});
});
};
npm.load(function (err) {
if (err) return cb(err)
var file = path.resolve(npm.prefix, 'npm-shrinkwrap.json')
fs.readFile(file, 'utf8', function (err, data) {
cb(err, data && JSON.parse(data))
});
})
}
npm.load(this.builderPackage, function(err) {
if (err) {
return err;
}
var orgPrefix = npm.prefix;
if (version === 'link') {
npm.prefix = __dirname + '/..';
npm.commands.link('handsontable', callback);
npm.prefix = orgPrefix;
}
else {
npm.commands.install(__dirname + '/..', ['git://github.com/handsontable/handsontable#' + version], callback);
}
});
};
npm.load(this.builderPackage, function(err) {
if (err) {
return err;
}
var orgPrefix = npm.prefix;
if (version === 'link') {
npm.prefix = __dirname + '/..';
npm.commands.link('handsontable', callback);
npm.prefix = orgPrefix;
}
else {
npm.commands.install(__dirname + '/..', ['git://github.com/handsontable/handsontable#' + version], callback);
}
});
};
npm.load(config, function (err) {
if (err) {
return setImmediate(cb, err);
}
npm.root = path.join(dappPath, "node_modules");
npm.prefix = dappPath;
npm.commands.install(function (err, data) {
if (err) {
setImmediate(cb, err);
} else {
return setImmediate(cb, null);
}
});
});
}
get: () => {
return npm.prefix
}
},