Skip to content

Commit

Permalink
Merge pull request #280 from electron-userland/node8-syntax
Browse files Browse the repository at this point in the history
Upgrade to Node >= 8
  • Loading branch information
fcastilloec authored Jun 8, 2019
2 parents 51c3ba7 + 8fde3a6 commit d9f37b2
Show file tree
Hide file tree
Showing 13 changed files with 162 additions and 179 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "standard"
"extends": [
"standard",
"plugin:promise/recommended"
]
}
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ addons:
- wine

env:
- DEBUG="electron-installer-windows" NODE_VERSION="10"
- DEBUG="electron-installer-windows" NODE_VERSION="12"
- DEBUG="electron-installer-windows" NODE_VERSION="8"
- DEBUG="electron-installer-windows" NODE_VERSION="6"

branches:
only:
- master
- /^v\d+\.\d+\.\d+/

cache: npm

before_install: nvm install $NODE_VERSION
install: npm install
script: npm test
Expand Down
55 changes: 25 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This tool relies on the awesome [Squirrel.Windows](https://github.com/Squirrel/S

## Requirements

This tool requires Node 6 or greater.
This tool requires Node 8 or greater.

I'd recommend building your packages on your target platform, but if you have to run this on Mac OS X or Linux, you will need to install `mono` and `wine` through your package manager.

Expand All @@ -20,13 +20,13 @@ You won't get an `.msi` installer though, only `.nupkg` and `.exe` installers. T

For use from command-line:

```
```shell
$ npm install -g electron-installer-windows
```

For use in npm scripts or programmatically:

```
```shell
$ npm install --save-dev electron-installer-windows
```

Expand Down Expand Up @@ -58,7 +58,7 @@ Say your Electron app lives in `path/to/app` and has a structure like this:

You now run `electron-packager` to build the app for Windows:

```
```shell
$ electron-packager . app --platform win32 --arch x64 --out dist/
```

Expand Down Expand Up @@ -97,13 +97,13 @@ How do you turn that into a Windows package that your users can install?

If you want to run `electron-installer-windows` straight from the command-line, install the package globally:

```
```shell
$ npm install -g electron-installer-windows
```

And point it to your built app:

```
```shell
$ electron-installer-windows --src dist/app-win32-x64/ --dest dist/installers/
```

Expand All @@ -113,13 +113,13 @@ You'll end up with the package at `dist/installers/app-0.0.1-setup.exe`.

If you want to run `electron-installer-windows` through npm, install the package locally:

```
```shell
$ npm install --save-dev electron-installer-windows
```

Edit the `scripts` section of your `package.json`:

```javascript
```json
{
"name": "app",
"description": "An awesome app!",
Expand All @@ -139,7 +139,7 @@ Edit the `scripts` section of your `package.json`:

And run the script:

```
```shell
$ npm run setup
```

Expand All @@ -149,7 +149,7 @@ You'll end up with the package at `dist/installers/app-0.0.1-setup.exe`.

Install the package locally:

```
```shell
$ npm install --save-dev electron-installer-windows
```

Expand All @@ -163,34 +163,29 @@ const options = {
dest: 'dist/installers/'
}

console.log('Creating package (this may take a while)')

installer(options)
.then(() => console.log(`Successfully created package at ${options.dest}`))
.catch(err => {
console.error(err, err.stack)
process.exit(1)
})
```
Alternatively, it is possible to use the callback pattern:
```javascript
installer(options, (err) => {
if (err) {
async function main (options) {
console.log('Creating package (this may take a while)')
try {
await installer(options)
console.log(`Successfully created package at ${options.dest}`)
} catch (err) {
console.error(err, err.stack)
process.exit(1)
}

console.log(`Successfully created package at ${options.dest}`)
})
}
main(options)
```

You'll end up with the package at `dist/installers/app-0.0.1-setup.exe`.

_Note: As of 2.0.0, the Node-style callback pattern is no longer available. You can use [`util.callbackify`](https://nodejs.org/dist/latest-v8.x/docs/api/util.html#util_util_callbackify_original) if this is required for your use case._


### Options

Even though you can pass most of these options through the command-line interface, it may be easier to create a configuration file:

```javascript
```json
{
"dest": "dist/installers/",
"icon": "resources/Icon.ico",
Expand All @@ -202,7 +197,7 @@ Even though you can pass most of these options through the command-line interfac

And pass that instead with the `config` option:

```
```shell
$ electron-installer-windows --src dist/app-win32-x64/ --config config.json
```

Expand Down Expand Up @@ -351,14 +346,14 @@ Internet Explorer's SmartScreen Filter and antivirus programs may flag your pack

To generate the certificate, open the *Developer Command Prompt for Visual Studio* and execute the following:

```
```shell
$ makecert -sv my_private_key.pvk -n "CN=MyTestCertificate" my_test_certificate.cer -b 01/01/2016 -e 01/01/2026 -r
$ pvk2pfx -pvk my_private_key.pvk -spc my_test_certificate.cer -pfx my_signing_key.pfx -po my_password
```

Now we can tell `electron-installer-windows` to sign the packages that it generates with that certificate:

```
```shell
$ electron-installer-windows --src dist/app-win32-x64/ --dest dist/installers/ --certificateFile my_signing_key.pfx --certificatePassword my_password
```

Expand Down
21 changes: 7 additions & 14 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,20 @@ init:

environment:
DEBUG: 'electron-installer-windows'

matrix:
- platform: x86
nodejs_version: '10'
- platform: x64
nodejs_version: '10'
- platform: x86
nodejs_version: '8'
- platform: x64
nodejs_version: '8'
- platform: x86
nodejs_version: '6'
- platform: x64
nodejs_version: '6'
- nodejs_version: "12"
- nodejs_version: "8"

platform:
- x86
- x64

branches:
only:
- master

install:
- ps: Install-Product node $env:nodejs_version
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:PLATFORM
- npm install

build: off
Expand Down
2 changes: 1 addition & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

From this directory, run the following commands to build the Windows packages for the app:

```
```shell
$ npm install
$ npm run build
```
Expand Down
30 changes: 14 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,30 @@
"test": "npm run lint && npm run spec"
},
"engines": {
"node": ">=6.0.0"
"node": ">=8.0.0"
},
"dependencies": {
"debug": "^4.1.0",
"electron-installer-common": "^0.6.1",
"fs-extra": "^7.0.1",
"glob": "^7.1.3",
"glob-promise": "^3.4.0",
"debug": "^4.1.1",
"electron-installer-common": "^0.7.0",
"fs-extra": "^8.0.1",
"glob": "^7.1.4",
"lodash": "^4.17.11",
"nodeify": "^1.0.1",
"parse-author": "^2.0.0",
"which": "^1.3.1",
"yargs": "^13.2.2"
"yargs": "^13.2.4"
},
"devDependencies": {
"chai": "^4.2.0",
"eslint": "^5.9.0",
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-standard": "^4.0.0",
"finalhandler": "^1.1.1",
"mocha": "^6.1.2",
"finalhandler": "^1.1.2",
"mocha": "^6.1.4",
"promise-retry": "^1.1.1",
"serve-static": "^1.13.2",
"tmp-promise": "^1.0.5"
"serve-static": "^1.14.1",
"tmp-promise": "^2.0.1"
}
}
Loading

0 comments on commit d9f37b2

Please sign in to comment.