-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const createWindowsInstaller = require('electron-winstaller').createWindowsInstaller; | ||
const path = require('path'); | ||
|
||
getInstallerConfig() | ||
.then(createWindowsInstaller) | ||
.catch((error) => { | ||
console.error(error.message || error); | ||
process.exit(1); | ||
}); | ||
|
||
function getInstallerConfig () { | ||
console.log('creating windows installer'); | ||
const rootPath = path.join('./'); | ||
const outPath = path.join(rootPath, 'release-builds'); | ||
|
||
return Promise.resolve({ | ||
appDirectory: path.join(outPath, 'todometer-win32-ia32/'), | ||
authors: 'Cassidy Williams', | ||
noMsi: true, | ||
outputDirectory: path.join(outPath, 'windows-installer'), | ||
exe: 'todometer.exe', | ||
setupExe: 'todometerInstaller.exe', | ||
setupIcon: path.join(rootPath, 'assets', 'win', 'icon.png.ico'), | ||
skipUpdateIcon: true, | ||
versionString: { | ||
FileDescription: 'a meter-based to-do list', | ||
ProductName: 'todometer' | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { app } from 'electron'; | ||
|
||
// This is copied directly fron the windows installer documentation: | ||
// https://github.com/electron/windows-installer | ||
|
||
module.exports = { | ||
handleSquirrelEvent: function() { | ||
if (process.argv.length === 1) { | ||
return false; | ||
} | ||
|
||
const ChildProcess = require('child_process'); | ||
const path = require('path'); | ||
|
||
const appFolder = path.resolve(process.execPath, '..'); | ||
const rootAtomFolder = path.resolve(appFolder, '..'); | ||
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe')); | ||
const exeName = path.basename(process.execPath); | ||
const spawn = function(command, args) { | ||
let spawnedProcess, error; | ||
|
||
try { | ||
spawnedProcess = ChildProcess.spawn(command, args, {detached: true}); | ||
} catch (error) {} | ||
|
||
return spawnedProcess; | ||
}; | ||
|
||
const spawnUpdate = function(args) { | ||
return spawn(updateDotExe, args); | ||
}; | ||
|
||
const squirrelEvent = process.argv[1]; | ||
switch (squirrelEvent) { | ||
case '--squirrel-install': | ||
case '--squirrel-updated': | ||
// Optionally do things such as: | ||
// - Add your .exe to the PATH | ||
// - Write to the registry for things like file associations and | ||
// explorer context menus | ||
|
||
// Install desktop and start menu shortcuts | ||
spawnUpdate(['--createShortcut', exeName]); | ||
setTimeout(app.quit, 1000); | ||
return true; | ||
case '--squirrel-uninstall': | ||
// Undo anything you did in the --squirrel-install and | ||
// --squirrel-updated handlers | ||
// Remove desktop and start menu shortcuts | ||
spawnUpdate(['--removeShortcut', exeName]); | ||
setTimeout(app.quit, 1000); | ||
return true; | ||
case '--squirrel-obsolete': | ||
// This is called on the outgoing version of your app before | ||
// we update to the new version - it's the opposite of | ||
// --squirrel-updated | ||
app.quit(); | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters