├── .ci.sh ├── .gitconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── website_issue.md └── workflows │ ├── ci.yml │ ├── on_pull_request.yml │ └── publish.yml ├── .gitignore ├── .npmignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── asset_codemirror_rollup.js ├── asset_font_daley_bold.woff2 ├── asset_image_folder_open_solid.svg ├── asset_image_github_brands.svg ├── asset_image_jslint_wrapper_vim.png ├── asset_image_jslint_wrapper_vscode.png ├── asset_image_json_160.svg ├── asset_image_logo_256.html ├── asset_image_logo_256.png ├── asset_image_logo_256.svg ├── index.html ├── jslint.mjs ├── jslint_ci.sh ├── jslint_wrapper_cjs.cjs ├── jslint_wrapper_codemirror.html ├── jslint_wrapper_codemirror.js ├── jslint_wrapper_vim.vim ├── jslint_wrapper_vscode.js ├── package.json ├── test.mjs └── test_coverage_merge_data.json /.ci.sh: -------------------------------------------------------------------------------- 1 | shCiArtifactUploadCustom() {(set -e 2 | # this function will run custom-code to upload build-artifacts 3 | # .github_cache - restore 4 | if [ "$GITHUB_ACTION" ] && [ -d .github_cache ] 5 | then 6 | cp -a .github_cache/* . || true # js-hack - */ 7 | fi 8 | # add jslint.js 9 | cp jslint.mjs jslint.js 10 | git add -f jslint.js 11 | # seo - inline css-assets and invalidate cached-assets 12 | node --input-type=module --eval ' 13 | import moduleFs from "fs"; 14 | (async function () { 15 | let cacheKey = Math.random().toString(36).slice(-4); 16 | let fileDict = {}; 17 | await Promise.all([ 18 | "index.html" 19 | ].map(async function (file) { 20 | try { 21 | fileDict[file] = await moduleFs.promises.readFile(file, "utf8"); 22 | } catch (ignore) { 23 | process.exit(); 24 | } 25 | })); 26 | // invalidate cached-assets 27 | fileDict["index.html"] = fileDict["index.html"].replace(( 28 | /\b(?:href|src)=".+?\.(?:css|js|mjs)\b/g 29 | ), function (match0) { 30 | return `${match0}?cc=${cacheKey}`; 31 | }); 32 | // write file 33 | Object.entries(fileDict).map(function ([ 34 | file, data 35 | ]) { 36 | moduleFs.promises.writeFile(file, data); 37 | }); 38 | }()); 39 | ' "$@" # ' 40 | # screenshot quickstart 41 | node --input-type=module --eval ' 42 | import moduleFs from "fs"; 43 | import moduleChildProcess from "child_process"; 44 | (async function () { 45 | let fileDict = {}; 46 | let screenshotCurl; 47 | await Promise.all([ 48 | "README.md" 49 | ].map(async function (file) { 50 | fileDict[file] = await moduleFs.promises.readFile(file, "utf8"); 51 | })); 52 | screenshotCurl = await moduleFs.promises.stat("jslint.mjs"); 53 | screenshotCurl = String(` 54 | echo "\ 55 | % Total % Received % Xferd Average Speed Time Time Time Current 56 | Dload Upload Total Spent Left Speed 57 | 100 250k 100 250k 0 0 250k 0 0:00:01 --:--:-- 0:00:01 250k\ 58 | " 59 | `).trim().replace(( 60 | /250/g 61 | ), Math.floor(screenshotCurl.size / 1024)); 62 | // parallel-task - run-and-screenshot example-shell-commands in README.md 63 | await Promise.all(Array.from( 64 | fileDict["README.md"].matchAll( 65 | /\n```shell \n([\S\s]*?\n)```\n/g 66 | ) 67 | ).map(async function ([ 68 | ignore, file, script0 69 | ]) { 70 | let script = script0; 71 | // modify script - jslint install 72 | script = script.replace( 73 | "curl -L https://www.jslint.com/jslint.mjs > jslint.mjs", 74 | screenshotCurl 75 | ); 76 | // modify script - cd node-sqlite3 77 | script = script.replace(( 78 | /\n\ncd node-sqlite3-\w*?\n/g 79 | ), ( 80 | " 2>/dev/null || true\n" 81 | + "$&\n" 82 | + "git checkout 61194ec2aee4b56e8e17f757021434122772f145\n" 83 | )); 84 | // printf script 85 | script = ( 86 | "(set -e\n" 87 | + "printf \u0027" 88 | + script0.trim().replace(( 89 | /[%\\]/gm 90 | ), "$&$&").replace(( 91 | /\u0027/g 92 | ), "\u0027\"\u0027\"\u0027").replace(( 93 | /^/gm 94 | ), "> ") 95 | + "\n\n\n\u0027\n" 96 | + script 97 | + ")\n" 98 | ); 99 | await moduleFs.promises.writeFile(file + ".sh", script); 100 | await new Promise(function (resolve) { 101 | moduleChildProcess.spawn( 102 | "sh", 103 | [ 104 | "jslint_ci.sh", "shRunWithScreenshotTxt", file, 105 | "sh", file + ".sh" 106 | ], 107 | { 108 | env: Object.assign({ 109 | // limit stdout to xxx lines 110 | SH_RUN_WITH_SCREENSHOT_TXT_MAX_LINES: 64 111 | }, process.env), 112 | stdio: ["ignore", 1, 2] 113 | } 114 | ).on("exit", resolve); 115 | }); 116 | })); 117 | }()); 118 | ' "$@" # ' 119 | # background http-file-server to serve webpages for screenshot 120 | # PORT=8080 npm_config_timeout_exit=5000 shHttpFileServer & 121 | # screenshot html 122 | node --input-type=module --eval ' 123 | import moduleChildProcess from "child_process"; 124 | (async function () { 125 | let { 126 | GITHUB_BRANCH0, 127 | GITHUB_GITHUB_IO 128 | } = process.env; 129 | await Promise.all([ 130 | ( 131 | `https://${GITHUB_GITHUB_IO}/branch-${GITHUB_BRANCH0}` 132 | + `/jslint_wrapper_codemirror.html` 133 | ), 134 | ( 135 | `https://${GITHUB_GITHUB_IO}/branch-${GITHUB_BRANCH0}` 136 | + `/index.html` 137 | ), 138 | ".artifact/apidoc.html", 139 | ".artifact/coverage_sqlite3_js/index.html", 140 | ".artifact/coverage_sqlite3_js/lib/sqlite3.js.html", 141 | ".artifact/coverage_sqlite3_sh/index.html", 142 | ".artifact/coverage_sqlite3_sh/lib/sqlite3.js.html", 143 | ".artifact/jslint_report_hello.html" 144 | ].map(async function (url) { 145 | await new Promise(function (resolve) { 146 | moduleChildProcess.spawn( 147 | "sh", 148 | ["jslint_ci.sh", "shBrowserScreenshot", url], 149 | {stdio: ["ignore", 1, 2]} 150 | ).on("exit", resolve); 151 | }); 152 | })); 153 | }()); 154 | ' "$@" # ' 155 | # remove bloated json-coverage-files 156 | rm .artifact/coverage/*.json # js-hack - */ 157 | rm .artifact/coverage_sqlite3_*/*.json # js-hack - */ 158 | # jslint_wrapper_vscode - build 159 | shCiVscePackageJslintWrapperVscode 160 | # .github_cache - save 161 | if [ "$GITHUB_ACTION" ] && [ ! -d .github_cache ] 162 | then 163 | mkdir -p .github_cache 164 | cp -a node-sqlite3-* .github_cache 165 | fi 166 | )} 167 | 168 | shCiBaseCustom() {(set -e 169 | # this function will run custom-code for base-ci 170 | # update files 171 | if [ "$(git branch --show-current)" = alpha ] 172 | then 173 | node --input-type=module --eval ' 174 | import jslint from "./jslint.mjs"; 175 | import moduleFs from "fs"; 176 | (async function () { 177 | let fileDict = {}; 178 | let fileModified; 179 | let versionBeta; 180 | let versionMaster; 181 | await Promise.all([ 182 | ".ci.sh", 183 | "CHANGELOG.md", 184 | "README.md", 185 | "index.html", 186 | "jslint.mjs", 187 | "jslint_ci.sh", 188 | "jslint_wrapper_codemirror.html" 189 | ].map(async function (file) { 190 | fileDict[file] = await moduleFs.promises.readFile(file, "utf8"); 191 | })); 192 | Array.from(fileDict["CHANGELOG.md"].matchAll( 193 | /\n\n# v(\d\d\d\d\.\d\d?\.\d\d?(-.*?)?)\n/g 194 | )).slice(0, 2).forEach(function ([ 195 | ignore, version, isBeta 196 | ]) { 197 | versionBeta = versionBeta || version; 198 | versionMaster = versionMaster || (!isBeta && version); 199 | }); 200 | await Promise.all([ 201 | { 202 | file: ".ci.sh", 203 | // update version 204 | src: fileDict[".ci.sh"].replace(( 205 | / "version": "\d\d\d\d\.\d\d?\.\d\d?(?:-.*?)?"/ 206 | ), ` "version": "${versionBeta.split("-")[0]}"`) 207 | }, { 208 | file: "README.md", 209 | src: fileDict["README.md"].replace(( 210 | /\n```html \n[\S\s]*?\n```\n/ 211 | ), ( 212 | "\n```html \n" 213 | + fileDict["jslint_wrapper_codemirror.html"] 214 | + "```\n" 215 | )) 216 | }, { 217 | file: "index.html", 218 | src: fileDict["index.html"].replace(( 219 | /\n 427 | 428 | 429 | 430 |
431 |