From cb436d3e5b33ba0bee91aad549efb476393ad93f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Wed, 19 Jan 2022 09:57:15 +0100 Subject: [PATCH] fix(build): break build when step fails --- packages/dnb-eufemia/package.json | 2 +- packages/dnb-eufemia/scripts/release/babel-cjs.sh | 2 ++ packages/dnb-eufemia/scripts/release/babel-es.sh | 2 ++ packages/dnb-eufemia/scripts/release/babel-esm.sh | 2 ++ .../dnb-eufemia/scripts/release/copy-build-artifacts.sh | 2 ++ packages/dnb-eufemia/scripts/release/postbuild.sh | 6 ++++++ 6 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/dnb-eufemia/package.json b/packages/dnb-eufemia/package.json index 104c2e15139..188e718806e 100644 --- a/packages/dnb-eufemia/package.json +++ b/packages/dnb-eufemia/package.json @@ -21,7 +21,7 @@ "audit:ci:yarn-outdated": "babel-node ./scripts/prepub/audit/toOpt && audit-ci --config ./audit-ci.json --package-manager=yarn --report-type full && babel-node ./scripts/prepub/audit/toDev", "build": "yarn build:prebuild && yarn build:esm && yarn build:copy", "prebuild:ci": "yarn build", - "postbuild:ci": "./scripts/release/postbuild.sh && yarn test:build", + "postbuild:ci": "./scripts/release/postbuild.sh", "build:cjs": "./scripts/release/babel-cjs.sh", "build:clean": "rm -rf build/**", "build:copy": "./scripts/release/copy-build-artifacts.sh", diff --git a/packages/dnb-eufemia/scripts/release/babel-cjs.sh b/packages/dnb-eufemia/scripts/release/babel-cjs.sh index e0a03ec52ac..20e9303b9ff 100755 --- a/packages/dnb-eufemia/scripts/release/babel-cjs.sh +++ b/packages/dnb-eufemia/scripts/release/babel-cjs.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e # Exit immediately if a command exits with a non-zero status. + echo 'Building cjs bundle ...' cross-env \ diff --git a/packages/dnb-eufemia/scripts/release/babel-es.sh b/packages/dnb-eufemia/scripts/release/babel-es.sh index 7f9fa8fee5f..3eb873f74b7 100755 --- a/packages/dnb-eufemia/scripts/release/babel-es.sh +++ b/packages/dnb-eufemia/scripts/release/babel-es.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e # Exit immediately if a command exits with a non-zero status. + echo 'Building es bundle ...' cross-env \ diff --git a/packages/dnb-eufemia/scripts/release/babel-esm.sh b/packages/dnb-eufemia/scripts/release/babel-esm.sh index fb5edd9f2b8..252bbbb493a 100755 --- a/packages/dnb-eufemia/scripts/release/babel-esm.sh +++ b/packages/dnb-eufemia/scripts/release/babel-esm.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e # Exit immediately if a command exits with a non-zero status. + echo 'Building esm bundle ...' cross-env \ diff --git a/packages/dnb-eufemia/scripts/release/copy-build-artifacts.sh b/packages/dnb-eufemia/scripts/release/copy-build-artifacts.sh index 7460966ac8e..1c6257bbfda 100755 --- a/packages/dnb-eufemia/scripts/release/copy-build-artifacts.sh +++ b/packages/dnb-eufemia/scripts/release/copy-build-artifacts.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e # Exit immediately if a command exits with a non-zero status. + echo 'Copy artifacts ...' rm -rf build/**/{__tests__,cjs} diff --git a/packages/dnb-eufemia/scripts/release/postbuild.sh b/packages/dnb-eufemia/scripts/release/postbuild.sh index 6c6306f8f21..520fb6ba736 100755 --- a/packages/dnb-eufemia/scripts/release/postbuild.sh +++ b/packages/dnb-eufemia/scripts/release/postbuild.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e # Exit immediately if a command exits with a non-zero status. + echo 'Postbuild started ...' yarn build:types @@ -11,4 +13,8 @@ echo 'Can be enabled in future if needed -> yarn build:resources' yarn build:copy yarn prettier:other +echo 'Testing the postbuild ...' + +yarn test:build + echo 'Postbuild done!'