mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-25 08:35:16 +08:00
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
#!/usr/bin/env node
|
|
/* eslint global-require: 0 */
|
|
/* eslint quote-props: 0 */
|
|
const path = require('path');
|
|
const safeExec = require('./utils/child-process-wrapper.js').safeExec;
|
|
|
|
const npmEnvs = {
|
|
system: process.env,
|
|
electron: Object.assign({}, process.env, {
|
|
'npm_config_target': require('../packages/client-app/package.json').dependencies.electron,
|
|
'npm_config_arch': process.arch,
|
|
'npm_config_target_arch': process.arch,
|
|
'npm_config_disturl': 'https://atom.io/download/atom-shell',
|
|
'npm_config_runtime': 'electron',
|
|
'npm_config_build_from_source': true,
|
|
}),
|
|
};
|
|
|
|
function npm(cmd, options) {
|
|
const {cwd, env} = Object.assign({cwd: '.', env: 'system'}, options);
|
|
|
|
return new Promise((resolve, reject) => {
|
|
console.log(`\n-- Running npm ${cmd} in ./${cwd} with ${env} config --`)
|
|
|
|
safeExec(`npm ${cmd}`, {
|
|
cwd: path.resolve(__dirname, '..', cwd),
|
|
env: npmEnvs[env],
|
|
}, (err) => {
|
|
return err ? reject(err) : resolve(null);
|
|
});
|
|
});
|
|
}
|
|
|
|
npm('install', {cwd: './packages/client-app', env: 'electron'})
|
|
.then(() => npm('dedupe', {cwd: './packages/client-app', env: 'electron'}))
|