diff --git a/.env.production.app b/.env.production.app new file mode 100644 index 00000000..f9fd3136 --- /dev/null +++ b/.env.production.app @@ -0,0 +1,3 @@ +NODE_ENV=production +VUE_APP_PLATFORM=web +VUE_APP_TARGET=electron-renderer \ No newline at end of file diff --git a/.env.production.web b/.env.production.web new file mode 100644 index 00000000..e9a62687 --- /dev/null +++ b/.env.production.web @@ -0,0 +1,3 @@ +NODE_ENV=production +VUE_APP_PLATFORM=web +VUE_APP_TARGET=web \ No newline at end of file diff --git a/.gitignore b/.gitignore index afc1c793..be92d222 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store node_modules /dist +/app/dist /release-builds /installers/release-builds diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8c018f33..9a3f8a91 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 . diff --git a/app/app.js b/app/app.js index d1fe5162..48316176 100644 --- a/app/app.js +++ b/app/app.js @@ -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 diff --git a/package.json b/package.json index 964ee06a..f1feb62f 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/src/main.app.js b/src/main.app.js new file mode 100644 index 00000000..a7b44007 --- /dev/null +++ b/src/main.app.js @@ -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") \ No newline at end of file diff --git a/vue.config.js b/vue.config.js index ad3386d1..1cf8436d 100644 --- a/vue.config.js +++ b/vue.config.js @@ -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: '' } \ No newline at end of file