Skip to content

Commit

Permalink
Fix electron-rebuild script (#1370)
Browse files Browse the repository at this point in the history
* Fix electron-rebuild script

* Added node_modules path existence check for rebuild script
  • Loading branch information
amilajack authored Jan 9, 2018
1 parent 374ddd5 commit c39b82a
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions internals/scripts/ElectronRebuild.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
// @flow
import path from 'path';
import { execSync } from 'child_process';
import fs from 'fs';
import dependencies from '../../app/package.json';

const electronRebuildCmd =
const nodeModulesPath =
path.join(__dirname, '..', '..', 'app', 'node_modules');

if (Object.keys(dependencies || {}).length > 0 && fs.existsSync(nodeModulesPath)) {
const electronRebuildCmd =
'../node_modules/.bin/electron-rebuild --parallel --force --types prod,dev,optional --module-dir .';

const cmd = process.platform === 'win32'
? electronRebuildCmd.replace(/\//g, '\\')
: electronRebuildCmd;
const cmd = process.platform === 'win32'
? electronRebuildCmd.replace(/\//g, '\\')
: electronRebuildCmd;

execSync(cmd, {
cwd: path.join(__dirname, '..', '..', 'app')
});
execSync(cmd, {
cwd: path.join(__dirname, '..', '..', 'app')
});
}

0 comments on commit c39b82a

Please sign in to comment.