Build electronjs linux app

This commit is contained in:
ziajka 2018-01-04 11:08:30 +01:00
parent d2cc41b19b
commit 6dfa755c50
7 changed files with 108 additions and 123 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@
/tmp
/out-tsc
/ng-dist
/build
# dependencies
/node_modules

View File

@ -1,19 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
Chromium <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
<script>
// You can also require other files to run in this process
require('./renderer.js')
</script>
</body>
</html>

26
main.js
View File

@ -1,11 +1,11 @@
const electron = require('electron')
const electron = require('electron');
// Module to control application life.
const app = electron.app
const app = electron.app;
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow
const BrowserWindow = electron.BrowserWindow;
const path = require('path')
const url = require('url')
const path = require('path');
const url = require('url');
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
@ -13,17 +13,17 @@ let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({width: 800, height: 600})
mainWindow = new BrowserWindow({width: 800, height: 600});
// and load the index.html of the app.
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'ng-dist/index.html'),
pathname: path.join(__dirname, 'dist/index.html'),
protocol: 'file:',
slashes: true
}))
}));
// Open the DevTools.
// mainWindow.webContents.openDevTools()
// mainWindow.webContents.openDevTools();
// Emitted when the window is closed.
mainWindow.on('closed', function () {
@ -31,13 +31,13 @@ function createWindow () {
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
});
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)
app.on('ready', createWindow);
// Quit when all windows are closed.
app.on('window-all-closed', function () {
@ -46,7 +46,7 @@ app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit()
}
})
});
app.on('activate', function () {
// On OS X it's common to re-create a window in the app when the
@ -54,7 +54,7 @@ app.on('activate', function () {
if (mainWindow === null) {
createWindow()
}
})
});
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.

View File

@ -10,7 +10,13 @@
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"build-for-electron": "ng build --prod --output-path ng-dist --base-href ./"
"electrondev": "concurrently -k \"ng serve\" \"electron .\"",
"distlinux": "ng build --prod && electron-builder --linux"
},
"build": {
"directories": {
"output": "build"
}
},
"private": true,
"dependencies": {

View File

@ -18,7 +18,7 @@ const routes: Routes = [
];
@NgModule({
imports: [ RouterModule.forRoot(routes) ],
imports: [ RouterModule.forRoot(routes, {useHash: true}) ],
exports: [ RouterModule ]
})
export class AppRoutingModule {}

View File

@ -3,11 +3,14 @@
<head>
<meta charset="utf-8">
<title>GNS3 Web UI Demo</title>
<base href="/">
<!-- <base href="./"> //-->
<script>document.write('<base href="' + document.location + '" />');</script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="assets/favicon.ico">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto+Slab:400,700" type="text/css">

170
yarn.lock
View File

@ -48,8 +48,8 @@
rxjs "^5.5.2"
"@angular/animations@^5.1.2":
version "5.1.2"
resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-5.1.2.tgz#464df9a9e30c7a8146118fdd9bff82cdfcf97d7e"
version "5.1.3"
resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-5.1.3.tgz#3af3073bfdfeac61d7e6058257b3b19c97183a96"
dependencies:
tslib "^1.7.1"
@ -124,14 +124,14 @@
node-sass "^4.3.0"
"@angular/common@^5.1.2":
version "5.1.2"
resolved "https://registry.yarnpkg.com/@angular/common/-/common-5.1.2.tgz#b2659161575d463bb8b3e30e37434b26d70366b4"
version "5.1.3"
resolved "https://registry.yarnpkg.com/@angular/common/-/common-5.1.3.tgz#db517c00a95f72885eb2091098eaed4f95494a63"
dependencies:
tslib "^1.7.1"
"@angular/compiler-cli@^5.1.2":
version "5.1.2"
resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-5.1.2.tgz#70addc11b6528f087abe809f94acedecdfc9c8f6"
version "5.1.3"
resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-5.1.3.tgz#e9cfd183a8a12fddad0188d2b7e4e9a45f302d82"
dependencies:
chokidar "^1.4.2"
minimist "^1.2.0"
@ -139,32 +139,32 @@
tsickle "^0.25.5"
"@angular/compiler@^5.1.2":
version "5.1.2"
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-5.1.2.tgz#4dfd0dd7fab39a14a1a104097c2f6af470ddabdb"
version "5.1.3"
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-5.1.3.tgz#125008477895aee1bf71294bf981a4ba184c1e59"
dependencies:
tslib "^1.7.1"
"@angular/core@>=4.3.1", "@angular/core@^5.1.2":
version "5.1.2"
resolved "https://registry.yarnpkg.com/@angular/core/-/core-5.1.2.tgz#751070c0f4e5a8c4e2170204e08eca06391b84b1"
version "5.1.3"
resolved "https://registry.yarnpkg.com/@angular/core/-/core-5.1.3.tgz#b739f69834c344285250a384d0c203dd36778a37"
dependencies:
tslib "^1.7.1"
"@angular/forms@^5.1.2":
version "5.1.2"
resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-5.1.2.tgz#fae4934ccdd41443efdee49b754c8b2a5587b12c"
version "5.1.3"
resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-5.1.3.tgz#fe4c0c37c504e78c85f8e50db6e098705fa72f4c"
dependencies:
tslib "^1.7.1"
"@angular/http@^5.1.2":
version "5.1.2"
resolved "https://registry.yarnpkg.com/@angular/http/-/http-5.1.2.tgz#38edf3bec056e9c3456868799f4c0f83127c73b9"
version "5.1.3"
resolved "https://registry.yarnpkg.com/@angular/http/-/http-5.1.3.tgz#eeea2a6760fa54449a967fb5abdd473736c5c989"
dependencies:
tslib "^1.7.1"
"@angular/language-service@^5.1.2":
version "5.1.2"
resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-5.1.2.tgz#0c0579c2feb7dd9afb2576e9b602779d45b30810"
version "5.1.3"
resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-5.1.3.tgz#b55f295943133e33940ff71e6bb0afa93d7f4d36"
"@angular/material@^5.0.3":
version "5.0.3"
@ -173,20 +173,20 @@
tslib "^1.7.1"
"@angular/platform-browser-dynamic@^5.1.2":
version "5.1.2"
resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-5.1.2.tgz#120d49ce16bcb91b8ac1c5e5c634fba592359ad7"
version "5.1.3"
resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-5.1.3.tgz#ad37e4dbd5251e7ea256ad9323fe11c848d04050"
dependencies:
tslib "^1.7.1"
"@angular/platform-browser@^5.1.2":
version "5.1.2"
resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-5.1.2.tgz#6faf926b9b41b6d54d873f3dcc4f31ad35fd0c38"
version "5.1.3"
resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-5.1.3.tgz#5abe7809009eff6bff3bf89faba96fe066fb2036"
dependencies:
tslib "^1.7.1"
"@angular/router@^5.1.2":
version "5.1.2"
resolved "https://registry.yarnpkg.com/@angular/router/-/router-5.1.2.tgz#1da8845478ca340e9c4b3d9da1d1a8ee796fda18"
version "5.1.3"
resolved "https://registry.yarnpkg.com/@angular/router/-/router-5.1.3.tgz#69627d7186e4ab8e7d4058c4400f82d3899ebd7a"
dependencies:
tslib "^1.7.1"
@ -386,8 +386,8 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.51.tgz#1fb9bd2c7d28b1e8b1fe438f01494d0da8e451af"
"@types/node@~8.5.2":
version "8.5.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.5.2.tgz#83b8103fa9a2c2e83d78f701a9aa7c9539739aa5"
version "8.5.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.5.5.tgz#6f9e8164ae1a55a9beb1d2571cfb7acf9d720c61"
"@types/q@^0.0.32":
version "0.0.32"
@ -673,12 +673,12 @@ asap@^2.0.0, asap@~2.0.3, asap@~2.0.5:
version "2.0.6"
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46"
asar-integrity@0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/asar-integrity/-/asar-integrity-0.2.3.tgz#b238a68ef1218561b4904db8400c0943fbc62c62"
asar-integrity@0.2.4:
version "0.2.4"
resolved "https://registry.yarnpkg.com/asar-integrity/-/asar-integrity-0.2.4.tgz#b7867c9720e08c461d12bc42f005c239af701733"
dependencies:
bluebird-lst "^1.0.5"
fs-extra-p "^4.4.4"
fs-extra-p "^4.5.0"
asn1.js@^4.0.0:
version "4.9.2"
@ -1209,30 +1209,29 @@ buffer@^5.0.2:
base64-js "^1.0.2"
ieee754 "^1.1.4"
builder-util-runtime@3.5.0, builder-util-runtime@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-3.5.0.tgz#c78f3c6c06aacf53a544d8c6c0728f69bc176c19"
builder-util-runtime@4.0.0, builder-util-runtime@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-4.0.0.tgz#783a4148164e8f9e2ffd4ffa4c2e0a0886e19496"
dependencies:
bluebird-lst "^1.0.5"
debug "^3.1.0"
fs-extra-p "^4.5.0"
sax "^1.2.4"
builder-util@3.5.0, builder-util@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-3.5.0.tgz#ecef7b7624212f46e990854e81a831e6ff969a2b"
builder-util@4.1.1, builder-util@^4.1.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-4.1.1.tgz#478af1de7a2c5e1a9928712d558ae8e10ce727a7"
dependencies:
"7zip-bin" "^2.3.4"
bluebird-lst "^1.0.5"
builder-util-runtime "^3.5.0"
builder-util-runtime "^4.0.0"
chalk "^2.3.0"
debug "^3.1.0"
fs-extra-p "^4.5.0"
ini "^1.3.5"
is-ci "^1.0.10"
is-ci "^1.1.0"
js-yaml "^3.10.0"
lazy-val "^1.0.3"
node-emoji "^1.8.1"
semver "^5.4.1"
source-map-support "^0.5.0"
stat-mode "^0.2.2"
@ -1337,8 +1336,8 @@ caniuse-api@^1.5.2:
lodash.uniq "^4.5.0"
caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639:
version "1.0.30000784"
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000784.tgz#1be95012d9489c7719074f81aee57dbdffe6361b"
version "1.0.30000787"
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000787.tgz#ca07a281be536a88bd7fac96ba895f3cf53f811b"
capture-stack-trace@^1.0.0:
version "1.0.0"
@ -2479,13 +2478,12 @@ dir-glob@^2.0.0:
arrify "^1.0.1"
path-type "^3.0.0"
dmg-builder@2.1.10:
version "2.1.10"
resolved "https://registry.yarnpkg.com/dmg-builder/-/dmg-builder-2.1.10.tgz#8430fda3620d4390c4045b8fe7f8d94917e8e57a"
dmg-builder@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/dmg-builder/-/dmg-builder-3.1.0.tgz#11b8ec781b64813116b7ddc9175d673d59e1ad02"
dependencies:
bluebird-lst "^1.0.5"
builder-util "^3.5.0"
debug "^3.1.0"
builder-util "^4.1.0"
fs-extra-p "^4.5.0"
iconv-lite "^0.4.19"
js-yaml "^3.10.0"
@ -2622,50 +2620,50 @@ ejs@^2.5.7:
version "2.5.7"
resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.7.tgz#cc872c168880ae3c7189762fd5ffc00896c9518a"
electron-builder-lib@19.50.0:
version "19.50.0"
resolved "https://registry.yarnpkg.com/electron-builder-lib/-/electron-builder-lib-19.50.0.tgz#d47f65d68d1f17f6f649e5c9944dca541b3fbe6c"
electron-builder-lib@19.52.1:
version "19.52.1"
resolved "https://registry.yarnpkg.com/electron-builder-lib/-/electron-builder-lib-19.52.1.tgz#d9d7a4524095721d62a597078d42e989d3bca320"
dependencies:
"7zip-bin" "^2.3.4"
asar-integrity "0.2.3"
asar-integrity "0.2.4"
async-exit-hook "^2.0.1"
bluebird-lst "^1.0.5"
builder-util "3.5.0"
builder-util-runtime "3.5.0"
builder-util "4.1.1"
builder-util-runtime "4.0.0"
chromium-pickle-js "^0.2.0"
debug "^3.1.0"
dmg-builder "2.1.10"
dmg-builder "3.1.0"
ejs "^2.5.7"
electron-osx-sign "0.4.7"
electron-publish "19.50.0"
electron-publish "19.52.0"
fs-extra-p "^4.5.0"
hosted-git-info "^2.5.0"
is-ci "^1.0.10"
is-ci "^1.1.0"
isbinaryfile "^3.0.2"
js-yaml "^3.10.0"
lazy-val "^1.0.3"
minimatch "^3.0.4"
normalize-package-data "^2.4.0"
plist "^2.1.0"
read-config-file "1.2.2"
read-config-file "2.0.1"
sanitize-filename "^1.6.1"
semver "^5.4.1"
temp-file "^3.0.0"
electron-builder@^19.42.1:
version "19.50.0"
resolved "https://registry.yarnpkg.com/electron-builder/-/electron-builder-19.50.0.tgz#e4201f802391452e4ac4368893b419df07074713"
version "19.52.1"
resolved "https://registry.yarnpkg.com/electron-builder/-/electron-builder-19.52.1.tgz#c218c641df764e48d082c48ae855beaab52e806a"
dependencies:
bluebird-lst "^1.0.5"
builder-util "3.5.0"
builder-util-runtime "3.5.0"
builder-util "4.1.1"
builder-util-runtime "4.0.0"
chalk "^2.3.0"
electron-builder-lib "19.50.0"
electron-builder-lib "19.52.1"
electron-download-tf "4.3.4"
fs-extra-p "^4.5.0"
is-ci "^1.0.10"
is-ci "^1.1.0"
lazy-val "^1.0.3"
read-config-file "1.2.2"
read-config-file "2.0.1"
sanitize-filename "^1.6.1"
update-notifier "^2.3.0"
yargs "^10.0.3"
@ -2709,13 +2707,13 @@ electron-osx-sign@0.4.7:
minimist "^1.2.0"
plist "^2.1.0"
electron-publish@19.50.0:
version "19.50.0"
resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-19.50.0.tgz#8cd862854c57b3d4a58e8e8e9e4ab0fd26c39e93"
electron-publish@19.52.0:
version "19.52.0"
resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-19.52.0.tgz#25dc36211fbeaa2dea01131e03b438486ee35ce6"
dependencies:
bluebird-lst "^1.0.5"
builder-util "^3.5.0"
builder-util-runtime "^3.5.0"
builder-util "^4.1.0"
builder-util-runtime "^4.0.0"
chalk "^2.3.0"
fs-extra-p "^4.5.0"
mime "^2.1.0"
@ -4200,9 +4198,9 @@ is-callable@^1.1.1, is-callable@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
is-ci@^1.0.10:
version "1.0.10"
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e"
is-ci@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.1.0.tgz#247e4162e7860cebbdaf30b774d6b0ac7dcfe7a5"
dependencies:
ci-info "^1.0.0"
@ -4982,10 +4980,6 @@ lodash.tail@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.tail/-/lodash.tail-4.1.1.tgz#d2333a36d9e7717c8ad2f7cacafec7c32b444664"
lodash.toarray@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.toarray/-/lodash.toarray-4.4.0.tgz#24c4bfcd6b2fba38bfd0594db1179d8e9b656561"
lodash.union@~4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88"
@ -5403,12 +5397,6 @@ node-alias@^1.0.4:
chalk "^1.1.1"
lodash "^4.2.0"
node-emoji@^1.8.1:
version "1.8.1"
resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.8.1.tgz#6eec6bfb07421e2148c75c6bba72421f8530a826"
dependencies:
lodash.toarray "^4.4.0"
node-forge@0.6.33:
version "0.6.33"
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.6.33.tgz#463811879f573d45155ad6a9f43dc296e8e85ebc"
@ -5997,8 +5985,10 @@ p-finally@^1.0.0:
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
p-limit@^1.0.0, p-limit@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.1.0.tgz#b07ff2d9a5d88bec806035895a2bab66a27988bc"
version "1.2.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c"
dependencies:
p-try "^1.0.0"
p-locate@^2.0.0:
version "2.0.0"
@ -6010,6 +6000,10 @@ p-map@^1.1.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b"
p-try@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3"
pac-proxy-agent@1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/pac-proxy-agent/-/pac-proxy-agent-1.1.0.tgz#34a385dfdf61d2f0ecace08858c745d3e791fd4d"
@ -6362,8 +6356,8 @@ postcss-load-plugins@^2.3.0:
object-assign "^4.1.0"
postcss-loader@^2.0.8:
version "2.0.9"
resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-2.0.9.tgz#001fdf7bfeeb159405ee61d1bb8e59b528dbd309"
version "2.0.10"
resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-2.0.10.tgz#090db0540140bd56a7a7f717c41bc29aeef4c674"
dependencies:
loader-utils "^1.1.0"
postcss "^6.0.0"
@ -6833,9 +6827,9 @@ read-cmd-shim@~1.0.1:
dependencies:
graceful-fs "^4.1.2"
read-config-file@1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/read-config-file/-/read-config-file-1.2.2.tgz#15855eaebc7e0b04d70d7c3da6bd7d45c89748f9"
read-config-file@2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/read-config-file/-/read-config-file-2.0.1.tgz#4f6f536508ed8863c50c3a2cfd1dbd82ba961b82"
dependencies:
ajv "^5.5.2"
ajv-keywords "^2.1.1"
@ -7750,8 +7744,8 @@ snyk-try-require@^1.1.1, snyk-try-require@^1.2.0:
then-fs "^2.0.0"
snyk@^1.25.1:
version "1.64.0"
resolved "https://registry.yarnpkg.com/snyk/-/snyk-1.64.0.tgz#6801febc92a1434d03c83f99c5cb84dca6f7ae51"
version "1.65.0"
resolved "https://registry.yarnpkg.com/snyk/-/snyk-1.65.0.tgz#ac5304e8eac32b36455e12e29ea49a566763f7ca"
dependencies:
abbrev "^1.0.7"
ansi-escapes "^1.3.0"