Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement installers via electron-builder #138

Merged
merged 2 commits into from
May 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,10 @@ $ npm run package:linux
$ npm run package:all (Packages for all platform)
```

Create a windows installer with the following command. It will appear in the `release\windows-installer` directory.
```
$ npm run installer
```

## Contributing
Please see [CONTRIBUTING.md](./CONTRIBUTING.md).
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function makePackage(platform, arch, callback) {
icon: 'resources/icon',
"version-string": {
CompanyName: packageJson.author.name,
LegalCopyright: 'Copyright (c) 2015 ' + packageJson.author.name,
LegalCopyright: 'Copyright (c) 2015 - 2016' + packageJson.author.name,
FileDescription: packageJson.description,
OriginalFilename: packageJson.productName + '.exe',
ProductVersion: packageJson.version,
Expand Down
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@
"package:osx": "gulp package:osx",
"package:linux": "gulp build && build --platform linux --arch all -d deb",
"package:all": "gulp package:all",
"prettify": "gulp prettify"
"prettify": "gulp prettify",
"installer": "node ./script/installer.js"
},
"devDependencies": {
"babel-core": "^6.7.5",
"babel-loader": "^6.2.4",
"babel-preset-react": "^6.5.0",
"chromedriver": "^2.20.0",
"del": "^2.2.0",
"electron-builder": "^3.11.0",
"electron-builder": "3.20.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"electron-connect": "^0.3.7",
"electron-packager": "^7.0.1",
"electron-prebuilt": "0.37.8",
"electron-squirrel-startup": "^1.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be installed with src/package.json to bundle.

"electron-winstaller": "^2.2.0",
"esformatter": "^0.9.3",
"esformatter-jsx": "^5.0.0",
"gulp": "^3.9.0",
Expand All @@ -47,6 +50,7 @@
"json-loader": "^0.5.4",
"mocha": "^2.3.4",
"mocha-circleci-reporter": "0.0.1",
"rimraf": "^2.5.2",
"should": "^8.0.1",
"style-loader": "^0.13.0",
"through2": "^2.0.1",
Expand All @@ -56,11 +60,13 @@
"webpack-stream": "^3.1.0"
},
"build": {
"app-bundle-id": "com.mattermost.desktop",
"app-category-type": "public.app-category.productivity",
"linux": {
"synopsis": "Mattermost Desktop"
}
},
"directories":{
"directories": {
"buildResources": "resources",
"app": "dist",
"output": "release"
Expand Down
38 changes: 38 additions & 0 deletions script/installer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env node

const createWindowsInstaller = require('electron-winstaller').createWindowsInstaller
const path = require('path')
const rimraf = require('rimraf')

deleteOutputFolder()
.then(getInstallerConfig)
.then(createWindowsInstaller)
.catch((error) => {
console.error(error.message || error)
process.exit(1)
})

function getInstallerConfig() {
const rootPath = path.join(__dirname, '..')
const outPath = path.join(rootPath, 'release')

return Promise.resolve({
appDirectory: path.join(outPath, 'Mattermost-win32-x64'),
iconUrl: 'https://raw.githubusercontent.com/mattermost/desktop/master/resources/icon.ico',
//loadingGif: path.join(rootPath, 'assets', 'img', 'loading.gif'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if you could get somebody to provide a now installing splash screen. See https://github.com/electron/electron-api-demos/blob/master/assets/img/loading.gif as an example

noMsi: true,
outputDirectory: path.join(outPath, 'windows-installer'),
setupExe: 'Mattermost.exe',
setupIcon: path.join(rootPath, 'resources', 'icon.ico'),
skipUpdateIcon: true,
exe: 'Mattermost.exe'
})
}

function deleteOutputFolder() {
return new Promise((resolve, reject) => {
rimraf(path.join(__dirname, '..', 'out', 'windows-installer'), (error) => {
error ? reject(error) : resolve()
})
})
}
3 changes: 3 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

const electron = require('electron');
const app = electron.app; // Module to control application life.

if (require('electron-squirrel-startup')) app.quit();

const BrowserWindow = electron.BrowserWindow; // Module to create native browser window.
const Menu = electron.Menu;
const Tray = electron.Tray;
Expand Down