mirror of
https://github.com/TheGreyDiamond/Enlight.git
synced 2026-04-01 07:10:23 +02:00
init
This commit is contained in:
22
enlightApp/internals/scripts/ElectronRebuild.js
Normal file
22
enlightApp/internals/scripts/ElectronRebuild.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import path from 'path';
|
||||
import { execSync } from 'child_process';
|
||||
import fs from 'fs';
|
||||
import { dependencies } from '../../app/package.json';
|
||||
|
||||
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;
|
||||
execSync(cmd, {
|
||||
cwd: path.join(__dirname, '..', '..', 'app'),
|
||||
stdio: 'inherit',
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user