Skip to content

Commit

Permalink
chore(cli): make the typescript version compat task compatible with n…
Browse files Browse the repository at this point in the history
…pm v6 (#23374)

Current script breaks with when npm v6 is installed due to the use of `npm pkg` command which was introduced in npm v7. However npm v6 is still the default version for Node.js <=14.

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Construct Runtime Dependencies:

* [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
mrgrain committed Dec 16, 2022
1 parent 9fd3811 commit 810d736
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/aws-cdk/test/integ/init/test-typescript-versions.sh
Expand Up @@ -15,15 +15,22 @@ MIN_SUPPORTED_TS_VERSION=${1:-"3.9"}
SUPPORTED_TS_VERSIONS=$(node ${integdir}/typescript-versions.js ${MIN_SUPPORTED_TS_VERSION})

for version in $SUPPORTED_TS_VERSIONS; do
echo "Testing against TypeScript v$version"
header TypeScript v$version

setup

set -x
node --version
npm --version

cdk init -l typescript sample-app --generate-only
npm pkg delete devDependencies
sed '/\"devDependencies\"/,/}/ d; /^$/d' package.json > package.json.new && rm package.json && mv package.json.new package.json
npm install --save-dev typescript@$version
npm install # Older versions of npm require this to be a separate step from the one above
npm prune && npm ls
rm test/*
npm run build
cdk synth

set +x
done

0 comments on commit 810d736

Please sign in to comment.