diff --git a/app/main/index.js b/app/main/index.js index 66fed72a..dd9a3e42 100644 --- a/app/main/index.js +++ b/app/main/index.js @@ -96,6 +96,7 @@ if (settings.cli) { launcher app.on('ready',function(){ + global.settings = settings launcher = require('./electron-window')({address:address, shortcuts:dev, width:680, height:(100 + 8*3 + 29 * Object.keys(settings.options).filter(x=>settings.options[x].launcher !== false).length), node:true, color:'#253040'}) }) diff --git a/scripts/package-node.js b/scripts/package-node.js index 8af2667e..c7516ccd 100644 --- a/scripts/package-node.js +++ b/scripts/package-node.js @@ -10,7 +10,6 @@ var browserify = require('browserify'), ['../app/launcher', '../dist/open-stage-control-node/launcher'], ['../app/browser', '../dist/open-stage-control-node/browser'], ['../app/main/midi.py', '../dist/open-stage-control-node/main/midi.py'], - ['../app/main/settings.js', '../dist/open-stage-control-node/main/settings.js'], ['../app/examples', '../dist/open-stage-control-node/examples'], ['../app/LICENSE', '../dist/open-stage-control-node/LICENSE'] ] @@ -21,12 +20,12 @@ for (let i in files) { filter: /node_modules\/(serialport|uws)/, overwrite: true }, ()=>{ - if (i == files.length - 1) bundle() + if (i == files.length - 1) bundleMain() }) } -function bundle() { +function bundleMain() { var tmp = path.resolve(__dirname + '/../app/main/index-node.js'), index = fs.readFileSync(path.resolve(__dirname + '/../app/main/index.js')) @@ -55,8 +54,6 @@ function bundle() { }) .ignore('serialport') .exclude('electron') - .exclude(path.resolve(__dirname + '/../app/main/settings.js')) - var output = b.bundle() @@ -67,8 +64,6 @@ function bundle() { writer.once('finish', ()=>{ fs.unlinkSync(tmp) - var outputFile = fs.readFileSync(outputPath) - fs.writeFileSync(outputPath, outputFile.toString().replace(/require\('\.\.\/settings'\)/g, `require('./settings')`)) }) diff --git a/src/launcher/index.js b/src/launcher/index.js index f24601e3..fa66f1b0 100644 --- a/src/launcher/index.js +++ b/src/launcher/index.js @@ -1,7 +1,7 @@ var {remote, ipcRenderer, shell} = eval('require(\'electron\')'), {dialog, Menu, MenuItem, app} = remote.require('electron'), menu = new Menu(), - settings = remote.require('./main/settings'), + settings = remote.getGlobal('settings'), packageInfos = remote.require('./package.json'), packageVersion = packageInfos.version, packageUrl = packageInfos.repository.url,