fix(packager): rebuild pre-gyp modules with their binary variables
This commit is contained in:
Родитель
bc1ec28d6c
Коммит
ed9137dd13
|
@ -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) => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче