Skip to content

Commit

Permalink
[npm publish] #### changelog 2020.11.12
Browse files Browse the repository at this point in the history
- jslint - update to v2020.11.6
- update function chromeDevtoolsClient with timeout
- remove file lib.puppeteer.js and replace with function chromeDevtoolsClientCreate
- remove dependency on env-var \$CHROME_BIN
- remove functions base64FromBuffer, base64ToUtf8, cryptoAesXxxCbcRawDecrypt, cryptoAesXxxCbcRawEncrypt, gotoNext, onErrorWithStack
- jslint - fix off-by-one column in autofix-expected_a_before_b
- decouple build from npm-env-variables npm_config_xxx and npm_package_xxx
- update lib.utility2.sh to remove dependency on \$UTILITY2_MACRO_JS
  • Loading branch information
kaizhu256 committed Nov 12, 2020
1 parent 8ea5dbd commit 905e5a8
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 129 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# derived from
# https://github.com/actions/starter-workflows/blob/main/ci/node.js.yml
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
Expand Down Expand Up @@ -25,6 +27,7 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test
# - run: npm ci
# - run: npm run build --if-present
# - run: npm test
# - run: npm run ci-github
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ script:
- npm run build-ci
services:
- docker
- xvfb
# - xvfb
# http://docs.travis-ci.com/user/workers/container-based-infrastructure
sudo:
false
11 changes: 8 additions & 3 deletions .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function! MyCommentRegion(...)
" this function will comment selected-region
" un-comment
if a:1 == 'u'
'<,'>s/^\(\s*\)\(""\|#\|%%\|--\|\/\/\)!! /\1/e
'<,'>s/^\(\s*\)\(""\|#\|%%\|--\|\/\/\|::\)!! /\1/e
'<,'>s/^\(\s*\)<!--!! \(.*\) -->/\1\2/e
'<,'>s/^\(\s*\)\/\*!! \(.*\) \*\//\1\2/e
" comment \"\"
Expand All @@ -70,6 +70,9 @@ function! MyCommentRegion(...)
" comment //
elseif a:1 == '/'
'<,'>s/^\(\s*\)\(\S\)/\1\/\/!! \2/e
" comment ::
elseif a:1 == ':'
'<,'>s/^\(\s*\)\(\S\)/\1::!! \2/e
" comment <!--...-->
elseif a:1 == '<'
'<,'>s/^\(\s*\)\(\S.*\)/\1<!--!! \2 -->/e
Expand Down Expand Up @@ -160,9 +163,10 @@ nnoremap <silent> "\ :call MyStringifyRegion('\')<cr>
nnoremap <silent> "u :call MyStringifyRegion('u')<cr>
nnoremap <silent> #" :call MyCommentRegion('"')<cr>
nnoremap <silent> #% :call MyCommentRegion('%')<cr>
nnoremap <silent> #- :call MyCommentRegion('-')<cr>
nnoremap <silent> #* :call MyCommentRegion('*')<cr>
nnoremap <silent> #- :call MyCommentRegion('-')<cr>
nnoremap <silent> #/ :call MyCommentRegion('/')<cr>
nnoremap <silent> #: :call MyCommentRegion(':')<cr>
nnoremap <silent> #<char-0x23> :call MyCommentRegion('#')<cr>
nnoremap <silent> #u :call MyCommentRegion('u')<cr>
" visual-mode remap
Expand All @@ -171,9 +175,10 @@ vnoremap <silent> "\ <esc>:call MyStringifyRegion('\')<cr>
vnoremap <silent> "u <esc>:call MyStringifyRegion('u')<cr>
vnoremap <silent> #" <esc>:call MyCommentRegion('"')<cr>
vnoremap <silent> #% <esc>:call MyCommentRegion('%')<cr>
vnoremap <silent> #- <esc>:call MyCommentRegion('-')<cr>
vnoremap <silent> #* <esc>:call MyCommentRegion('*')<cr>
vnoremap <silent> #- <esc>:call MyCommentRegion('-')<cr>
vnoremap <silent> #/ <esc>:call MyCommentRegion('/')<cr>
vnoremap <silent> #: <esc>:call MyCommentRegion(':')<cr>
vnoremap <silent> #< <esc>:call MyCommentRegion('<')<cr>
vnoremap <silent> #<char-0x23> <esc>:call MyCommentRegion('#')<cr>
vnoremap <silent> #u <esc>:call MyCommentRegion('u')<cr>
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ this zero-dependency package will provide high-level functions to to build, test
#### cli help
![screenshot](https://kaizhu256.github.io/node-utility2/build/screenshot.npmPackageCliHelp.svg)

#### changelog 2020.11.3
- update jslint to v2020.11.6
#### changelog 2020.11.12
- jslint - update to v2020.11.6
- update function chromeDevtoolsClient with timeout
- remove file lib.puppeteer.js and replace with function chromeDevtoolsClientCreate
- remove dependency on env-var \$CHROME_BIN
Expand All @@ -63,6 +63,7 @@ this zero-dependency package will provide high-level functions to to build, test
- none

#### todo
- fix test-report bug with duplicate github and heroku tests
- migrate from travis to github-actions
- update function fsWriteFileWithMkdirp to write to tmpfile first
- jslint - unmangle function jslintAutofixLocalFunction
Expand Down Expand Up @@ -1177,7 +1178,7 @@ require("http").createServer(function (req, res) {
"engines": {
"node": ">=12.0"
},
"fileCount": 28,
"fileCount": 27,
"homepage": "https://github.com/kaizhu256/node-utility2",
"keywords": [
"continuous-integration",
Expand Down Expand Up @@ -1209,12 +1210,12 @@ require("http").createServer(function (req, res) {
"utility2Dependents": [
"2020.06.08 apidoc-lite",
"2020.06.12 bootstrap-lite",
"2020.08.01 istanbul-lite",
"2020.08.19 sqlite3-lite",
"2020.10.27 jslint-lite",
"2020.10.27 utility2"
"2020.11.12 istanbul-lite",
"2020.11.12 utility2"
],
"version": "2020.11.3"
"version": "2020.11.12"
}
```

Expand Down Expand Up @@ -1258,9 +1259,9 @@ RUN (set -e; \
gnupg; \
(busybox --list | xargs -n1 /bin/sh -c \
'ln -s /bin/busybox /bin/$0 2>/dev/null' || true); \
curl -Lf https://deb.nodesource.com/setup_12.x | /bin/bash -; \
curl -Lf https://deb.nodesource.com/setup_14.x | /bin/bash -; \
apt-get install -y nodejs; \
(cd /usr/lib && npm install sqlite3@4); \
(cd /usr/lib && npm install sqlite3@5); \
)
# install google-chrome-stable
RUN (set -e; \
Expand Down Expand Up @@ -1299,7 +1300,7 @@ MAINTAINER kai zhu <kaizhu256@gmail.com>
# install utility2
RUN (set -e; \
export DEBIAN_FRONTEND=noninteractive; \
npm install -g eslint puppeteer \
npm install -g eslint \
rm -f /tmp/.X99-lock && export DISPLAY=:99.0 && (Xvfb "$DISPLAY" &); \
npm install kaizhu256/node-utility2#alpha; \
cp -a node_modules /; \
Expand Down
33 changes: 16 additions & 17 deletions lib.istanbul.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
/*
* lib.istanbul.js (2020.8.1)
* lib.istanbul.js (2020.11.12)
* https://github.com/kaizhu256/node-istanbul-lite
* this zero-dependency package will provide browser-compatible version of istanbul coverage-tool (v0.4.5), with working web-demo
*
Expand Down Expand Up @@ -11367,17 +11367,19 @@ local.coverageMerge = function (coverage1 = {}, coverage2 = {}) {
return coverage1;
};

local.coverageReportCreate = function (opt) {
local.coverageReportCreate = function ({
coverage,
coverageInclude
}) {
/*
* this function will
// 1. merge previous <dirCoverage>/coverage.json into <opt>.coverage
// 2. convert <opt>.coverage to <summaryDict>
// 1. merge previous <dirCoverage>/coverage.json into <coverage>
// 2. convert <coverage> to <summaryDict>
// 3. convert <summaryDict> to <nodeRoot>
// 4. convert <nodeRoot> to text-report <dirCoverage>/coverage.txt
// 5. convert <nodeRoot> to html-report <dirCoverage>/\*
// 6. return coverage-report in html-format as single document
*/
let coverageInclude;
let dirCoverage;
let filePrefix;
let htmlAll;
Expand All @@ -11388,9 +11390,6 @@ local.coverageReportCreate = function (opt) {
let nodeRoot;
let summaryDict;
let tmp;
if (!(opt && opt.coverage)) {
return "";
}
// init function
nodeChildAdd = function (node, child) {
/*
Expand Down Expand Up @@ -11516,15 +11515,15 @@ local.coverageReportCreate = function (opt) {
);
});
};
// 1. merge previous <dirCoverage>/coverage.json into <opt>.coverage
// 1. merge previous <dirCoverage>/coverage.json into <coverage>
dirCoverage = path.resolve(".tmp/build/coverage");
coverageInclude = opt.coverageInclude || globalThis.__coverageInclude__;
coverageInclude = coverageInclude || globalThis.__coverageInclude__;
if (!local.isBrowser && process.env.npm_config_mode_coverage_merge) {
console.error(
"istanbul - merging file "
+ dirCoverage + "/coverage.json to coverage"
);
local.coverageMerge(opt.coverage, local.fsReadFileOrDefaultSync(
local.coverageMerge(coverage, local.fsReadFileOrDefaultSync(
dirCoverage + "/coverage.json",
"json",
{}
Expand All @@ -11537,9 +11536,9 @@ local.coverageReportCreate = function (opt) {
coverageInclude[file] = 1;
});
}
// 2. convert <opt>.coverage to <summaryDict>
// 2. convert <coverage> to <summaryDict>
summaryDict = {};
Object.entries(opt.coverage).forEach(function ([
Object.entries(coverage).forEach(function ([
file,
fileCoverage
]) {
Expand All @@ -11549,7 +11548,7 @@ local.coverageReportCreate = function (opt) {
let summary;
if (fileCoverage && coverageInclude.hasOwnProperty(file)) {
// reset line-cnt
delete opt.coverage[file].l;
delete coverage[file].l;
// init summary
summary = {
branches: {
Expand Down Expand Up @@ -11690,11 +11689,11 @@ local.coverageReportCreate = function (opt) {
// 4. convert <nodeRoot> to text-report <dirCoverage>/coverage.txt
reportTextWrite(nodeRoot, dirCoverage);
// 5. convert <nodeRoot> to html-report <dirCoverage>/\*
htmlAll = reportHtmlWrite(nodeRoot, dirCoverage, opt.coverage);
// save opt.coverage to dirCoverage/coverage.json
htmlAll = reportHtmlWrite(nodeRoot, dirCoverage, coverage);
// save coverage to dirCoverage/coverage.json
fileWrite(
dirCoverage + "/coverage.json",
JSON.stringify(opt.coverage, undefined, 4)
JSON.stringify(coverage, undefined, 4)
);
// save coverageInclude to dirCoverage/coverage.include.json
fileWrite(
Expand Down
4 changes: 2 additions & 2 deletions lib.jslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -16319,8 +16319,8 @@ local.jslint0 = Object.freeze(function (
// expected_a_before_b: "Expected '{a}' before '{b}'.",
case "expected_a_before_b":
bb = (
aa.slice(0, warning.column) + warning.a
+ aa.slice(warning.column)
aa.slice(0, warning.column - 1) + warning.a
+ aa.slice(warning.column - 1)
);
break;
// expected_identifier_a:
Expand Down
Loading

0 comments on commit 905e5a8

Please sign in to comment.