Skip to content

Commit

Permalink
Get electron run/build working again
Browse files Browse the repository at this point in the history
  • Loading branch information
chron0 committed Nov 17, 2016
1 parent 5645d35 commit 13f60f8
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 47 deletions.
39 changes: 29 additions & 10 deletions governess-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ are currently in the process of implementation.

## Available Platforms

### Web
### Browser

HTML5/Progressive Web-client delivered by governess-server to
any modern browser on any platform.
Expand All @@ -40,9 +40,9 @@ extend and coherently test the client.
Known to work NodeJS & NPM versions:

* NodeJS
* >= 4.4.1 (tested with gentoo-portage stable)
* \>= 4.4.1 (tested with gentoo-portage stable)
* NPM
* >= 3.10.5 (tested with gentoo-portage stable + npm update)
* \>= 3.10.5 (tested with gentoo-portage stable + npm update)

### Global NodeJS-Requirements

Expand All @@ -68,34 +68,51 @@ connection bandwidth and your host's compiling performance.

$ ionic serve (-l)

### Run in Electron wrapper
### Run in Browser

$ npm run electron
Open http://localhost:8100

### Run on Android via ADB

$ ionic run android

### Run in Electron wrapper

$ npm run electron

## Tests

Tests are not available anymore for RC0+, since the whole structure
has changed and the clicker crowd needs time to catch up first how
to proceed further.
### Unit testing

Unit testing is still not yet available again.

### E2E testing

End-to-End tests are available and configured in tests/e2e. This is also where
the report and automated screenshots can be found.

$ npm run e2e

## Building

### Browser

$ ionic build browser

### Android

$ ionic build android

### Electron

$ ionic build browser

#### Linux

$ npm run electron dist-linux-x64

#### Other OS

Not available/tested yet.

## Bootstrapping from scratch

$ ionic start governess-app sidemenu -s --v2 --ts
Expand All @@ -106,4 +123,6 @@ to proceed further.
Please use the [issue tracker](https://github.com/apollo-ng/governess/issues)
for governess related issues.

### IRC

Join #apollo on freenode.
68 changes: 34 additions & 34 deletions governess-app/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@ const {BrowserWindow} = electron;
let win;

function createWindow() {
// Create the browser window.
win = new BrowserWindow({width: 1024, height: 768});

var url = 'http://localhost:8100';
var Args = process.argv.slice(2);
Args.forEach(function (val) {
if (val === "dist") {
url = 'file://' + __dirname + '/www/index.html'
}
});

// and load the index.html of the app.
win.loadURL(url);

// Open the DevTools.
// win.webContents.openDevTools();

// Emitted when the window is closed.
win.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;
});
// Create the browser window.
win = new BrowserWindow({width: 1024, height: 768});

var url = 'http://localhost:8100';
var Args = process.argv.slice(2);
Args.forEach(function (val) {
if (val === "dist") {
url = 'file://' + __dirname + '/platforms/browser/index.html'
}
});

// and load the index.html of the app.
win.loadURL(url);

// Open the DevTools.
// win.webContents.openDevTools();

// Emitted when the window is closed.
win.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;
});
}

// This method will be called when Electron has finished
Expand All @@ -41,17 +41,17 @@ app.on('ready', createWindow);

// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
});

app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (win === null) {
createWindow();
}
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (win === null) {
createWindow();
}
});
2 changes: 1 addition & 1 deletion governess-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"postinstall": "ionic state restore && webdriver-manager update",
"e2e": "protractor tests/e2e/protractor.conf.js",
"electron": "electron .",
"electron dist-linux-x64": "electron-packager . governess-app --app-version=1.0.0 --platform=linux --arch=x64 --prune --asar --overwrite --ignore=config --ignore=platforms --ignore=node_modules --ignore=coverage --ignore=resources --ignore=tests --ignore=plugins --ignore=src --ignore=hooks"
"electron-dist-linux-x64": "ionic build browser && electron-packager . governess-app --out=platforms --app-version=1.0.0 --version-string.CompanyName=Apollo-NG --version-string.ProductName=GovernessApp --version-string.ProductVersion=1.0.0 --platform=linux --arch=x64 --icon=src/assets/icon/favicon.ico --prune --asar --overwrite --ignore=config --ignore=platforms --ignore=node_modules --ignore=coverage --ignore=resources --ignore=tests --ignore=plugins --ignore=src --ignore=hooks"
},
"dependencies": {
"@angular/common": "2.1.1",
Expand Down
10 changes: 8 additions & 2 deletions governess-app/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#4e8ef7">

<!-- prevent white flash during JS bootstrapping -->
<style type="text/css">
html { background-color: #2f2e2a; }
body { background-color: #2f2e2a; }
</style>

<link href="build/main.css" rel="stylesheet">

<!-- cordova.js required for cordova apps -->
<script src="cordova.js"></script>

Expand All @@ -24,8 +32,6 @@
}
</script>-->

<link href="build/main.css" rel="stylesheet">

</head>
<body>

Expand Down

0 comments on commit 13f60f8

Please sign in to comment.