Merge branch 'electron-specific-code' into 'master'

Separate build targets for electron and web

See merge request openflexure/openflexure-microscope-jsclient!31
This commit is contained in:
Joel Collins 2019-06-03 08:52:38 +00:00
commit dbb7d6fbf4
8 changed files with 35 additions and 10 deletions

3
.env.production.app Normal file
View file

@ -0,0 +1,3 @@
NODE_ENV=production
VUE_APP_PLATFORM=web
VUE_APP_TARGET=electron-renderer

3
.env.production.web Normal file
View file

@ -0,0 +1,3 @@
NODE_ENV=production
VUE_APP_PLATFORM=web
VUE_APP_TARGET=web

1
.gitignore vendored
View file

@ -1,6 +1,7 @@
.DS_Store
node_modules
/dist
/app/dist
/release-builds
/installers/release-builds

View file

@ -1,6 +1,5 @@
stages:
- build
- package
- meta
# Cache modules in between jobs
@ -9,13 +8,13 @@ cache:
paths:
- node_modules/
# Build basic webapp
# Basic webapp build
build:
stage: build
image: electronuserland/builder:wine
script:
- npm install
- npm run build
- npm run build:web
artifacts:
name: "build"
paths:
@ -25,14 +24,13 @@ build:
- tags
- web
# Platform-specific Electron builds
# Electron app build
package:
stage: package
dependencies:
- build
stage: build
image: electronuserland/builder:wine
retry: 2
script:
- npm install
- npm run build:app
- npm run release
- mv ./release-builds/*.AppImage .
- mv ./release-builds/*.deb .

View file

@ -70,7 +70,7 @@ const app = electron.app
const BrowserWindow = electron.BrowserWindow
// Set the window content
let url = `file://${path.join(__dirname, '../dist/index.html')}`
let url = `file://${path.join(__dirname, '/dist/index.html')}`
let mainWindow
// Set the application menu

View file

@ -17,7 +17,8 @@
"dist:win": "electron-builder --win --config app/builder-config-x86_64.yaml",
"dist:dmg": "electron-builder --mac --config app/builder-config-x86_64.yaml",
"dist:appx": "electron-builder --win --config app/builder-config-appx.yaml",
"build": "vue-cli-service build",
"build:web": "vue-cli-service build --mode production.web",
"build:app": "vue-cli-service build --mode production.app",
"electron:run": "electron .",
"electron:dev": "electron app/app.dev.js",
"serve": "vue-cli-service serve"

7
src/main.app.js Normal file
View file

@ -0,0 +1,7 @@
//import { Titlebar, Color } from 'custom-electron-titlebar'
//new Titlebar({
// backgroundColor: Color.fromHex('#ffffff')
//});
console.log("Loaded main.app.js for electron-renderer functionality")

View file

@ -1,3 +1,15 @@
module.exports = {
configureWebpack: config => {
config.target = process.env.VUE_APP_TARGET || 'web',
config.entry = (process.env.VUE_APP_TARGET == 'electron-renderer')
? {
main: './src/main.js',
app: './src/main.app.js'
}
:{
main: './src/main.js',
}
},
outputDir: (process.env.VUE_APP_TARGET == 'electron-renderer') ? './app/dist' : './dist',
publicPath: ''
}