Skip to content

Commit

Permalink
[npm publish] - npm publish 2017.8.30
Browse files Browse the repository at this point in the history
- add version override flag during install npm_config_electron_version
- fix symlink bug in macOs
  • Loading branch information
kaizhu256 committed Aug 31, 2017
1 parent e273d6b commit 4254555
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 11 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ this zero-dependency package will download and install the electron-v1.6.11 preb
- upgrade to electron v1.7.x when stable
- none

#### changelog for v2017.7.16
- npm publish 2017.7.16
- re-include screenshot in top-section of README.md
#### changelog for v2017.8.30
- npm publish 2017.8.30
- add version override flag during install npm_config_electron_version
- fix symlink bug in macOs
- none

#### this package requires
Expand All @@ -77,7 +78,7 @@ this zero-dependency package will download and install the electron-v1.6.11 preb
/*
example.js
this electron script will screenshot the webpage http://electron.atom.io
this electron script will screenshot the webpage https://electron.atom.io
instruction
1. save this script as example.js
Expand Down Expand Up @@ -124,7 +125,7 @@ instruction
// goto next step when webpage is loaded
options.browserWindow.webContents.once('did-stop-loading', onNext);
// open url
options.browserWindow.loadURL('http://electron.atom.io');
options.browserWindow.loadURL('https://electron.atom.io');
break;
case 3:
// screenshot webpage
Expand Down Expand Up @@ -204,12 +205,12 @@ instruction
"scripts": {
"build-ci": "utility2 shReadmeTest build_ci.sh",
"env": "env",
"heroku-postbuild": "npm install \"kaizhu256/node-utility2#alpha\" && utility2 shDeployHeroku",
"heroku-postbuild": "npm install kaizhu256/node-utility2#alpha && utility2 shDeployHeroku",
"postinstall": "[ ! -f npm_scripts.sh ] || ./npm_scripts.sh postinstall",
"start": "NODE_BINARY=./lib.electron.js PORT=${PORT:-8080} utility2 start test.js",
"test": "set -e; rm -fr external; npm run postinstall; ./lib.electron.js --version; export NODE_BINARY=./lib.electron.js; utility2 test test.js"
},
"version": "2017.7.16"
"version": "2017.8.30"
}
```

Expand Down
7 changes: 6 additions & 1 deletion lib.electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@
(function () {
'use strict';
module.exports.__dirname = __dirname;
module.exports.__filename = (process.platform === 'darwin' &&
require('fs').existsSync(__dirname + '/external/Electron.app/Contents/MacOS/Electron')
// bug-workaround - darwin does not like symlink
? __dirname + '/external/Electron.app/Contents/MacOS/Electron'
: __dirname + '/external/electron');
if (module !== require.main) {
return;
}
require('child_process').spawn(__dirname + '/external/electron', process.argv.slice(2), {
require('child_process').spawn(module.exports.__filename, process.argv.slice(2), {
stdio: [0, 1, 2]
}).on('exit', function (exitCode) {
process.exit(exitCode);
Expand Down
23 changes: 22 additions & 1 deletion npm_scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,28 @@ postinstall() {(set -e
# this function will run npm postinstall
export PATH="$(pwd):$PATH"
# install electron
VERSION=v1.6.11
# v0.25.1
# v0.26.1
# v0.27.1
# v0.28.1
# v0.29.1
# v0.30.1
# v0.31.1
# v0.32.1
# v0.33.1
# v0.34.1
# v0.35.1
# v0.36.1
# v0.37.1
# v1.0.1
# v1.1.1
# v1.2.1
# v1.3.1
# v1.4.1
# v1.5.1
# v1.6.1
# v1.7.1
VERSION="${npm_config_electron_version:-v1.6.11}"
FILE_BASE="electron-$VERSION-linux-x64.zip"
FILE_BIN=external/electron
FILE_URL="https://github.com/electron/electron/releases/download/$VERSION/$FILE_BASE"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
"scripts": {
"build-ci": "utility2 shReadmeTest build_ci.sh",
"env": "env",
"heroku-postbuild": "npm install \"kaizhu256/node-utility2#alpha\" && utility2 shDeployHeroku",
"heroku-postbuild": "npm install kaizhu256/node-utility2#alpha && utility2 shDeployHeroku",
"postinstall": "[ ! -f npm_scripts.sh ] || ./npm_scripts.sh postinstall",
"start": "NODE_BINARY=./lib.electron.js PORT=${PORT:-8080} utility2 start test.js",
"test": "set -e; rm -fr external; npm run postinstall; ./lib.electron.js --version; export NODE_BINARY=./lib.electron.js; utility2 test test.js"
},
"version": "2017.7.16"
"version": "2017.8.30"
}

0 comments on commit 4254555

Please sign in to comment.