Skip to content

Commit

Permalink
fix(packager): rebuild pre-gyp modules with their binary variables
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound authored and malept committed Dec 11, 2016
1 parent bc1ec28 commit ed9137d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/util/rebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) => {
Expand Down

0 comments on commit ed9137d

Please sign in to comment.