Skip to content
Permalink
Browse files

fix(packager): rebuild pre-gyp modules with their binary variables

  • Loading branch information
MarshallOfSound authored and malept committed Dec 11, 2016
1 parent bc1ec28 commit ed9137dd135cb68bb83b7ccbc509ee73d9104747
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/util/rebuild.js
@@ -28,7 +28,18 @@ export default async (buildPath, electronVersion, pPlatform, pArch) => {
`--target=${electronVersion}`,
`--arch=${pArch}`,
'--dist-url=https://atom.io/download/electron',
'--build-from-source',
];

const modulePackageJSON = JSON.parse(await fs.readFile(path.resolve(modulePath, 'package.json')));
Object.keys(modulePackageJSON.binary || {}).forEach((binaryKey) => {
let value = modulePackageJSON.binary[binaryKey];
if (binaryKey === 'module_path') {
value = path.resolve(modulePath, value);
}
rebuildArgs.push(`--${binaryKey}=${value}`);
});

await new Promise((resolve, reject) => {
const child = spawn(process.execPath, [path.resolve(__dirname, '../../node_modules/.bin/node-gyp')].concat(rebuildArgs), {
cwd: modulePath,
@@ -40,6 +51,7 @@ export default async (buildPath, electronVersion, pPlatform, pArch) => {
npm_config_runtime: 'electron',
npm_config_arch: pArch,
npm_config_target_arch: pArch,
npm_config_build_from_source: true,
}),
});
child.on('exit', async (code) => {

0 comments on commit ed9137d

Please sign in to comment.
You can’t perform that action at this time.