Electron: Use a Makefile

This commit is contained in:
Lorenz Hübschle-Schneider 2016-04-02 18:08:55 +02:00
parent 2112757a2d
commit f4245f1296
3 changed files with 34 additions and 4 deletions

4
.gitignore vendored
View file

@ -1,2 +1,6 @@
bower_components/
node_modules/
# Electron stuff
fonts/
Glowing\ Bear-*/

27
electron.makefile Normal file
View file

@ -0,0 +1,27 @@
# Common flags for electron-packager on all platforms
ELECTRON_COMMON=. "Glowing Bear" --overwrite --version-string.FileDescription="Glowing Bear" --ignore=node_modules --ignore=test --ignore=bower_components
# fetch dependencies for local installation
bower:
bower install
# copy dependencies from bower_components to the correct place
copylocal:
find bower_components \( -name "*min.js" -o -name "*min.css" \) -exec cp {} 3rdparty \;
cp -r bower_components/bootstrap/fonts .
cp bower_components/emojione/assets/sprites/emojione.sprites.svg 3rdparty
# modify index.html to use local files
uselocal: copylocal
sed -i 's,https://cdnjs.cloudflare.com/ajax/libs/[^\"]*/,3rdparty/,g' index.html
sed -i 's, integrity=\".*\" crossorigin=\"anonymous\",,' index.html
# build the electron app for various platforms
build-electron-windows: uselocal
electron-packager ${ELECTRON_COMMON} --platform=win32 --arch=ia32 --version=0.37.2 --icon=assets/img/favicon.ico --asar=true
build-electron-darwin: uselocal
electron-packager ${ELECTRON_COMMON} --platform=darwin --arch=x64 --version=0.37.3 --icon=assets/img/glowing-bear.icns
build-electron-linux: uselocal
electron-packager ${ELECTRON_COMMON} --platform=linux --arch=x64 --version=0.37.3 --icon=assets/img/favicon.ico

View file

@ -32,10 +32,9 @@
"update-webdriver": "webdriver-manager update",
"preprotractor": "npm run update-webdriver",
"protractor": "protractor test/protractor-conf.js",
"use-local-files": "find bower_components \\( -name \"*min.js\" -o -name \"*min.css\" \\) -exec cp {} 3rdparty \\; ; cp -r bower_components/bootstrap/fonts . ; p bower_components/emojione/assets/sprites/emojione.sprites.svg 3rdparty; sed -i 's,https://cdnjs.cloudflare.com/ajax/libs/[^\"]*/,3rdparty/,g' index.html ; sed -i 's, integrity=\".*\" crossorigin=\"anonymous\",,' index.html",
"build-electron-windows": "electron-packager . \"Glowing Bear\" --platform=win32 --arch=ia32 --version=0.37.2 --overwrite --icon=assets/img/favicon.ico --asar=true --version-string.FileDescription=\"Glowing Bear\" --ignore=node_modules --ignore=test",
"build-electron-darwin": "electron-packager . \"Glowing Bear\" --platform=darwin --arch=x64 --version=0.37.3 --overwrite --icon=assets/img/glowing-bear.icns --version-string.FileDescription=\"Glowing Bear\" --ignore=node_modules --ignore=test",
"build-electron-linux": "electron-packager . \"Glowing Bear\" --platform=linux --arch=x64 --version=0.37.3 --overwrite --icon=assets/img/favicon.ico --version-string.FileDescription=\"Glowing Bear\" --ignore=node_modules --ignore=test",
"build-electron-windows": "make -f electron.makefile build-electron-windows",
"build-electron-darwin": "make -f electron.makefile build-electron-darwin",
"build-electron-linux": "make -f electron.makefile build-electron-linux",
"update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/, '//@@NG_LOADER_START@@\\n' + cat('app/bower_components/angular-loader/angular-loader.min.js') + '\\n//@@NG_LOADER_END@@', 'app/index-async.html');\""
}
}