From 6649126acedaf55e802654916f80ba90c437a67b Mon Sep 17 00:00:00 2001 From: Phani Srikar Edupuganti <55896475+phani-srikar@users.noreply.github.com> Date: Wed, 22 May 2024 09:36:42 -0700 Subject: [PATCH] chore: fix postinstall failure for windows (#2572) * chore: fix postinstall failure for windows * chore: linting fix --- .github/ISSUE_TEMPLATE/1.gen2_bug_report.yaml | 1 - package.json | 3 +-- .../{postinstall.sh => create-private-package-manifest.sh} | 6 ++++++ shared-scripts.sh | 3 +++ 4 files changed, 10 insertions(+), 3 deletions(-) rename scripts/{postinstall.sh => create-private-package-manifest.sh} (60%) diff --git a/.github/ISSUE_TEMPLATE/1.gen2_bug_report.yaml b/.github/ISSUE_TEMPLATE/1.gen2_bug_report.yaml index adeb7020c9..43e24f2097 100644 --- a/.github/ISSUE_TEMPLATE/1.gen2_bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/1.gen2_bug_report.yaml @@ -40,4 +40,3 @@ body: Please include any code snippets or screenshots that you think would be helpful! validations: required: true - diff --git a/package.json b/package.json index 68adf62c2e..523cd777f1 100644 --- a/package.json +++ b/package.json @@ -66,8 +66,7 @@ "verify-yarn-lock": "./scripts/verify-yarn-lock.sh", "view-test-artifact": "./scripts/view-test-artifacts.sh", "view-test-artifacts": "yarn authenticate-e2e-profile && yarn ts-node --project ./scripts/tsconfig.json ./scripts/view-test-artifacts.ts", - "yarn-use-bash": "yarn config set script-shell /bin/bash", - "postinstall": "./scripts/postinstall.sh" + "yarn-use-bash": "yarn config set script-shell /bin/bash" }, "bugs": { "url": "https://github.com/aws-amplify/amplify-category-api/issues" diff --git a/scripts/postinstall.sh b/scripts/create-private-package-manifest.sh similarity index 60% rename from scripts/postinstall.sh rename to scripts/create-private-package-manifest.sh index c779511300..65fa57533f 100755 --- a/scripts/postinstall.sh +++ b/scripts/create-private-package-manifest.sh @@ -1,5 +1,11 @@ #!/bin/bash +# set exit on error to true +set -e + +# create a new file to store the private packages +# this will be imported and used in the Git Client to determine the packages to deprecate + echo 'export default [' > scripts/components/private_packages.ts grep -l packages/*/package.json -e '"private": "\?true"\?' | xargs cat | jq .name | tr -s '\n' ',' >> scripts/components/private_packages.ts echo '];' >> scripts/components/private_packages.ts diff --git a/shared-scripts.sh b/shared-scripts.sh index 3b8823ccf6..5160eb875b 100755 --- a/shared-scripts.sh +++ b/shared-scripts.sh @@ -462,6 +462,9 @@ function _deploy { function _deprecate { loadCacheFromBuildJob echo "Deprecate" + + echo "creating private package manifest" + ./scripts/create-private-package-manifest.sh echo "Authenticate with NPM" if [ "$USE_NPM_REGISTRY" == "true" ]; then PUBLISH_TOKEN=$(echo "$NPM_PUBLISH_TOKEN" | jq -r '.token')