-
Notifications
You must be signed in to change notification settings - Fork 154
WIP: #26 Move to electron-builder #236
Changes from all commits
ddaed5f
e444544
ab29ee2
82a20ac
23d5997
3b44b51
93e25ea
2631c76
66a3738
ffd2a59
afdee72
e40d55a
f2ef82a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
# production | ||
/build | ||
/release-builds | ||
/dist | ||
|
||
# misc | ||
.DS_Store | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,13 @@ const killProcessId = require('./services/kill-process-id.service'); | |
const electronStore = require('./services/electron-store.service'); | ||
|
||
const chalk = new chalkRaw.constructor({ level: 3 }); | ||
let icon256Path = '../public/256x256.png'; | ||
|
||
// In production, we need to use `fixPath` to let Guppy use NPM. | ||
// For reasons unknown, the opposite is true in development; adding this breaks | ||
// everything. | ||
if (process.env.NODE_ENV !== 'development') { | ||
icon256Path = '../build/256x256.png'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not thrilled by this, but I couldn't find an easy way to keep a reference to the image in both |
||
fixPath(); | ||
} | ||
|
||
|
@@ -43,7 +45,7 @@ function createWindow() { | |
height: 768, | ||
minWidth: 777, | ||
titleBarStyle: 'hidden', | ||
icon: path.join(__dirname, 'assets/icons/png/256x256.png'), | ||
icon: path.join(__dirname, icon256Path), | ||
}); | ||
|
||
// set up some chrome extensions | ||
|
@@ -80,6 +82,7 @@ function createWindow() { | |
slashes: true, | ||
}); | ||
mainWindow.loadURL(startUrl); | ||
mainWindow.toggleDevTools(); | ||
|
||
// Emitted when the window is closed. | ||
mainWindow.on('closed', function() { | ||
|
@@ -184,7 +187,7 @@ const manageApplicationLocation = () => { | |
message: 'Move to Applications folder?', | ||
detail: | ||
"I see that I'm not in the Applications folder. I can move myself there if you'd like!", | ||
icon: path.join(__dirname, 'assets/icons/png/256x256.png'), | ||
icon: path.join(__dirname, icon256Path), | ||
cancelId: 1, | ||
defaultId: 0, | ||
checkboxLabel: 'Do not show this message again', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ export const PACKAGE_MANAGER_CMD = path.join( | |
remote.app.getAppPath(), | ||
'node_modules/yarn/bin', | ||
formatCommandForPlatform(PACKAGE_MANAGER) | ||
); | ||
).replace('app.asar', 'app.asar.unpacked'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this required? Can you please give some details? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once unpacking yarn, it is placed under the directory \app.asar.unpacked\node_modules.. instead of within the \app.asar\node_modules.. asar file. Even though it was unpacked, code is still referencing it within the app.asar, so replacing the path. Same issue is discussed here. I elected to workaround since this was the only case I knew of, but we could instead use the |
||
|
||
// Forward the host env, and append the | ||
// project's .bin directory to PATH to allow | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the hashes are added so that Chrome knows when to invalidate its cache of the JS bundles, right?
Right now that's fine since this file never changes, but presumably once we add the ability to update, we'll need to know when the file's changed.
What was the reason for this change? I suspect I'm misunderstanding something haha.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I hadn't considered whether the updater uses the hash to update changed files as well. I made this change under assumption that it wasn't needed for electron, but if it is needed then that makes this difficult.
I did this because the package.json has to reference the entry script (
electron.js
). Since the file is generated by webpack, it breaks the static reference if there's a dynamic chunk name as part of the file path.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh gotcha. Ok, let's leave it as-is for now. If that does become an issue, it's one we can address later on (really we should disable Chrome's browser cache altogether... and it might already be)