Skip to content

Commit

Permalink
- ci - Fix tmpdir in shell-function shBrowserScreenshot().
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizhu256 committed Mar 11, 2024
1 parent 6777f29 commit 496f13a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- jslint - try to improve parser to be able to parse jquery.js without stopping.

# v2024.3.1-beta
- ci - Fix tmpdir in shell-function shBrowserScreenshot().
- vim - Allow installing vim-plugin to any directory, instead of hardcoded to ~/.vim/.
- ci - Update github-ci for actions/cache, actions/setup-python from nodejs v16 to nodejs v20.
- ci - Update shell-function shRollupFetch() to fix blank date-committed.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -986,17 +986,17 @@ git push upstream beta:master
git push origin alpha:branch_xxx
git push upstream alpha
```
- goto https://github.com/jslint-org/jslint/compare/beta...kaizhu256:jslint:branch_xxx
- goto https://github.com/jslint-org/jslint/compare/beta...kaizhu256:jslint:alpha
- select branch to merge
- click `Create pull request`
- `Add a description` template:
```
Fixes #xxx.
- <primary-commit-message>
This PR ...
This PR will ...
Additionally, this PR will:
this PR will additionally:
- <secondary-commit-messages>
...
Expand Down
10 changes: 8 additions & 2 deletions jslint_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ shBrowserScreenshot() {(set -e
# window-size $2
node --input-type=module --eval '
import moduleChildProcess from "child_process";
import moduleFs from "fs";
import moduleOs from "os";
import modulePath from "path";
import moduleUrl from "url";
Expand All @@ -225,6 +226,7 @@ import moduleUrl from "url";
let exitCode;
let file;
let timeStart;
let tmpdir;
let url;
if (process.platform !== "linux") {
return;
Expand All @@ -244,12 +246,15 @@ import moduleUrl from "url";
file = ".artifact/screenshot_browser_" + encodeURIComponent(file).replace((
/%/g
), "_").toLowerCase() + ".png";
tmpdir = await moduleFs.promises.mkdtemp(
moduleOs.tmpdir() + "/shBrowserScreenshot-"
);
child = moduleChildProcess.spawn(
(
process.platform === "darwin"
? "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
: process.platform === "win32"
? "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
? "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
: "/usr/bin/google-chrome-stable"
),
[
Expand All @@ -258,7 +263,7 @@ import moduleUrl from "url";
"--incognito",
"--screenshot",
"--timeout=30000",
"--user-data-dir=" + moduleOs.tmpdir(),
"--user-data-dir=" + tmpdir,
"--window-size=800x600",
"-screenshot=" + file,
(
Expand All @@ -277,6 +282,7 @@ import moduleUrl from "url";
exitCode = await new Promise(function (resolve) {
child.on("exit", resolve);
});
await moduleFs.promises.rm(tmpdir, {recursive: true});
console.error(
"shBrowserScreenshot"
+ "\n - url - " + url
Expand Down

0 comments on commit 496f13a

Please sign in to comment.