Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try {
log.info({version: PACKAGE_VERSION}, "electron-builder")
}
catch (e) {
// error in dev mode without babel
if (!(e instanceof ReferenceError)) {
throw e
}
}
const projectDir = process.cwd()
const packageMetadata = new Lazy(() => orNullIfFileNotExist(readJson(path.join(projectDir, "package.json"))))
const config = await getConfig(projectDir, null, null, packageMetadata)
const results = await Promise.all([
computeDefaultAppDirectory(projectDir, use(config.directories, it => it!.app)),
getElectronVersion(projectDir, config, packageMetadata),
])
// if two package.json — force full install (user wants to install/update app deps in addition to dev)
await installOrRebuild(config, results[0], {
frameworkInfo: {version: results[1], useCustomDist: true},
platform: args.platform,
arch: args.arch,
productionDeps: createLazyProductionDeps(results[0], null),
}, results[0] !== projectDir)
}
async function rebuildAppNativeCode(args: any) {
const projectDir = process.cwd()
log.info({platform: args.platform, arch: args.arch}, "executing node-gyp rebuild")
// this script must be used only for electron
await exec(process.platform === "win32" ? "node-gyp.cmd" : "node-gyp", ["rebuild"], {
env: getGypEnv({version: await getElectronVersion(projectDir), useCustomDist: true}, args.platform, args.arch, true),
})
}