Skip to content

Commit

Permalink
Merge pull request #392 from kaizhu256/v2022.3.30
Browse files Browse the repository at this point in the history
# v2022.3.30
  • Loading branch information
kaizhu256 committed Mar 31, 2022
2 parents cfd9819 + edfd27c commit 8598a8a
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- macos-latest
- ubuntu-latest
- windows-latest
name: |
name: >
job1
node
v${{ matrix.node_version }}
Expand All @@ -60,11 +60,11 @@ jobs:
# https://github.com/actions/cache
- uses: actions/cache@v2
with:
key: |
key: >
${{ hashFiles('./package.json') }}
${{ matrix.architecture }}
${{ matrix.node_version }}
${{ matrix.os }}
${{ hashFiles('./package.json') }}
path: .github_cache
# https://github.com/actions/setup-node
- uses: actions/setup-node@v2
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- node - after node-v14 is deprecated, remove shell-code `export "NODE_OPTIONS=--unhandled-rejections=strict"`.
- perf - improve performance by hoisting inlined regexps out of loops and subfunctions

# v2022.3.1-beta
# v2022.3.30
- website - use localStorage to persist jslint-options selected in ui
- website - add optional debug-mode to use sessionStorage to persist jslint-globals and jslint-source from ui
- jslint - add numeric-separator support
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Douglas Crockford <douglas@crockford.com>


# Status
| Branch | [master<br>(v2022.2.20)](https://github.com/jslint-org/jslint/tree/master) | [beta<br>(Web Demo)](https://github.com/jslint-org/jslint/tree/beta) | [alpha<br>(Development)](https://github.com/jslint-org/jslint/tree/alpha) |
| Branch | [master<br>(v2022.3.30)](https://github.com/jslint-org/jslint/tree/master) | [beta<br>(Web Demo)](https://github.com/jslint-org/jslint/tree/beta) | [alpha<br>(Development)](https://github.com/jslint-org/jslint/tree/alpha) |
|--:|:--:|:--:|:--:|
| CI | [![ci](https://github.com/jslint-org/jslint/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/jslint-org/jslint/actions?query=branch%3Amaster) | [![ci](https://github.com/jslint-org/jslint/actions/workflows/ci.yml/badge.svg?branch=beta)](https://github.com/jslint-org/jslint/actions?query=branch%3Abeta) | [![ci](https://github.com/jslint-org/jslint/actions/workflows/ci.yml/badge.svg?branch=alpha)](https://github.com/jslint-org/jslint/actions?query=branch%3Aalpha) |
| Coverage | [![coverage](https://jslint-org.github.io/jslint/branch-master/.artifact/coverage/coverage_badge.svg)](https://jslint-org.github.io/jslint/branch-master/.artifact/coverage/index.html) | [![coverage](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage/coverage_badge.svg)](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage/index.html) | [![coverage](https://jslint-org.github.io/jslint/branch-alpha/.artifact/coverage/coverage_badge.svg)](https://jslint-org.github.io/jslint/branch-alpha/.artifact/coverage/index.html) |
Expand Down
2 changes: 1 addition & 1 deletion jslint.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ let jslint_charset_ascii = (
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
+ "`abcdefghijklmnopqrstuvwxyz{|}~\u007f"
);
let jslint_edition = "v2022.3.1-beta";
let jslint_edition = "v2022.3.30";
let jslint_export; // The jslint object to be exported.
let jslint_fudge = 1; // Fudge starting line and starting
// ... column to 1.
Expand Down
40 changes: 35 additions & 5 deletions jslint_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,14 @@ shGitSquashPop() {(set -e
git commit -am "$MESSAGE" || true
)}

shGithubFileDownload() {(set -e
# this function will download file $1 from github repo/branch
# https://docs.github.com/en/rest/reference/repos#create-or-update-file-contents
# example use:
# shGithubFileDownload octocat/hello-worId/master/hello.txt
shGithubFileUpload $1
)}

shGithubFileUpload() {(set -e
# this function will upload file $2 to github repo/branch $1
# https://docs.github.com/en/rest/reference/repos#create-or-update-file-contents
Expand All @@ -810,6 +818,7 @@ shGithubFileUpload() {(set -e
node --input-type=module --eval '
import moduleFs from "fs";
import moduleHttps from "https";
import modulePath from "path";
function assertOrThrow(condition, message) {
if (!condition) {
throw (
Expand All @@ -821,7 +830,7 @@ function assertOrThrow(condition, message) {
}
(async function () {
let branch;
let content = await moduleFs.promises.readFile(process.argv[2]);
let content = process.argv[2];
let path = process.argv[1];
let repo;
let responseText;
Expand All @@ -845,11 +854,11 @@ function assertOrThrow(condition, message) {
responseText += chunk;
});
res.on("end", function () {
assertOrThrow(
res.statusCode === 200,
`shGithubFileUpload - failed to upload file ${url} - `
assertOrThrow(res.statusCode === 200, (
"shGithubFileUpload"
+ `- failed to download/upload file ${url} - `
+ responseText
);
));
resolve();
});
}).end(payload);
Expand All @@ -861,6 +870,14 @@ function assertOrThrow(condition, message) {
path = path.slice(3).join("/");
url = `https://api.github.com/repos/${repo}/contents/${path}`;
await httpRequest({});
if (!content) {
await moduleFs.promises.writeFile(
modulePath.basename(url),
Buffer.from(JSON.parse(responseText).content, "base64")
);
return;
}
content = await moduleFs.promises.readFile(content);
await httpRequest({
method: "PUT",
payload: JSON.stringify({
Expand All @@ -874,6 +891,19 @@ function assertOrThrow(condition, message) {
' "$@" # '
)}

shGithubWorkflowDispatch() {(set -e
# this function will trigger-workflow to ci-repo $1 for owner.repo.branch $2
# example use:
# shGithubWorkflowDispatch octocat/my_ci octocat/my_project/master
curl "https://api.github.com/repos/$1"\
"/actions/workflows/ci.yml/dispatches" \
-H "accept: application/vnd.github.v3+json" \
-H "authorization: token $MY_GITHUB_TOKEN" \
-X POST \
-d '{"ref":"'"$2"'"}' \
-s
)}

shGrep() {(set -e
# this function will recursively grep . for $REGEXP
REGEXP="$1"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
"test2": "sh jslint_ci.sh shCiBase"
},
"type": "module",
"version": "2022.3.1-beta"
"version": "2022.3.30"
}
25 changes: 19 additions & 6 deletions test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ jstestDescribe((
});
});
jstestIt((
"test cli-report-misc handling-behavior"
"test cli-report-json-error handling-behavior"
), function () {
jslint.jslint_cli({
// suppress error
Expand All @@ -223,14 +223,14 @@ jstestDescribe((
"node",
"jslint.mjs",
"jslint_report=.tmp/jslint_report.html",
"aa.js"
"aa.json"
],
process_exit: processExit1,
source: "(aa)=>aa; function aa([aa]){}"
source: "["
});
});
jstestIt((
"test cli-report-json-error handling-behavior"
"test cli-report-misc handling-behavior"
), function () {
jslint.jslint_cli({
// suppress error
Expand All @@ -240,10 +240,23 @@ jstestDescribe((
"node",
"jslint.mjs",
"jslint_report=.tmp/jslint_report.html",
"aa.json"
"aa.js"
],
process_exit: processExit0,
source: "let aa = 0;"
});
jslint.jslint_cli({
// suppress error
console_error: noop,
mode_cli: true,
process_argv: [
"node",
"jslint.mjs",
"jslint_report=.tmp/jslint_report.html",
"aa.js"
],
process_exit: processExit1,
source: "["
source: "(aa)=>aa; function aa([aa]){}"
});
});
jstestIt((
Expand Down

0 comments on commit 8598a8a

Please sign in to comment.