Skip to content

Commit

Permalink
maint/build ~ use 'succeeded' signal files as build targets (improve …
Browse files Browse the repository at this point in the history
…build robustness)
  • Loading branch information
rivy committed Feb 10, 2021
1 parent 5493029 commit 8ec629b
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@
"scripts": {
"# build # build/compile package": "",
"build": "run-p --silent \"build:*\"",
"build:cjs": "exec-if-updated --source package.json --source tsconfig.json --source \"tsconfig/**\" --source rollup.config.js --source \"src/**\" --target \"build/cjs/**\" \"run-s -n rebuild:cjs\"",
"build:esm": "exec-if-updated --source package.json --source tsconfig.json --source \"tsconfig/**\" --source rollup.config.js --source \"src/**\" --target \"build/esm/**\" \"run-s -n rebuild:esm\"",
"build:umd": "exec-if-updated --source package.json --source tsconfig.json --source \"tsconfig/**\" --source rollup.config.js --source \"src/**\" --target \"build/umd/**\" \"run-s -n rebuild:umd\"",
"build:tests": "exec-if-updated --source package.json --source tsconfig.json --source \"tsconfig/**\" --source rollup.config.js --source \"src/**\" --target \"build/cjs+tests/**\" \"run-s -n rebuild:tests\"",
"build:types": "exec-if-updated --source package.json --source tsconfig.json --source \"tsconfig/**\" --source rollup.config.js --source \"src/**\" --target \"build/types/**\" \"run-s -n rebuild:types\"",
"build:cjs": "exec-if-updated --source package.json --source tsconfig.json --source \"tsconfig/**\" --source \"rollup.*.config.js\" --source \"src/**\" --target build/.targets/build-cjs.succeeded \"run-s -n rebuild:cjs\"",
"build:esm": "exec-if-updated --source package.json --source tsconfig.json --source \"tsconfig/**\" --source \"rollup.*.config.js\" --source \"src/**\" --target build/.targets/build-esm.succeeded \"run-s -n rebuild:esm\"",
"build:umd": "exec-if-updated --source package.json --source tsconfig.json --source \"tsconfig/**\" --source \"rollup.*.config.js\" --source \"src/**\" --target build/.targets/build-umd.succeeded \"run-s -n rebuild:umd\"",
"build:tests": "exec-if-updated --source package.json --source tsconfig.json --source \"tsconfig/**\" --source \"rollup.*.config.js\" --source \"src/**\" --target build/.targets/build-cjs+tests.succeeded \"run-s -n rebuild:tests\"",
"build:types": "exec-if-updated --source package.json --source tsconfig.json --source \"tsconfig/**\" --source \"rollup.*.config.js\" --source \"src/**\" --target build/.targets/build-types.succeeded \"run-s -n rebuild:types\"",
"# clean # remove build artifacts": "",
"clean": "rimraf build dist",
"# coverage # calculate and display (or send) code coverage [alias: 'cov']": "",
Expand Down Expand Up @@ -102,12 +102,12 @@
"realclean": "run-s clean && rimraf coverage .nyc_output",
"# rebuild # clean and (re-)build project": "",
"rebuild": "run-s clean build",
"rebuild:cjs": "shx rm -fr build/cjs && tsc -p tsconfig/tsconfig.cjs.json && shx cp -r src/esm-wrapper build/cjs",
"rebuild:cjs": "shx rm -fr build/cjs && tsc -p tsconfig/tsconfig.cjs.json && shx cp -r src/esm-wrapper build/cjs && shx mkdir -p build/.targets && shx touch build/.targets/build-cjs.succeeded",
"## rebuild:esm * [2020-12-22; rivy] TS compiles to ESMs are broken due to extension mishandling (use `rollup`)": "tsc -p tsconfig/tsconfig.esm.json",
"rebuild:esm": "shx rm -fr build/esm && rollup -c .rollup.config.js",
"rebuild:umd": "shx rm -fr build/umd && tsc -p tsconfig/tsconfig.umd.json",
"rebuild:tests": "shx rm -fr build/cjs+tests && tsc -p tsconfig/tsconfig.tests.json",
"rebuild:types": "shx rm -fr build/types && tsc -p tsconfig/tsconfig.types.json",
"rebuild:esm": "shx rm -fr build/esm && rollup -c .rollup.config.js && shx mkdir -p build/.targets && shx touch build/.targets/build-esm.succeeded",
"rebuild:umd": "shx rm -fr build/umd && tsc -p tsconfig/tsconfig.umd.json && shx mkdir -p build/.targets && shx touch build/.targets/build-umd.succeeded",
"rebuild:tests": "shx rm -fr build/cjs+tests && tsc -p tsconfig/tsconfig.tests.json && shx mkdir -p build/.targets && shx touch build/.targets/build-cjs+tests.succeeded",
"rebuild:types": "shx rm -fr build/types && tsc -p tsconfig/tsconfig.types.json && shx mkdir -p build/.targets && shx touch build/.targets/build-types.succeeded",
"# retest # clean and (re-)test project": "",
"retest": "run-s clean test",
"# reset:hard # remove *all* generated files and reinstall dependencies": "",
Expand All @@ -125,15 +125,14 @@
"# update:changelog # update CHANGELOG (using `git changelog ...`)": "",
"update:changelog": "run-s --silent _:update:changelog && git diff --quiet --exit-code CHANGELOG.mkd || shx echo \"[update] info CHANGELOG updated\"",
"# update:dist # update distribution content": "",
"update:dist": "run-s build && exec-if-updated --source \"build/**\" --target \"dist/**\" --target \"dist\" \"run-s --silent \"_:update:dist:rebuild\"\"",
"update:dist": "run-s --silent build && exec-if-updated --source \"build/**\" --target \"dist/**\" --target dist/.targets/update-dist.succeeded \"run-s --silent _:update:dist:rebuild\"",
"## +:... == sub-scripts (may run 'visibly', but not user-facing)": "",
"+:coverage": "run-s build test:code && is-ci && run-s cov:send || run-s cov:view",
"+:max-node-8": "is-node-not-modern 10",
"+:min-node-10": "is-node-modern 10",
"## _:... == sub-scripts ('hidden'; generally should be run 'silently' using `run-s/run-p --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": "< package.json node -e \"s = {p:'',e:'npm'}; if (new String(process.env.npm_execpath).match(/yarn.js$/)) { s = {p:'\\n',e:'yarn'}; }; console.log('%susage: \\`%s run TARGET\\` or \\`npx run-s TARGET [TARGET..]\\`\\n\\nTARGETs:\\n', s.p, s.e); re = /^.*?\\x22(?:\\W+\\s*)([^#\\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('%s %s', match[1].padEnd(19), match[2]); } });\"",
"_:if-newer:lint": "exec-if-updated --source package.json --source tsconfig.json --source \"tsconfig/**\" --source rollup.config.js --source \"src/**\" --target \"build/**\" --target build \"run-s --print-name lint\"",
"_:lint:commits.all:spell": "node -e \"result=require('child_process').spawnSync('git log --color=never | cspell stdin --no-summary --config \".vscode/cspell.json\"',{shell:true,encoding:'utf-8'}); if (result.status != 0) {console.error('[cspell] ERR! Unknown words in commit(s)\\n'+result.stdout); process.exit(1);} else {console.log(result.stdout);};\"",
"_:lint:commits.new:commitlint": "node -e \"v=require('./package.json').version; result=require('child_process').spawnSync('commitlint --config .commitlint.config.js --from v'+v,{shell:true,encoding:'utf-8'}); if (result.status != 0) {console.error('[commitlint] ERR! Flawed commit(s) found\\n'+result.stdout+'\\n'+result.stderr); process.exit(1);} else {console.log(result.stdout);};\"",
"_:lint:commits.new:spell": "node -e \"v=require('./package.json').version; result=require('child_process').spawnSync('git log v'+v+'.. --color=never | cspell stdin --no-summary --config \".vscode/cspell.json\"',{shell:true,encoding:'utf-8'}); if (result.status != 0) {console.error('[cspell] ERR! Unknown words in commit(s)\\n'+result.stdout); process.exit(1);} else {console.log(result.stdout);};\"",
Expand All @@ -150,7 +149,7 @@
"_:update:dist.normalizeEOL": "eolConverter lf dist/**/*.{cjs,js,mjs,ts,json}",
"_:update:dist.pack": "node -e \"name=require('./package.json').name; result=require('child_process').spawnSync('npm pack && shx mkdir -p dist && shx mv '+name+'-*.tgz dist/'+name+'.tgz',{shell:true,encoding:'utf-8'}); if (result.status != 0) {console.error('[update] ERR! Unable to package (into *.tgz) for distribution\\n'+result.stdout); process.exit(1);} else {console.log(result.stdout);};\"",
"_:update:dist.types": "shx mkdir -p dist && shx rm -fr dist/types && shx cp -r build/types dist",
"_:update:dist:rebuild": "shx rm -fr dist && run-s --silent _:update:dist.build _:update:dist.types _:update:dist.normalizeEOL _:update:dist.pack",
"_:update:dist:rebuild": "shx rm -fr dist && run-s --silent _:update:dist.build _:update:dist.types _:update:dist.normalizeEOL _:update:dist.pack && shx mkdir -p dist/.targets && shx touch dist/.targets/update-dist.succeeded",
"_:version:spell:changelog_update": "run-s --silent _:exists:git-changelog && git changelog -u | cspell stdin --config \".vscode/cspell.json\" || shx echo \"[lint] WARN CHANGELOG update `cspell` exception\" 1>&2",
"_:version:update:changelog": "run-s --silent _:exists:git-changelog && node -e \"v=require('./package.json').version; result=require('child_process').spawnSync('git changelog --next-tag v'+v,{shell:true,encoding:'utf-8'}); if (result.status != 0) {console.error('ERR! '+result.stderr); process.exit(1);} else {require('fs').writeFileSync('CHANGELOG.mkd',result.stdout);};\" || shx echo \"[version] WARN CHANGELOG not updated\" 1>&2",
"## lifecycle scripts ##": "",
Expand Down

0 comments on commit 8ec629b

Please sign in to comment.