Skip to content

Commit

Permalink
Make yarn:electron fail explicitly on Windows
Browse files Browse the repository at this point in the history
Before this commit, the `yarn rebuild:electron` used to fail silently.
We now get a proper output and exit code.

Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
  • Loading branch information
paul-marechal committed Nov 19, 2019
1 parent 5c02a25 commit a5419e3
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions dev-packages/application-manager/src/rebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import fs = require('fs-extra');
import path = require('path');
import cp = require('child_process');

export function rebuild(target: 'electron' | 'browser', modules: string[]): void {
const nodeModulesPath = path.join(process.cwd(), 'node_modules');
Expand All @@ -43,12 +42,8 @@ export function rebuild(target: 'electron' | 'browser', modules: string[]): void
try {
pack.dependencies = Object.assign({}, pack.dependencies, dependencies);
fs.writeFileSync(packFile, JSON.stringify(pack, undefined, ' '));
const electronRebuildPath = path.join(process.cwd(), 'node_modules', '.bin', 'electron-rebuild');
if (process.platform === 'win32') {
cp.spawnSync('cmd', ['/c', electronRebuildPath]);
} else {
require(electronRebuildPath);
}
const electronRebuildPackageJson = require('electron-rebuild/package.json');
require(`electron-rebuild/${electronRebuildPackageJson['bin']['electron-rebuild']}`);
} finally {
setTimeout(() => {
fs.writeFile(packFile, packageText);
Expand Down

0 comments on commit a5419e3

Please sign in to comment.