fix(init): run package manager commands via cross-spawn
Allows dependencies with carets to be escaped properly on Windows.
This commit is contained in:
Родитель
50d35374db
Коммит
cbee55e298
|
@ -104,6 +104,7 @@
|
|||
"bluebird": "^3.4.6",
|
||||
"colors": "^1.1.2",
|
||||
"commander": "^2.9.0",
|
||||
"cross-spawn-promise": "^0.10.1",
|
||||
"debug": "^3.0.0",
|
||||
"electron-forge-template-angular2": "^1.0.3",
|
||||
"electron-forge-template-react": "^1.0.2",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { spawnPromise } from 'spawn-rx';
|
||||
import crossSpawn from 'cross-spawn-promise';
|
||||
import logSymbols from 'log-symbols';
|
||||
import yarnOrNpm from 'yarn-or-npm';
|
||||
|
||||
|
@ -18,6 +18,6 @@ const safeYarnOrNpm = () => {
|
|||
|
||||
export default safeYarnOrNpm;
|
||||
|
||||
export const yarnOrNpmSpawn = (...args) => spawnPromise(safeYarnOrNpm(), ...args);
|
||||
export const yarnOrNpmSpawn = (...args) => crossSpawn(safeYarnOrNpm(), ...args);
|
||||
|
||||
export const hasYarn = () => safeYarnOrNpm() === 'yarn';
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
import { expect } from 'chai';
|
||||
import fs from 'fs-extra';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
import installDeps from '../../src/util/install-dependencies';
|
||||
|
||||
describe('install-dependencies', () => {
|
||||
const installDir = path.resolve(os.tmpdir(), 'electron-forge-test-install-dependencies');
|
||||
|
||||
before(async () => { fs.ensureDir(installDir); });
|
||||
|
||||
it('should install the latest minor version when the dependency has a caret', async () => {
|
||||
await installDeps(installDir, ['debug@^2.0.0']);
|
||||
|
||||
const packageJSON = require(path.resolve(installDir, 'node_modules', 'debug', 'package.json'));
|
||||
expect(packageJSON.version).to.not.equal('2.0.0');
|
||||
});
|
||||
|
||||
after(async () => await fs.remove(installDir));
|
||||
});
|
Загрузка…
Ссылка в новой задаче