From 95d34878206b86f65a59c881ac7b4148f485ef91 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 10 Apr 2018 10:27:39 +0200 Subject: [PATCH] [package.json] added electron build commands + dependencies [install.sh] linux installation script (/usr/share/applications) --- install.sh | 25 +++++++++++++++++++++++++ package.json | 8 ++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..395ad2a --- /dev/null +++ b/install.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# 1. Get + Go to current directory +ROOT="`realpath $(dirname $0)`"; +cd $ROOT; + +# 2. Install npm dependencies +echo -e "[1/3] installing dependencies"; +npm --prefix=$ROOT install; + +# 3. Build electron-app +echo -e "[2/3] building electron app"; +npm --prefix=$ROOT run build:electron; + +# 4. Create launching application +echo -e "[3/3] creating application shorcut"; +DESKTOP_APP="[Desktop Entry]\n"; +DESKTOP_APP+="Name=Douscord\n"; +DESKTOP_APP+="GenericName=Douscord\n" +DESKTOP_APP+="Exec=/bin/bash -c 'cd /home/xdrm-brackets/ubuntu/git.xdrm.io/discord/client/; npm run electron;'\n"; +DESKTOP_APP+="Terminal=false\n"; +DESKTOP_APP+="Type=Application\n"; +DESKTOP_APP+="Categories=Chat;Audio;Messages;Communication\n"; + +echo -e "$DESKTOP_APP" | sudo tee /usr/share/applications/douscord.desktop > /dev/null && echo ">>> INSTALLATION SUCCESSFUL <<<" || echo ">>> CANNOT CREATE SHORTUT <<<"; diff --git a/package.json b/package.json index bfa532d..692d78e 100644 --- a/package.json +++ b/package.json @@ -7,13 +7,16 @@ "private": true, "scripts": { "clean": "rm ./public_html/*.html; rm ./public_html/*.js; rm ./public_html/*.css; rm ./public_html/*svg; rm ./public_html/*.map; exit 0", + "clean:electron": "rm -r ./electron-build; exit 0", "dev": "parcel watch ./parcel/index.html --out-dir ./public_html --no-hmr", "build:alternative": "cross-env NODE_ENV=production parcel watch ./parcel/index.html --out-dir ./public_html --no-hmr", - "build": "parcel build ./parcel/index.html --out-dir ./public_html --no-source-maps --no-minify", - "build:electron": "parcel build ./parcel/index.html --out-dir ./public_html --no-source-maps --no-minify --target electron" + "build": "parcel build ./parcel/index.html --public-url ./ --out-dir ./public_html --no-source-maps --no-minify", + "build:electron": "parcel build ./parcel/index.html --public-url ./ --out-dir ./electron-build --no-source-maps --no-minify --target=electron", + "electron": "electron ./electron-build/index.html" }, "dependencies": { "vue": "^2.5.9", + "vue-hot-reload-api": "^2.3.0", "vue-router": "^2.5.3" }, "browserslist": [ @@ -28,6 +31,7 @@ "babel-preset-env": "^1.6.0", "babel-preset-stage-3": "^6.24.1", "cross-env": "^5.0.5", + "electron": "^1.8.4", "node-sass": "^4.8.3", "parcel-bundler": "^1.7.0", "vue-template-compiler": "^2.5.16"