Skip to content

Commit

Permalink
maint/build ~ (package) teach 'help' to run without prior npm install
Browse files Browse the repository at this point in the history
  • Loading branch information
rivy committed Nov 25, 2023
1 parent 4974b1d commit 6c95a99
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"# fix:style # fix Prettier formatting issues": "",
"fix:style": "prettier . --write --list-different",
"# help # display help": "",
"help": "run-s --silent _:help",
"help": "npm run --silent _:ensure-installed --package_name=npm-run-all && run-s --silent _:help",
"# lint # check for package code 'lint'": "",
"lint": "run-s --silent +:max-node-8 && shx echo \"[lint] WARN Lint checks skipped [for NodeJS < v10]\" 1>&2 || run-p --print-name \"lint:*\"",
"# lint:audit # check for `npm audit` violations in project code": "",
Expand Down Expand Up @@ -143,6 +143,7 @@
"+:min-node-10": "is-node-modern 10",
"## _:... == sub-scripts ('hidden'; generally should be run 'silently' using `run-s/run-p --silent ...`": "",
"_:debug:env": "node -e \"console.log({env: process.env})\"",
"_:ensure-installed": "node -e \"try {require(process.env.npm_config_package_name);} catch {process.exit(1);};\" || npm install --silent",
"_:exists:git-changelog": "node -e \"if (!require('command-exists').sync('git-changelog')){process.exit(1);};\" || ( shx echo \"WARN `git-changelog` missing (try `go get -u github.com/rivy-go/git-changelog/cmd/git-changelog`)\" & exit 1 )",
"* _:help # print usage/TARGETs by matching lines containing leading double-quoted text like `# TARGET_NAME # HELP_TEXT`": "",
"_:help": "< package.json node -e \"s = {p:'',e:'npm'}; if (new String(process.env.npm_execpath).match(/yarn[^\\/]*[.][cm]?js$/)) { s = {p:'\\n',e:'yarn'}; }; console.log('%sUsage: \\`\\x1b[2m%s run TARGET\\x1b[m\\` or \\`\\x1b[2mnpx run-s TARGET [TARGET..]\\x1b[m\\`\\n\\nTARGETs:\\n', s.p, s.e); re = /^.*?\\x22(?:#\\s*)(\\w[^#\\x22]*)\\s+#+\\s+([^\\x22]+?)(\\s+#+)?\\x22.*$/; require('readline').createInterface({ input: process.stdin, output: process.stdout, terminal: false }).on('line', function(line){ if (match = re.exec(line)) { console.log('\\x1b[0;32m%s\\x1b[m %s', match[1].padEnd(19), match[2]); } }).on('close', () => { console.log('\\x1b[8;30m.\\x1b[m'); });\"",
Expand Down

0 comments on commit 6c95a99

Please sign in to comment.