Skip to content

Commit

Permalink
[npm publish] - npm publish 2017.5.29
Browse files Browse the repository at this point in the history
- add README section 'all screenshots'
- add README section 'quickstart standalone app'
- auto-create README section 'table of contents'
- rename README section 'quickstart web example' -> 'quickstart example.js'
  • Loading branch information
kaizhu256 committed May 30, 2017
1 parent c2478b3 commit 3d0cc1f
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 94 deletions.
142 changes: 77 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,58 @@
# electron-lite
this zero-dependency package will download and install the electron-v1.4.16 prebuilt-binary from https://github.com/electron/electron/releases

[![travis-ci.org build-status](https://api.travis-ci.org/kaizhu256/node-electron-lite.svg)](https://travis-ci.org/kaizhu256/node-electron-lite) [![istanbul-coverage](https://kaizhu256.github.io/node-electron-lite/build/coverage.badge.svg)](https://kaizhu256.github.io/node-electron-lite/build/coverage.html/index.html)
[![travis-ci.org build-status](https://api.travis-ci.org/kaizhu256/node-electron-lite.svg)](https://travis-ci.org/kaizhu256/node-electron-lite) [![coverage](https://kaizhu256.github.io/node-utility2/build/coverage.badge.svg)](https://kaizhu256.github.io/node-utility2/build/coverage.html/index.html)

[![NPM](https://nodei.co/npm/electron-lite.png?downloads=true)](https://www.npmjs.com/package/electron-lite)

[![npmPackageListing](https://kaizhu256.github.io/node-electron-lite/build/screenCapture.npmPackageListing.svg)](https://github.com/kaizhu256/node-electron-lite)
[![build commit status](https://kaizhu256.github.io/node-electron-lite/build/build.badge.svg)](https://travis-ci.org/kaizhu256/node-electron-lite)

| git-branch : | [master](https://github.com/kaizhu256/node-electron-lite/tree/master) | [beta](https://github.com/kaizhu256/node-electron-lite/tree/beta) | [alpha](https://github.com/kaizhu256/node-electron-lite/tree/alpha)|
|--:|:--|:--|:--|
| test-report : | [![test-report](https://kaizhu256.github.io/node-electron-lite/build..master..travis-ci.org/test-report.badge.svg)](https://kaizhu256.github.io/node-electron-lite/build..master..travis-ci.org/test-report.html) | [![test-report](https://kaizhu256.github.io/node-electron-lite/build..beta..travis-ci.org/test-report.badge.svg)](https://kaizhu256.github.io/node-electron-lite/build..beta..travis-ci.org/test-report.html) | [![test-report](https://kaizhu256.github.io/node-electron-lite/build..alpha..travis-ci.org/test-report.badge.svg)](https://kaizhu256.github.io/node-electron-lite/build..alpha..travis-ci.org/test-report.html)|
| coverage : | [![coverage](https://kaizhu256.github.io/node-electron-lite/build..master..travis-ci.org/coverage.badge.svg)](https://kaizhu256.github.io/node-electron-lite/build..master..travis-ci.org/coverage.html/index.html) | [![coverage](https://kaizhu256.github.io/node-electron-lite/build..beta..travis-ci.org/coverage.badge.svg)](https://kaizhu256.github.io/node-electron-lite/build..beta..travis-ci.org/coverage.html/index.html) | [![coverage](https://kaizhu256.github.io/node-electron-lite/build..alpha..travis-ci.org/coverage.badge.svg)](https://kaizhu256.github.io/node-electron-lite/build..alpha..travis-ci.org/coverage.html/index.html)|
| build-artifacts : | [![build-artifacts](https://kaizhu256.github.io/node-electron-lite/glyphicons_144_folder_open.png)](https://github.com/kaizhu256/node-electron-lite/tree/gh-pages/build..master..travis-ci.org) | [![build-artifacts](https://kaizhu256.github.io/node-electron-lite/glyphicons_144_folder_open.png)](https://github.com/kaizhu256/node-electron-lite/tree/gh-pages/build..beta..travis-ci.org) | [![build-artifacts](https://kaizhu256.github.io/node-electron-lite/glyphicons_144_folder_open.png)](https://github.com/kaizhu256/node-electron-lite/tree/gh-pages/build..alpha..travis-ci.org)|

[![npmPackageListing](https://kaizhu256.github.io/node-electron-lite/build/screenshot.npmPackageListing.svg)](https://github.com/kaizhu256/node-electron-lite)

![npmPackageDependencyTree](https://kaizhu256.github.io/node-electron-lite/build/screenshot.npmPackageDependencyTree.svg)



# table of contents
1. [cdn download](#cdn-download)
1. [documentation](#documentation)
1. [quickstart screenshot example](#quickstart-screenshot-example)
1. [all screenshots](#all-screenshots)
1. [package.json](#packagejson)
1. [changelog of last 50 commits](#changelog-of-last-50-commits)
1. [internal build script](#internal-build-script)
1. [misc](#misc)

# screen-capture
![screenCapture](https://kaizhu256.github.io/node-electron-lite/build/screenCapture.testExampleJs.browser..png)


# cdn download
- [https://github.com/electron/electron/releases/download/v1.4.16/electron-v1.4.16-darwin-x64.zip](https://github.com/electron/electron/releases/download/v1.4.16/electron-v1.4.16-darwin-x64.zip)
- [https://github.com/electron/electron/releases/download/v1.4.16/electron-v1.4.16-linux-x64.zip](https://github.com/electron/electron/releases/download/v1.4.16/electron-v1.4.16-linux-x64.zip)



# documentation
#### apidoc
- [https://kaizhu256.github.io/node-electron-lite/build..beta..travis-ci.org/apidoc.html](https://kaizhu256.github.io/node-electron-lite/build..beta..travis-ci.org/apidoc.html)

[![apidoc](https://kaizhu256.github.io/node-electron-lite/build/screenCapture.buildCi.browser.%252Ftmp%252Fbuild%252Fapidoc.html.png)](https://kaizhu256.github.io/node-electron-lite/build..beta..travis-ci.org/apidoc.html)
[![apidoc](https://kaizhu256.github.io/node-electron-lite/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fapidoc.html.png)](https://kaizhu256.github.io/node-electron-lite/build..beta..travis-ci.org/apidoc.html)

#### todo
- upgrade to electron v1.6.x when stable
- none

#### changelog for v2017.4.16
- npm publish 2017.4.16
- upgrade to electron v1.4.16
#### changelog for v2017.5.29
- npm publish 2017.5.29
- add README section 'all screenshots'
- add README section 'quickstart standalone app'
- auto-create README section 'table of contents'
- rename README section 'quickstart web example' -> 'quickstart example.js'
- none

#### this package requires
Expand All @@ -37,40 +63,16 @@ this zero-dependency package will download and install the electron-v1.4.16 preb



# build status [![travis-ci.org build-status](https://api.travis-ci.org/kaizhu256/node-electron-lite.svg)](https://travis-ci.org/kaizhu256/node-electron-lite)
[![build commit status](https://kaizhu256.github.io/node-electron-lite/build/build.badge.svg)](https://travis-ci.org/kaizhu256/node-electron-lite)

| git-branch : | [master](https://github.com/kaizhu256/node-electron-lite/tree/master) | [beta](https://github.com/kaizhu256/node-electron-lite/tree/beta) | [alpha](https://github.com/kaizhu256/node-electron-lite/tree/alpha)|
|--:|:--|:--|:--|
| test-report : | [![test-report](https://kaizhu256.github.io/node-electron-lite/build..master..travis-ci.org/test-report.badge.svg)](https://kaizhu256.github.io/node-electron-lite/build..master..travis-ci.org/test-report.html) | [![test-report](https://kaizhu256.github.io/node-electron-lite/build..beta..travis-ci.org/test-report.badge.svg)](https://kaizhu256.github.io/node-electron-lite/build..beta..travis-ci.org/test-report.html) | [![test-report](https://kaizhu256.github.io/node-electron-lite/build..alpha..travis-ci.org/test-report.badge.svg)](https://kaizhu256.github.io/node-electron-lite/build..alpha..travis-ci.org/test-report.html)|
| coverage : | [![istanbul-coverage](https://kaizhu256.github.io/node-electron-lite/build..master..travis-ci.org/coverage.badge.svg)](https://kaizhu256.github.io/node-electron-lite/build..master..travis-ci.org/coverage.html/index.html) | [![istanbul-coverage](https://kaizhu256.github.io/node-electron-lite/build..beta..travis-ci.org/coverage.badge.svg)](https://kaizhu256.github.io/node-electron-lite/build..beta..travis-ci.org/coverage.html/index.html) | [![istanbul-coverage](https://kaizhu256.github.io/node-electron-lite/build..alpha..travis-ci.org/coverage.badge.svg)](https://kaizhu256.github.io/node-electron-lite/build..alpha..travis-ci.org/coverage.html/index.html)|
| build-artifacts : | [![build-artifacts](https://kaizhu256.github.io/node-electron-lite/glyphicons_144_folder_open.png)](https://github.com/kaizhu256/node-electron-lite/tree/gh-pages/build..master..travis-ci.org) | [![build-artifacts](https://kaizhu256.github.io/node-electron-lite/glyphicons_144_folder_open.png)](https://github.com/kaizhu256/node-electron-lite/tree/gh-pages/build..beta..travis-ci.org) | [![build-artifacts](https://kaizhu256.github.io/node-electron-lite/glyphicons_144_folder_open.png)](https://github.com/kaizhu256/node-electron-lite/tree/gh-pages/build..alpha..travis-ci.org)|

#### master branch
- stable branch
- HEAD should be tagged, npm-published package

#### beta branch
- semi-stable branch
- HEAD should be latest, npm-published package

#### alpha branch
- unstable branch
- HEAD is arbitrary
- commit history may be rewritten



# quickstart screen-capture example
![screenCapture](https://kaizhu256.github.io/node-electron-lite/build/screenCapture.testExampleJs.browser..png)
# quickstart screenshot example
![screenshot](https://kaizhu256.github.io/node-electron-lite/build/screenshot.testExampleJs.browser..png)

#### to run this example, follow the instruction in the script below
- example.js
- [example.js](https://kaizhu256.github.io/node-electron-lite/build..beta..travis-ci.org/example.js)
```javascript
/*
example.js
this electron script will screenCapture the webpage http://electron.atom.io
this electron script will screenshot the webpage http://electron.atom.io
instruction
1. save this script as example.js
Expand All @@ -79,7 +81,7 @@ instruction
printf '{"main":"example.js","name":"undefined","version":"0.0.1"}' > \
package.json && \
./node_modules/.bin/electron . --disable-overlay-scrollbar --enable-logging
3. view screencapture /tmp/screenCapture.testExampleJs.browser..png
3. view screenshot /tmp/screenshot.testExampleJs.browser..png
*/

/* istanbul instrument in package electron */
Expand All @@ -101,6 +103,10 @@ instruction
modeNext += 1;
switch (modeNext) {
case 1:
/* istanbul ignore next */
if (process.env.npm_config_mode_auto_restart) {
return;
}
// wait for electron to init
require('electron').app.once('ready', onNext);
break;
Expand All @@ -116,32 +122,47 @@ instruction
options.browserWindow.loadURL('http://electron.atom.io');
break;
case 3:
// screenCapture webpage
// screenshot webpage
options.browserWindow.capturePage(options, onNext);
break;
case 4:
// save screenCapture
// screenshot
require('fs').writeFileSync(
'/tmp/screenCapture.testExampleJs.browser..png',
'/tmp/screenshot.testExampleJs.browser..png',
data.toPng()
);
// exit
process.exit(0);
break;
}
};
// coverage-hack
(function () {
return;
}(!process.env.npm_config_mode_auto_restart && onNext()));
onNext();
}());
```

#### output from browser
![screenCapture](https://kaizhu256.github.io/node-electron-lite/build/screenCapture.testExampleJs.browser..png)
![screenshot](https://kaizhu256.github.io/node-electron-lite/build/screenshot.testExampleJs.browser..png)

#### output from shell
![screenCapture](https://kaizhu256.github.io/node-electron-lite/build/screenCapture.testExampleJs.svg)
![screenshot](https://kaizhu256.github.io/node-electron-lite/build/screenshot.testExampleJs.svg)



# all screenshots
1. [https://kaizhu256.github.io/node-electron-lite/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fapidoc.html.png](https://kaizhu256.github.io/node-electron-lite/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fapidoc.html.png)
[![screenshot](https://kaizhu256.github.io/node-electron-lite/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fapidoc.html.png)](https://kaizhu256.github.io/node-electron-lite/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fapidoc.html.png)

1. [https://kaizhu256.github.io/node-electron-lite/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fcoverage.lib.html.png](https://kaizhu256.github.io/node-electron-lite/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fcoverage.lib.html.png)
[![screenshot](https://kaizhu256.github.io/node-electron-lite/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fcoverage.lib.html.png)](https://kaizhu256.github.io/node-electron-lite/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fcoverage.lib.html.png)

1. [https://kaizhu256.github.io/node-electron-lite/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Ftest-report.html.png](https://kaizhu256.github.io/node-electron-lite/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Ftest-report.html.png)
[![screenshot](https://kaizhu256.github.io/node-electron-lite/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Ftest-report.html.png)](https://kaizhu256.github.io/node-electron-lite/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Ftest-report.html.png)

1. [https://kaizhu256.github.io/node-electron-lite/build/screenshot.npmTest.browser.%252F.png](https://kaizhu256.github.io/node-electron-lite/build/screenshot.npmTest.browser.%252F.png)
[![screenshot](https://kaizhu256.github.io/node-electron-lite/build/screenshot.npmTest.browser.%252F.png)](https://kaizhu256.github.io/node-electron-lite/build/screenshot.npmTest.browser.%252F.png)

1. [https://kaizhu256.github.io/node-electron-lite/build/screenshot.npmTestPublished.browser.%252F.png](https://kaizhu256.github.io/node-electron-lite/build/screenshot.npmTestPublished.browser.%252F.png)
[![screenshot](https://kaizhu256.github.io/node-electron-lite/build/screenshot.npmTestPublished.browser.%252F.png)](https://kaizhu256.github.io/node-electron-lite/build/screenshot.npmTestPublished.browser.%252F.png)



Expand All @@ -161,27 +182,19 @@ instruction
},
"homepage": "https://github.com/kaizhu256/node-electron-lite",
"keywords": [
"atom",
"atom-shell",
"browser",
"electron",
"electron-prebuilt",
"headless-browser",
"scrape",
"scraper",
"screen-capture",
"screencapture",
"screenshot",
"web",
"web-scrape",
"web-scraper"
],
"license": "MIT",
"main": "lib.electron.js",
"name": "electron-lite",
"nameAlias": "electron",
"nameAliasDeprecate": "electron_lite",
"nameAliasPublish": "electron-prebuilt-lite",
"nameAliasDeprecate": "electron-prebuilt-lite",
"nameOriginal": "electron-lite",
"os": [
"darwin",
Expand All @@ -199,35 +212,34 @@ instruction
"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.4.16"
"version": "2017.5.29"
}
```



# changelog of last 50 commits
[![screenCapture](https://kaizhu256.github.io/node-electron-lite/build/screenCapture.gitLog.svg)](https://github.com/kaizhu256/node-electron-lite/commits)
[![screenshot](https://kaizhu256.github.io/node-electron-lite/build/screenshot.gitLog.svg)](https://github.com/kaizhu256/node-electron-lite/commits)



# internal build-script
# internal build script
- build_ci.sh
```shell
# build_ci.sh

# this shell script will run the build for this package

shBuildCiPost() {(set -e
shReadmeBuildLinkVerify
shBuildCiAfter() {(set -e
shReadmeTest example.sh
)}

shBuildCiPre() {(set -e
shBuildCiBefore() {(set -e
ln -s ../../lib.electron.js node_modules/.bin/electron || true
shReadmeTest example.js
# save screenCapture
cp /tmp/screenCapture.*.png "$npm_config_dir_build"
shReadmeTest example.sh
shNpmTestPublished
shReadmeTest example.js
# screenshot
cp /tmp/screenshot.*.png "$npm_config_dir_build"
)}

# run shBuildCi
Expand Down
12 changes: 2 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,19 @@
},
"homepage": "https://github.com/kaizhu256/node-electron-lite",
"keywords": [
"atom",
"atom-shell",
"browser",
"electron",
"electron-prebuilt",
"headless-browser",
"scrape",
"scraper",
"screen-capture",
"screencapture",
"screenshot",
"web",
"web-scrape",
"web-scraper"
],
"license": "MIT",
"main": "lib.electron.js",
"name": "electron-lite",
"nameAlias": "electron",
"nameAliasDeprecate": "electron_lite",
"nameAliasPublish": "electron-prebuilt-lite",
"nameAliasDeprecate": "electron-prebuilt-lite",
"nameOriginal": "electron-lite",
"os": [
"darwin",
Expand All @@ -50,5 +42,5 @@
"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.4.16"
"version": "2017.5.29"
}
30 changes: 11 additions & 19 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



// run shared js-env code - pre-init
// run shared js-env code - init-before
(function () {
// init local
local = {};
Expand All @@ -27,10 +27,10 @@
// re-init local from example.js
case 'node':
local = (local.global.utility2_rollup || require('utility2'))
.requireExampleJsFromReadme();
.requireReadme();
break;
}
// export local
// init exports
local.global.local = local;
local.electron = require('electron');
}());
Expand Down Expand Up @@ -61,30 +61,22 @@
* this function will test buildReadme's default handling-behavior-behavior
*/
options = {};
options.customize = function () {
// search-and-replace - customize dataTo
[
// customize demo
(/\n\[!\[npmPackageListing\][\S\s]*?\n# documentation\n/),
// customize test-server
(/\n\| git-branch : \|[\S\s]*?\n\| test-report : \|/),
// customize quickstart
(/\n# quickstart[\S\s]*?\n# package.json\n/)
].forEach(function (rgx) {
options.dataFrom.replace(rgx, function (match0) {
options.dataTo = options.dataTo.replace(rgx, match0);
});
});
};
local.buildReadme(options, onError);
};

local.testCase_webpage_default = function (options, onError) {
/*
* this function will test webpage's default handling-behavior
*/
setTimeout(onError, 10000, options);
};
break;
}
switch (local.modeJs) {



// run node js-env code - post-init
// run node js-env code - init-after
case 'node':
// run test-server
local.testRunServer(local);
Expand Down

0 comments on commit 3d0cc1f

Please sign in to comment.