From 5d1e2a34eca694024d2c424cfa1deeb74f955307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Fri, 18 Mar 2022 09:58:13 +0200 Subject: [PATCH 1/2] Enable exception mode to skip scripts on first error --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 80090ebfe..3d473165c 100644 --- a/package.json +++ b/package.json @@ -62,16 +62,16 @@ "build": "shx rm -rf ./distribution && tsc -p tsconfig.production.json && madge ./distribution --circular", "build:fast": "tsc -p tsconfig.production.json", "build:flow-types": "cp source/danger.d.ts source/_danger.d.ts && sed -ie 's/api: GitHub/api: any/g' source/_danger.d.ts && npx flowgen@1.3.0 source/_danger.d.ts -o distribution/danger.js.flow && node scripts/update_flow_types.js", - "build:schemas": "typescript-json-schema tsconfig.json DangerJSON > source/danger-incoming-process-schema.json; typescript-json-schema tsconfig.json DangerResults > source/danger-outgoing-process-schema.json; yarn prettier --write source/danger-outgoing-process-schema.json source/danger-incoming-process-schema.json", - "build:pretty-types": "yarn prettier --write distribution/danger.d.ts; yarn prettier --parser flow distribution/danger.js.flow --write", + "build:schemas": "set -e; typescript-json-schema tsconfig.json DangerJSON > source/danger-incoming-process-schema.json; typescript-json-schema tsconfig.json DangerResults > source/danger-outgoing-process-schema.json; yarn prettier --write source/danger-outgoing-process-schema.json source/danger-incoming-process-schema.json", + "build:pretty-types": "set -e; yarn prettier --write distribution/danger.d.ts; yarn prettier --parser flow distribution/danger.js.flow --write", "build:watch": "tsc -w", "link": "yarn run build && chmod +x distribution/commands/danger.js && yarn link", - "package": "yarn run pkg . --output brew-distribution/danger; zip -j brew-distribution/danger-macos.zip brew-distribution/danger; shasum -a 256 brew-distribution/danger-macos.zip", + "package": "set -e; yarn run pkg . --output brew-distribution/danger; zip -j brew-distribution/danger-macos.zip brew-distribution/danger; shasum -a 256 brew-distribution/danger-macos.zip", "declarations": "ts-node ./scripts/create-danger-dts.ts", - "docs:cp_defs": "mkdir docs/docs_generate; cp source/danger.d.ts docs/docs_generate; cp node_modules/@octokit/rest/index.d.ts docs/docs_generate/github.d.ts", - "docs": "yarn run docs:cp_defs; yarn typedoc --ignoreCompilerErrors --mode modules --json docs/js_ref_dsl_docs.json --includeDeclarations source", + "docs:cp_defs": "set -e; mkdir docs/docs_generate; cp source/danger.d.ts docs/docs_generate; cp node_modules/@octokit/rest/index.d.ts docs/docs_generate/github.d.ts", + "docs": "set -e; yarn run docs:cp_defs; yarn typedoc --ignoreCompilerErrors --mode modules --json docs/js_ref_dsl_docs.json --includeDeclarations source", "dts-lint": "yarn run declarations && yarn dtslint types", - "danger:prepush": "yarn build:fast; yarn test:fixtures; node distribution/commands/danger.js local --base main --dangerfile dangerfile.lite.ts" + "danger:prepush": "set -e; yarn build:fast; yarn test:fixtures; node distribution/commands/danger.js local --base main --dangerfile dangerfile.lite.ts" }, "repository": { "type": "git", @@ -185,7 +185,7 @@ "husky": { "hooks": { "pre-commit": "lint-staged", - "pre-push": "yarn build; yarn danger:prepush" + "pre-push": "set -e; yarn build; yarn danger:prepush" } } } From c630686bc7bca46623a5c788702513c4c6de84e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Fri, 18 Mar 2022 09:59:32 +0200 Subject: [PATCH 2/2] Be consistent and use set -e in all scripts --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3d473165c..539903cb2 100644 --- a/package.json +++ b/package.json @@ -58,19 +58,19 @@ "test:watch": "jest --watch", "lint": "eslint \"source/*.ts\" \"source/**/*.ts\"", "lint:fix": "yarn --silent lint --fix", - "prepublishOnly": "yarn build && yarn jest && yarn declarations && yarn build:flow-types && yarn build:pretty-types", - "build": "shx rm -rf ./distribution && tsc -p tsconfig.production.json && madge ./distribution --circular", + "prepublishOnly": "set -e; yarn build; yarn jest; yarn declarations; yarn build:flow-types; yarn build:pretty-types", + "build": "set -e; shx rm -rf ./distribution; tsc -p tsconfig.production.json; madge ./distribution --circular", "build:fast": "tsc -p tsconfig.production.json", - "build:flow-types": "cp source/danger.d.ts source/_danger.d.ts && sed -ie 's/api: GitHub/api: any/g' source/_danger.d.ts && npx flowgen@1.3.0 source/_danger.d.ts -o distribution/danger.js.flow && node scripts/update_flow_types.js", + "build:flow-types": "set -e; cp source/danger.d.ts source/_danger.d.ts; sed -ie 's/api: GitHub/api: any/g' source/_danger.d.ts; npx flowgen@1.3.0 source/_danger.d.ts -o distribution/danger.js.flow; node scripts/update_flow_types.js", "build:schemas": "set -e; typescript-json-schema tsconfig.json DangerJSON > source/danger-incoming-process-schema.json; typescript-json-schema tsconfig.json DangerResults > source/danger-outgoing-process-schema.json; yarn prettier --write source/danger-outgoing-process-schema.json source/danger-incoming-process-schema.json", "build:pretty-types": "set -e; yarn prettier --write distribution/danger.d.ts; yarn prettier --parser flow distribution/danger.js.flow --write", "build:watch": "tsc -w", - "link": "yarn run build && chmod +x distribution/commands/danger.js && yarn link", + "link": "set -e; yarn run build; chmod +x distribution/commands/danger.js; yarn link", "package": "set -e; yarn run pkg . --output brew-distribution/danger; zip -j brew-distribution/danger-macos.zip brew-distribution/danger; shasum -a 256 brew-distribution/danger-macos.zip", "declarations": "ts-node ./scripts/create-danger-dts.ts", "docs:cp_defs": "set -e; mkdir docs/docs_generate; cp source/danger.d.ts docs/docs_generate; cp node_modules/@octokit/rest/index.d.ts docs/docs_generate/github.d.ts", "docs": "set -e; yarn run docs:cp_defs; yarn typedoc --ignoreCompilerErrors --mode modules --json docs/js_ref_dsl_docs.json --includeDeclarations source", - "dts-lint": "yarn run declarations && yarn dtslint types", + "dts-lint": "set -e; yarn run declarations; yarn dtslint types", "danger:prepush": "set -e; yarn build:fast; yarn test:fixtures; node distribution/commands/danger.js local --base main --dangerfile dangerfile.lite.ts" }, "repository": {