From 09b7d96a01fd37df5bdeb6fbf78d45620adcec35 Mon Sep 17 00:00:00 2001 From: Ivan Nejezchleb Date: Fri, 22 Nov 2024 16:03:33 +0100 Subject: [PATCH 1/3] fix: revert: make build script compatible with MacOs This reverts commit 972cde8606142a6ab818590dfd72c6f5bac8ec72. risk: low --- libs/api-client-tiger/scripts/build.sh | 3 +-- libs/sdk-backend-tiger/scripts/build.sh | 3 +-- libs/sdk-ui-dashboard/scripts/build.sh | 3 +-- tools/app-toolkit/scripts/build.sh | 3 +-- tools/catalog-export/scripts/build.sh | 3 +-- tools/mock-handling/scripts/build.sh | 3 +-- tools/plugin-toolkit/scripts/build.sh | 3 +-- 7 files changed, 7 insertions(+), 14 deletions(-) diff --git a/libs/api-client-tiger/scripts/build.sh b/libs/api-client-tiger/scripts/build.sh index 664e5a21eb6..662a9c4c050 100644 --- a/libs/api-client-tiger/scripts/build.sh +++ b/libs/api-client-tiger/scripts/build.sh @@ -5,12 +5,11 @@ _version() { VERSION=$(node -p "require('./package.json').version") NAME=$(node -p "require('./package.json').name") DESCRIPTION=$(node -p "require('./package.json').description") - sed -i.bak \ + sed -i \ -e "s|\0.\0.\0|$VERSION|" \ -e "s|LIB_NAME_PLACEHOLDER|$NAME|" \ -e "s|LIB_DESCRIPTION_PLACEHOLDER|$DESCRIPTION|" \ esm/__version.js esm/__version.d.ts - rm -f esm/*.bak } _post-build() { diff --git a/libs/sdk-backend-tiger/scripts/build.sh b/libs/sdk-backend-tiger/scripts/build.sh index 664e5a21eb6..662a9c4c050 100644 --- a/libs/sdk-backend-tiger/scripts/build.sh +++ b/libs/sdk-backend-tiger/scripts/build.sh @@ -5,12 +5,11 @@ _version() { VERSION=$(node -p "require('./package.json').version") NAME=$(node -p "require('./package.json').name") DESCRIPTION=$(node -p "require('./package.json').description") - sed -i.bak \ + sed -i \ -e "s|\0.\0.\0|$VERSION|" \ -e "s|LIB_NAME_PLACEHOLDER|$NAME|" \ -e "s|LIB_DESCRIPTION_PLACEHOLDER|$DESCRIPTION|" \ esm/__version.js esm/__version.d.ts - rm -f esm/*.bak } _post-build() { diff --git a/libs/sdk-ui-dashboard/scripts/build.sh b/libs/sdk-ui-dashboard/scripts/build.sh index 858a9c812c0..d970cb354ab 100644 --- a/libs/sdk-ui-dashboard/scripts/build.sh +++ b/libs/sdk-ui-dashboard/scripts/build.sh @@ -6,12 +6,11 @@ _version() { VERSION=$(node -p "require('./package.json').version") NAME=$(node -p "require('./package.json').name") DESCRIPTION=$(node -p "require('./package.json').description") - sed -i.bak \ + sed -i \ -e "s|\0.\0.\0|$VERSION|" \ -e "s|LIB_NAME_PLACEHOLDER|$NAME|" \ -e "s|LIB_DESCRIPTION_PLACEHOLDER|$DESCRIPTION|" \ esm/__version.js esm/__version.d.ts - rm -f esm/*.bak } _post-build() { diff --git a/tools/app-toolkit/scripts/build.sh b/tools/app-toolkit/scripts/build.sh index bae64ecd3af..9d30927e7e6 100644 --- a/tools/app-toolkit/scripts/build.sh +++ b/tools/app-toolkit/scripts/build.sh @@ -6,12 +6,11 @@ _version() { VERSION=$(node -p "require('./package.json').version") NAME=$(node -p "require('./package.json').name") DESCRIPTION=$(node -p "require('./package.json').description") - sed -i.bak \ + sed -i \ -e "s|\0.\0.\0|$VERSION|" \ -e "s|LIB_NAME_PLACEHOLDER|$NAME|" \ -e "s|LIB_DESCRIPTION_PLACEHOLDER|$DESCRIPTION|" \ esm/__version.js esm/__version.d.ts - rm -f esm/*.bak } PACKAGE_DIR="$(echo $(cd $(dirname $0)/.. && pwd -P))" diff --git a/tools/catalog-export/scripts/build.sh b/tools/catalog-export/scripts/build.sh index c886399a317..399b4479cca 100644 --- a/tools/catalog-export/scripts/build.sh +++ b/tools/catalog-export/scripts/build.sh @@ -5,12 +5,11 @@ _version() { VERSION=$(node -p "require('./package.json').version") NAME=$(node -p "require('./package.json').name") DESCRIPTION=$(node -p "require('./package.json').description") - sed -i.bak \ + sed -i \ -e "s|\0.\0.\0|$VERSION|" \ -e "s|LIB_NAME_PLACEHOLDER|$NAME|" \ -e "s|LIB_DESCRIPTION_PLACEHOLDER|$DESCRIPTION|" \ esm/__version.js esm/__version.d.ts - rm -f esm/*.bak } _post-build() { diff --git a/tools/mock-handling/scripts/build.sh b/tools/mock-handling/scripts/build.sh index d51a61fae0b..c4c36ab4492 100644 --- a/tools/mock-handling/scripts/build.sh +++ b/tools/mock-handling/scripts/build.sh @@ -5,12 +5,11 @@ _version() { VERSION=$(node -p "require('./package.json').version") NAME=$(node -p "require('./package.json').name") DESCRIPTION=$(node -p "require('./package.json').description") - sed -i.bak \ + sed -i \ -e "s|\0.\0.\0|$VERSION|" \ -e "s|LIB_NAME_PLACEHOLDER|$NAME|" \ -e "s|LIB_DESCRIPTION_PLACEHOLDER|$DESCRIPTION|" \ esm/__version.js esm/__version.d.ts - rm -f esm/*.bak } _post-build() { diff --git a/tools/plugin-toolkit/scripts/build.sh b/tools/plugin-toolkit/scripts/build.sh index 08920786cec..83006def32c 100644 --- a/tools/plugin-toolkit/scripts/build.sh +++ b/tools/plugin-toolkit/scripts/build.sh @@ -5,12 +5,11 @@ _version() { VERSION=$(node -p "require('./package.json').version") NAME=$(node -p "require('./package.json').name") DESCRIPTION=$(node -p "require('./package.json').description") - sed -i.bak \ + sed -i \ -e "s|\0.\0.\0|$VERSION|" \ -e "s|LIB_NAME_PLACEHOLDER|$NAME|" \ -e "s|LIB_DESCRIPTION_PLACEHOLDER|$DESCRIPTION|" \ esm/__version.js esm/__version.d.ts - rm -f esm/*.bak } From 6f039e156bb704ccbe9ad8dc40bfd533f65be80c Mon Sep 17 00:00:00 2001 From: Petr Benes Date: Mon, 25 Nov 2024 08:52:22 +0100 Subject: [PATCH 2/3] fix: revert: adjust build scripts to be compatible with rush cache This reverts commit d9389b9e19597f1fea74c40cb027d629b5c31be0. risk: low --- libs/api-client-bear/src/__version.ts | 6 ------ libs/api-client-tiger/.gitignore | 2 ++ libs/api-client-tiger/scripts/build.sh | 16 ++++++---------- libs/api-client-tiger/src/__version.ts | 6 ------ libs/sdk-backend-bear/src/__version.ts | 6 ------ libs/sdk-backend-tiger/.gitignore | 3 +++ libs/sdk-backend-tiger/scripts/build.sh | 18 +++++++----------- libs/sdk-backend-tiger/src/__version.ts | 6 ------ libs/sdk-ui-dashboard/.gitignore | 2 ++ libs/sdk-ui-dashboard/scripts/build.sh | 23 ++++++++--------------- libs/sdk-ui-dashboard/src/__version.ts | 6 ------ libs/sdk-ui-gen-ai/.gitignore | 2 ++ tools/app-toolkit/.gitignore | 1 + tools/app-toolkit/scripts/build.sh | 17 +++++------------ tools/app-toolkit/src/__version.ts | 6 ------ tools/catalog-export/.gitignore | 2 ++ tools/catalog-export/scripts/build.sh | 17 +++++++---------- tools/catalog-export/src/__version.ts | 6 ------ tools/mock-handling/.gitignore | 2 ++ tools/mock-handling/scripts/build.sh | 17 +++++++---------- tools/mock-handling/src/__version.ts | 6 ------ tools/plugin-toolkit/.gitignore | 3 ++- tools/plugin-toolkit/scripts/build.sh | 17 +++++------------ tools/plugin-toolkit/src/__version.ts | 6 ------ 24 files changed, 61 insertions(+), 135 deletions(-) delete mode 100644 libs/api-client-bear/src/__version.ts create mode 100644 libs/api-client-tiger/.gitignore delete mode 100644 libs/api-client-tiger/src/__version.ts delete mode 100644 libs/sdk-backend-bear/src/__version.ts delete mode 100644 libs/sdk-backend-tiger/src/__version.ts delete mode 100644 libs/sdk-ui-dashboard/src/__version.ts delete mode 100644 tools/app-toolkit/src/__version.ts delete mode 100644 tools/catalog-export/src/__version.ts create mode 100644 tools/mock-handling/.gitignore delete mode 100644 tools/mock-handling/src/__version.ts delete mode 100644 tools/plugin-toolkit/src/__version.ts diff --git a/libs/api-client-bear/src/__version.ts b/libs/api-client-bear/src/__version.ts deleted file mode 100644 index 6a484d41b73..00000000000 --- a/libs/api-client-bear/src/__version.ts +++ /dev/null @@ -1,6 +0,0 @@ -// (C) 2021-2024 GoodData Corporation -// The placeholders in this file are replaced by values -// from package.json right after tsc build -export const LIB_VERSION = "0.0.0"; -export const LIB_NAME = "LIB_NAME_PLACEHOLDER"; -export const LIB_DESCRIPTION = "LIB_DESCRIPTION_PLACEHOLDER"; diff --git a/libs/api-client-tiger/.gitignore b/libs/api-client-tiger/.gitignore new file mode 100644 index 00000000000..c503a40a963 --- /dev/null +++ b/libs/api-client-tiger/.gitignore @@ -0,0 +1,2 @@ +# ignore the auxiliary file created during build to extract package version +src/__version.ts diff --git a/libs/api-client-tiger/scripts/build.sh b/libs/api-client-tiger/scripts/build.sh index 662a9c4c050..53158656f4a 100644 --- a/libs/api-client-tiger/scripts/build.sh +++ b/libs/api-client-tiger/scripts/build.sh @@ -2,23 +2,19 @@ set -e _version() { - VERSION=$(node -p "require('./package.json').version") - NAME=$(node -p "require('./package.json').name") - DESCRIPTION=$(node -p "require('./package.json').description") - sed -i \ - -e "s|\0.\0.\0|$VERSION|" \ - -e "s|LIB_NAME_PLACEHOLDER|$NAME|" \ - -e "s|LIB_DESCRIPTION_PLACEHOLDER|$DESCRIPTION|" \ - esm/__version.js esm/__version.d.ts + # prepare the auxiliary __version.ts file so that the code can read the package version as a constant + echo '// (C) 2021 GoodData Corporation' >src/__version.ts + echo '// DO NOT CHANGE THIS FILE, IT IS RE-GENERATED ON EVERY BUILD' >>src/__version.ts + node -p "'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';' +'\n\n' + 'export const LIB_NAME = ' + JSON.stringify(require('./package.json').name) + ';'" >>src/__version.ts } -_post-build() { +_common-build() { _version } build() { + _common-build tsc -p tsconfig.json - _post-build npm run api-extractor } diff --git a/libs/api-client-tiger/src/__version.ts b/libs/api-client-tiger/src/__version.ts deleted file mode 100644 index 6a484d41b73..00000000000 --- a/libs/api-client-tiger/src/__version.ts +++ /dev/null @@ -1,6 +0,0 @@ -// (C) 2021-2024 GoodData Corporation -// The placeholders in this file are replaced by values -// from package.json right after tsc build -export const LIB_VERSION = "0.0.0"; -export const LIB_NAME = "LIB_NAME_PLACEHOLDER"; -export const LIB_DESCRIPTION = "LIB_DESCRIPTION_PLACEHOLDER"; diff --git a/libs/sdk-backend-bear/src/__version.ts b/libs/sdk-backend-bear/src/__version.ts deleted file mode 100644 index 6a484d41b73..00000000000 --- a/libs/sdk-backend-bear/src/__version.ts +++ /dev/null @@ -1,6 +0,0 @@ -// (C) 2021-2024 GoodData Corporation -// The placeholders in this file are replaced by values -// from package.json right after tsc build -export const LIB_VERSION = "0.0.0"; -export const LIB_NAME = "LIB_NAME_PLACEHOLDER"; -export const LIB_DESCRIPTION = "LIB_DESCRIPTION_PLACEHOLDER"; diff --git a/libs/sdk-backend-tiger/.gitignore b/libs/sdk-backend-tiger/.gitignore index 81b576584cc..bdb042ccfa7 100644 --- a/libs/sdk-backend-tiger/.gitignore +++ b/libs/sdk-backend-tiger/.gitignore @@ -1,2 +1,5 @@ .wiremock_containerid .wiremock/ + +# ignore the auxiliary file created during build to extract package version +src/__version.ts \ No newline at end of file diff --git a/libs/sdk-backend-tiger/scripts/build.sh b/libs/sdk-backend-tiger/scripts/build.sh index 662a9c4c050..61c100bbd27 100644 --- a/libs/sdk-backend-tiger/scripts/build.sh +++ b/libs/sdk-backend-tiger/scripts/build.sh @@ -2,24 +2,20 @@ set -e _version() { - VERSION=$(node -p "require('./package.json').version") - NAME=$(node -p "require('./package.json').name") - DESCRIPTION=$(node -p "require('./package.json').description") - sed -i \ - -e "s|\0.\0.\0|$VERSION|" \ - -e "s|LIB_NAME_PLACEHOLDER|$NAME|" \ - -e "s|LIB_DESCRIPTION_PLACEHOLDER|$DESCRIPTION|" \ - esm/__version.js esm/__version.d.ts + # prepare the auxiliary __version.ts file so that the code can read the package version as a constant + echo '// (C) 2021 GoodData Corporation' >src/__version.ts + echo '// DO NOT CHANGE THIS FILE, IT IS RE-GENERATED ON EVERY BUILD' >>src/__version.ts + node -p "'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';' +'\n\n' + 'export const LIB_NAME = ' + JSON.stringify(require('./package.json').name) + ';'" >>src/__version.ts } -_post-build() { +_common-build() { _version } build() { + _common-build tsc -p tsconfig.json - _post-build npm run api-extractor } -build +build \ No newline at end of file diff --git a/libs/sdk-backend-tiger/src/__version.ts b/libs/sdk-backend-tiger/src/__version.ts deleted file mode 100644 index 6a484d41b73..00000000000 --- a/libs/sdk-backend-tiger/src/__version.ts +++ /dev/null @@ -1,6 +0,0 @@ -// (C) 2021-2024 GoodData Corporation -// The placeholders in this file are replaced by values -// from package.json right after tsc build -export const LIB_VERSION = "0.0.0"; -export const LIB_NAME = "LIB_NAME_PLACEHOLDER"; -export const LIB_DESCRIPTION = "LIB_DESCRIPTION_PLACEHOLDER"; diff --git a/libs/sdk-ui-dashboard/.gitignore b/libs/sdk-ui-dashboard/.gitignore index 6d8112d57d2..99fba5ab590 100644 --- a/libs/sdk-ui-dashboard/.gitignore +++ b/libs/sdk-ui-dashboard/.gitignore @@ -1,3 +1,5 @@ styles/css +# ignore the auxiliary file created during build to extract package version +src/__version.ts # ignore the NOTICE that gets copied here on publish, the source of truth is the root of the repo NOTICE diff --git a/libs/sdk-ui-dashboard/scripts/build.sh b/libs/sdk-ui-dashboard/scripts/build.sh index d970cb354ab..2deebd6314a 100644 --- a/libs/sdk-ui-dashboard/scripts/build.sh +++ b/libs/sdk-ui-dashboard/scripts/build.sh @@ -1,20 +1,11 @@ #!/usr/bin/env bash set -e - _version() { - VERSION=$(node -p "require('./package.json').version") - NAME=$(node -p "require('./package.json').name") - DESCRIPTION=$(node -p "require('./package.json').description") - sed -i \ - -e "s|\0.\0.\0|$VERSION|" \ - -e "s|LIB_NAME_PLACEHOLDER|$NAME|" \ - -e "s|LIB_DESCRIPTION_PLACEHOLDER|$DESCRIPTION|" \ - esm/__version.js esm/__version.d.ts -} - -_post-build() { - _version + # prepare the auxiliary __version.ts file so that the code can read the package version as a constant + echo '// (C) 2021 GoodData Corporation' >src/__version.ts + echo '// DO NOT CHANGE THIS FILE, IT IS RE-GENERATED ON EVERY BUILD' >>src/__version.ts + node -p "'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'" >>src/__version.ts } _build_styles() { @@ -31,14 +22,16 @@ _assets() { _common-build() { _assets + _build_styles + + _version } build() { _common-build tsc -p tsconfig.json - _post-build npm run api-extractor } -build +build \ No newline at end of file diff --git a/libs/sdk-ui-dashboard/src/__version.ts b/libs/sdk-ui-dashboard/src/__version.ts deleted file mode 100644 index 6a484d41b73..00000000000 --- a/libs/sdk-ui-dashboard/src/__version.ts +++ /dev/null @@ -1,6 +0,0 @@ -// (C) 2021-2024 GoodData Corporation -// The placeholders in this file are replaced by values -// from package.json right after tsc build -export const LIB_VERSION = "0.0.0"; -export const LIB_NAME = "LIB_NAME_PLACEHOLDER"; -export const LIB_DESCRIPTION = "LIB_DESCRIPTION_PLACEHOLDER"; diff --git a/libs/sdk-ui-gen-ai/.gitignore b/libs/sdk-ui-gen-ai/.gitignore index 6d8112d57d2..99fba5ab590 100644 --- a/libs/sdk-ui-gen-ai/.gitignore +++ b/libs/sdk-ui-gen-ai/.gitignore @@ -1,3 +1,5 @@ styles/css +# ignore the auxiliary file created during build to extract package version +src/__version.ts # ignore the NOTICE that gets copied here on publish, the source of truth is the root of the repo NOTICE diff --git a/tools/app-toolkit/.gitignore b/tools/app-toolkit/.gitignore index ea7373a3262..b616716aeb4 100644 --- a/tools/app-toolkit/.gitignore +++ b/tools/app-toolkit/.gitignore @@ -1,5 +1,6 @@ build test-plugin* +src/__version.ts # ignore the NOTICE that gets copied here on publish, the source of truth is the root of the repo NOTICE diff --git a/tools/app-toolkit/scripts/build.sh b/tools/app-toolkit/scripts/build.sh index 9d30927e7e6..48c9c5cf884 100644 --- a/tools/app-toolkit/scripts/build.sh +++ b/tools/app-toolkit/scripts/build.sh @@ -1,17 +1,12 @@ #!/usr/bin/env bash set -e +# prepare the auxiliary __version.ts file so that the code can read the package version as a constant +echo '// (C) 2021 GoodData Corporation' >src/__version.ts +echo '// DO NOT CHANGE THIS FILE, IT IS RE-GENERATED ON EVERY BUILD' >>src/__version.ts +node -p "'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';' +'\n\n' + 'export const LIB_DESCRIPTION =' + '\n ' + JSON.stringify(require('./package.json').description) + ';' +'\n\n' + 'export const LIB_NAME = ' + JSON.stringify(require('./package.json').name) + ';'" >>src/__version.ts -_version() { - VERSION=$(node -p "require('./package.json').version") - NAME=$(node -p "require('./package.json').name") - DESCRIPTION=$(node -p "require('./package.json').description") - sed -i \ - -e "s|\0.\0.\0|$VERSION|" \ - -e "s|LIB_NAME_PLACEHOLDER|$NAME|" \ - -e "s|LIB_DESCRIPTION_PLACEHOLDER|$DESCRIPTION|" \ - esm/__version.js esm/__version.d.ts -} +set -e PACKAGE_DIR="$(echo $(cd $(dirname $0)/.. && pwd -P))" DIST_DIR="${PACKAGE_DIR}/esm" @@ -20,7 +15,6 @@ PRETTIER_BIN="${PACKAGE_DIR}/node_modules/.bin/prettier" TSNODE_BIN="${PACKAGE_DIR}/node_modules/.bin/ts-node" PREPARE_PACKAGE_JSON="${TSNODE_BIN} --esm ${PACKAGE_DIR}/scripts/preparePackageJson.ts" - REACT_APP_TEMPLATE_DIR="${PACKAGE_DIR}/../react-app-template" JS_CONFIG_TEMPLATES="${REACT_APP_TEMPLATE_DIR}/configTemplates/js" TS_CONFIG_TEMPLATES="${REACT_APP_TEMPLATE_DIR}/configTemplates/ts" @@ -38,7 +32,6 @@ mkdir "${BUILD_DIR}" # first build main Application Development Toolkit assets tsc -p tsconfig.json -_version ####################################################################### # Build react-app-template for Typescript diff --git a/tools/app-toolkit/src/__version.ts b/tools/app-toolkit/src/__version.ts deleted file mode 100644 index 6a484d41b73..00000000000 --- a/tools/app-toolkit/src/__version.ts +++ /dev/null @@ -1,6 +0,0 @@ -// (C) 2021-2024 GoodData Corporation -// The placeholders in this file are replaced by values -// from package.json right after tsc build -export const LIB_VERSION = "0.0.0"; -export const LIB_NAME = "LIB_NAME_PLACEHOLDER"; -export const LIB_DESCRIPTION = "LIB_DESCRIPTION_PLACEHOLDER"; diff --git a/tools/catalog-export/.gitignore b/tools/catalog-export/.gitignore index 39d4861f398..96c372543ef 100644 --- a/tools/catalog-export/.gitignore +++ b/tools/catalog-export/.gitignore @@ -1,2 +1,4 @@ catalog*.ts catalog*.json +# ignore the auxiliary file created during build to extract package version +src/__version.ts \ No newline at end of file diff --git a/tools/catalog-export/scripts/build.sh b/tools/catalog-export/scripts/build.sh index 399b4479cca..de6e066bbef 100644 --- a/tools/catalog-export/scripts/build.sh +++ b/tools/catalog-export/scripts/build.sh @@ -2,23 +2,20 @@ set -e _version() { - VERSION=$(node -p "require('./package.json').version") - NAME=$(node -p "require('./package.json').name") - DESCRIPTION=$(node -p "require('./package.json').description") - sed -i \ - -e "s|\0.\0.\0|$VERSION|" \ - -e "s|LIB_NAME_PLACEHOLDER|$NAME|" \ - -e "s|LIB_DESCRIPTION_PLACEHOLDER|$DESCRIPTION|" \ - esm/__version.js esm/__version.d.ts + # prepare the auxiliary __version.ts file so that the code can read the package version as a constant + echo '// (C) 2021 GoodData Corporation' >src/__version.ts + echo '// DO NOT CHANGE THIS FILE, IT IS RE-GENERATED ON EVERY BUILD' >>src/__version.ts + node -p "'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';' +'\n\n' + 'export const LIB_DESCRIPTION = ' + JSON.stringify(require('./package.json').description) + ';' +'\n\n' + 'export const LIB_NAME = ' + JSON.stringify(require('./package.json').name) + ';'" >>src/__version.ts } -_post-build() { +_common-build() { _version } build() { + _common-build + tsc -p tsconfig.json - _post-build } build diff --git a/tools/catalog-export/src/__version.ts b/tools/catalog-export/src/__version.ts deleted file mode 100644 index 6a484d41b73..00000000000 --- a/tools/catalog-export/src/__version.ts +++ /dev/null @@ -1,6 +0,0 @@ -// (C) 2021-2024 GoodData Corporation -// The placeholders in this file are replaced by values -// from package.json right after tsc build -export const LIB_VERSION = "0.0.0"; -export const LIB_NAME = "LIB_NAME_PLACEHOLDER"; -export const LIB_DESCRIPTION = "LIB_DESCRIPTION_PLACEHOLDER"; diff --git a/tools/mock-handling/.gitignore b/tools/mock-handling/.gitignore new file mode 100644 index 00000000000..c503a40a963 --- /dev/null +++ b/tools/mock-handling/.gitignore @@ -0,0 +1,2 @@ +# ignore the auxiliary file created during build to extract package version +src/__version.ts diff --git a/tools/mock-handling/scripts/build.sh b/tools/mock-handling/scripts/build.sh index c4c36ab4492..387b4ccdcca 100644 --- a/tools/mock-handling/scripts/build.sh +++ b/tools/mock-handling/scripts/build.sh @@ -2,23 +2,20 @@ set -e _version() { - VERSION=$(node -p "require('./package.json').version") - NAME=$(node -p "require('./package.json').name") - DESCRIPTION=$(node -p "require('./package.json').description") - sed -i \ - -e "s|\0.\0.\0|$VERSION|" \ - -e "s|LIB_NAME_PLACEHOLDER|$NAME|" \ - -e "s|LIB_DESCRIPTION_PLACEHOLDER|$DESCRIPTION|" \ - esm/__version.js esm/__version.d.ts + # prepare the auxiliary __version.ts file so that the code can read the package version as a constant + echo '// (C) 2021 GoodData Corporation' >src/__version.ts + echo '// DO NOT CHANGE THIS FILE, IT IS RE-GENERATED ON EVERY BUILD' >>src/__version.ts + node -p "'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';' +'\n\n' + 'export const LIB_NAME = ' + JSON.stringify(require('./package.json').name) + ';'" >>src/__version.ts } -_post-build() { +_common-build() { _version } build() { + _common-build + tsc -p tsconfig.json - _post-build } build diff --git a/tools/mock-handling/src/__version.ts b/tools/mock-handling/src/__version.ts deleted file mode 100644 index 6a484d41b73..00000000000 --- a/tools/mock-handling/src/__version.ts +++ /dev/null @@ -1,6 +0,0 @@ -// (C) 2021-2024 GoodData Corporation -// The placeholders in this file are replaced by values -// from package.json right after tsc build -export const LIB_VERSION = "0.0.0"; -export const LIB_NAME = "LIB_NAME_PLACEHOLDER"; -export const LIB_DESCRIPTION = "LIB_DESCRIPTION_PLACEHOLDER"; diff --git a/tools/plugin-toolkit/.gitignore b/tools/plugin-toolkit/.gitignore index b260a0542ce..bde9b499a2f 100644 --- a/tools/plugin-toolkit/.gitignore +++ b/tools/plugin-toolkit/.gitignore @@ -1,4 +1,5 @@ build test-plugin* +src/__version.ts # ignore the NOTICE that gets copied here on publish, the source of truth is the root of the repo -NOTICE +NOTICE \ No newline at end of file diff --git a/tools/plugin-toolkit/scripts/build.sh b/tools/plugin-toolkit/scripts/build.sh index 83006def32c..7ed8264ef37 100644 --- a/tools/plugin-toolkit/scripts/build.sh +++ b/tools/plugin-toolkit/scripts/build.sh @@ -1,17 +1,12 @@ #!/usr/bin/env bash set -e -_version() { - VERSION=$(node -p "require('./package.json').version") - NAME=$(node -p "require('./package.json').name") - DESCRIPTION=$(node -p "require('./package.json').description") - sed -i \ - -e "s|\0.\0.\0|$VERSION|" \ - -e "s|LIB_NAME_PLACEHOLDER|$NAME|" \ - -e "s|LIB_DESCRIPTION_PLACEHOLDER|$DESCRIPTION|" \ - esm/__version.js esm/__version.d.ts -} +# prepare the auxiliary __version.ts file so that the code can read the package version as a constant +echo '// (C) 2021 GoodData Corporation' >src/__version.ts +echo '// DO NOT CHANGE THIS FILE, IT IS RE-GENERATED ON EVERY BUILD' >>src/__version.ts +node -p "'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';' +'\n\n' + 'export const LIB_DESCRIPTION = ' + JSON.stringify(require('./package.json').description) + ';' +'\n\n' + 'export const LIB_NAME = ' + JSON.stringify(require('./package.json').name) + ';'" >>src/__version.ts +set -e PACKAGE_DIR="$(echo $(cd $(dirname $0)/.. && pwd -P))" DIST_DIR="${PACKAGE_DIR}/esm" @@ -20,7 +15,6 @@ PRETTIER_BIN="${PACKAGE_DIR}/node_modules/.bin/prettier" TSNODE_BIN="${PACKAGE_DIR}/node_modules/.bin/ts-node" PREPARE_PACKAGE_JSON="${TSNODE_BIN} --esm ${PACKAGE_DIR}/scripts/preparePackageJson.ts" - DASHBOARD_PLUGIN_TEMPLATE_DIR="${PACKAGE_DIR}/../dashboard-plugin-template" JS_CONFIG_TEMPLATES="${DASHBOARD_PLUGIN_TEMPLATE_DIR}/configTemplates/js/*" JS_CONFIG_TEMPLATES_DOT="${DASHBOARD_PLUGIN_TEMPLATE_DIR}/configTemplates/js/.[^.]*" @@ -40,7 +34,6 @@ mkdir "${BUILD_DIR}" # first build main Plugin Development Toolkit assets tsc -p tsconfig.json -_version ####################################################################### # Build dashboard-plugin-template for Typescript diff --git a/tools/plugin-toolkit/src/__version.ts b/tools/plugin-toolkit/src/__version.ts deleted file mode 100644 index 6a484d41b73..00000000000 --- a/tools/plugin-toolkit/src/__version.ts +++ /dev/null @@ -1,6 +0,0 @@ -// (C) 2021-2024 GoodData Corporation -// The placeholders in this file are replaced by values -// from package.json right after tsc build -export const LIB_VERSION = "0.0.0"; -export const LIB_NAME = "LIB_NAME_PLACEHOLDER"; -export const LIB_DESCRIPTION = "LIB_DESCRIPTION_PLACEHOLDER"; From c60c9b1d3cad773afc2d8af0a8be670b7badd30e Mon Sep 17 00:00:00 2001 From: Petr Benes Date: Mon, 25 Nov 2024 08:55:53 +0100 Subject: [PATCH 3/3] fix: temporarily disable rush build cache to work now it would work with previous versoin which generated the version on the fly in the prebuild risk: low JIRA: STL-952 --- .github/actions/rush/set-up-rush/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/rush/set-up-rush/action.yml b/.github/actions/rush/set-up-rush/action.yml index 3e1d5c4d458..ce94c9a94d1 100644 --- a/.github/actions/rush/set-up-rush/action.yml +++ b/.github/actions/rush/set-up-rush/action.yml @@ -32,7 +32,7 @@ runs: shell: bash - name: Enable rush build cache via environment variable - run: echo "RUSH_BUILD_CACHE_ENABLED=1" >> $GITHUB_ENV + run: echo "RUSH_BUILD_CACHE_ENABLED=0" >> $GITHUB_ENV shell: bash # Restore cache for global rush installation