Skip to content

Commit

Permalink
app: Update how we check dev mode for desktop app
Browse files Browse the repository at this point in the history
We don't ship app.asar now but we were using it to check if the app is
run in dev mode or prod. This patch updates how we check dev mode.
And also includes the proper aligning for extraResources in package.json
  • Loading branch information
ashu8912 committed Jan 13, 2021
1 parent 8625dbf commit bacab83
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 1 addition & 2 deletions app/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ function startElecron() {
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);

const isDev = process.mainModule.filename.indexOf('app.asar') === -1 ||
process.mainModule.filename.indexOf('app') === -1;
const isDev = process.env.ELECTRON_DEV || false;

function createWindow () {
const startUrl = process.env.ELECTRON_START_URL || url.format({
Expand Down
7 changes: 5 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"start": "npm run copy-server-binary && cd ../ && make run-backend & cd ../frontend/ && export BROWSER=none && npm start",
"build": "npm run copy-server-binary && cd ../frontend/ && PUBLIC_URL='./' npm run build && cp -r ../app/electron/. build/electron",
"package": "mkdir -p build && cp -r ../frontend/build/* ./build && electron-builder build -c.extraMetadata.main=build/electron/main.js --publish never",
"serve-dev": "export ELECTRON_START_URL=http://localhost:3000 && electron .",
"serve-dev": "export ELECTRON_DEV=1 && export ELECTRON_START_URL=http://localhost:3000 && electron .",
"publish": "mkdir -p build && cp -r ../frontend/build/* ./build && electron-builder build -c.extraMetadata.main=build/electron/main.js --publish always"
},
"build": {
Expand Down Expand Up @@ -48,7 +48,10 @@
"../frontend/node_modules/**/*",
"node_modules/**/*"
],
"extraResources": ["./electron/server","./electron/server.exe"],
"extraResources": [
"./electron/server",
"./electron/server.exe"
],
"extraFiles": [
{
"from": "../frontend/build",
Expand Down

0 comments on commit bacab83

Please sign in to comment.