From e41024f5f42fc458e4e6f8812d796d8c1059dde7 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 23 Mar 2018 12:53:53 +0100 Subject: [PATCH] package: move launcher js to src --- .gitignore | 1 + app/launcher/index.html | 18 ++++++++++++++++++ app/main/launcher/index.html | 18 ------------------ app/main/main.js | 2 +- app/package.json | 1 - package.json | 4 +++- scripts/{build-js.js => build-browser.js} | 2 +- scripts/build-launcher.js | 16 ++++++++++++++++ src/browser/js/{browser.js => index.js} | 0 .../launcher.js => src/launcher/index.js | 2 +- 10 files changed, 41 insertions(+), 23 deletions(-) create mode 100644 app/launcher/index.html delete mode 100644 app/main/launcher/index.html rename scripts/{build-js.js => build-browser.js} (91%) create mode 100644 scripts/build-launcher.js rename src/browser/js/{browser.js => index.js} (100%) rename app/main/launcher/launcher.js => src/launcher/index.js (99%) diff --git a/.gitignore b/.gitignore index 7df7f05f..d3d41c97 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ app/browser/scripts.js app/browser/scripts.js.map app/browser/favicon.png app/browser/logo.png +app/launcher/scripts.js diff --git a/app/launcher/index.html b/app/launcher/index.html new file mode 100644 index 00000000..3212b5f1 --- /dev/null +++ b/app/launcher/index.html @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + +
+ + + diff --git a/app/main/launcher/index.html b/app/main/launcher/index.html deleted file mode 100644 index b2f581bb..00000000 --- a/app/main/launcher/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - -
- - - diff --git a/app/main/main.js b/app/main/main.js index 09e5b1cc..b92661f7 100644 --- a/app/main/main.js +++ b/app/main/main.js @@ -61,7 +61,7 @@ if (settings.cli) { var app = require('./electron-app'), path = require('path'), - address = 'file://' + path.resolve(__dirname + '/launcher/' + 'index.html'), + address = 'file://' + path.resolve(__dirname + '/../launcher/' + 'index.html'), {ipcMain} = require('electron'), launcher diff --git a/app/package.json b/app/package.json index 0c4f2371..e37ab6d7 100644 --- a/app/package.json +++ b/app/package.json @@ -25,7 +25,6 @@ "chokidar": "2.0.2", "electron-localshortcut": "3.1.0", "express": "4.16.3", - "jquery": "3.3.1", "osc": "2.2.0", "python-shell": "0.5.0", "vmodule": "1.0.1", diff --git a/package.json b/package.json index 120f0b0c..99888687 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,9 @@ "watch-css": "nodemon --watch src/browser/scss -e scss -x \"npm run build-css && node scripts/reload-css.js\"", "watch-js": "nodemon --watch src/browser/js -e js -x \"npm run build-js\"", "build-css": "node scripts/build-css.js", - "build-js": "node scripts/build-js.js > app/browser/scripts.js", + "build-js": "npm run build-launcher-js && npm run build-browser-js", + "build-browser-js": "node scripts/build-browser.js > app/browser/scripts.js", + "build-launcher-js": "node scripts/build-launcher.js > app/launcher/scripts.js", "deploy-docs": "cd resources && mkdocs gh-deploy --clean && rm -rf site", "test": "npm run build" }, diff --git a/scripts/build-js.js b/scripts/build-browser.js similarity index 91% rename from scripts/build-js.js rename to scripts/build-browser.js index 22c10e16..b436916a 100644 --- a/scripts/build-js.js +++ b/scripts/build-browser.js @@ -28,7 +28,7 @@ var ignoreList = ['**/mathjs/dist/math.min.js', '**/jquery.slim.min.js', '**/jqu if (prod) console.warn('\x1b[36m%s\x1b[0m', 'Building minified js bundle for production... This may take a while... '); -b = browserify(path.resolve(__dirname + '/../src/browser/js/browser.js'), {debug:!fast, insertGlobals:fast, noParse: ignoreList}) +b = browserify(path.resolve(__dirname + '/../src/browser/js/index.js'), {debug:!fast, insertGlobals:fast, noParse: ignoreList}) b = b.transform(ignoreWrapper(babelify), {presets: ["env"]}) diff --git a/scripts/build-launcher.js b/scripts/build-launcher.js new file mode 100644 index 00000000..44cfde5f --- /dev/null +++ b/scripts/build-launcher.js @@ -0,0 +1,16 @@ +var browserify = require('browserify'), + licensify = require('licensify'), + path = require('path'), + ignoreList = ['**/mathjs/dist/math.min.js'] + + +browserify(path.resolve(__dirname + '/../src/launcher/index.js'), { + debug: true, + ignoreMissing: false , + detectGlobals: false, + bare: true, + noParse: ignoreList +}) +.plugin(licensify) +.bundle() +.pipe(process.stdout) diff --git a/src/browser/js/browser.js b/src/browser/js/index.js similarity index 100% rename from src/browser/js/browser.js rename to src/browser/js/index.js diff --git a/app/main/launcher/launcher.js b/src/launcher/index.js similarity index 99% rename from app/main/launcher/launcher.js rename to src/launcher/index.js index 16b839de..19e07f80 100644 --- a/app/main/launcher/launcher.js +++ b/src/launcher/index.js @@ -1,4 +1,4 @@ -var {remote, ipcRenderer, shell} = require('electron'), +var {remote, ipcRenderer, shell} = eval("require('electron')"), {dialog, webContents, Menu, MenuItem, app} = remote.require('electron'), menu = new Menu(), settings = remote.require('./main/settings'),