-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(cli): integ test current version against all supported versions…
… of TS
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
packages/aws-cdk/test/integ/init/test-typescript-versions.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
#------------------------------------------------------------------ | ||
# setup | ||
#------------------------------------------------------------------ | ||
set -eu | ||
scriptdir=$(cd $(dirname $0) && pwd) | ||
integdir=$(dirname $scriptdir) | ||
source ${scriptdir}/common.bash | ||
|
||
header TypeScript Versions | ||
|
||
#------------------------------------------------------------------ | ||
|
||
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" | ||
|
||
setup | ||
|
||
cdk init -l typescript sample-app --generate-only | ||
npm pkg delete devDependencies | ||
npm install --save-dev typescript@$version | ||
npm prune && npm ls | ||
rm test/* | ||
npm run build | ||
cdk synth | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { spawnSync } from 'child_process'; | ||
|
||
const minSupportedVersion = process.argv.slice(2, 3); | ||
|
||
const { stdout } = spawnSync('npm', ['--silent', 'view', `typescript@>=${minSupportedVersion}`, 'version', '--json']); | ||
|
||
const versions: string[] = JSON.parse(stdout); | ||
const minorVersions = Array.from(new Set(versions.map(v => v.split('.').slice(0, 2).join('.')))); | ||
|
||
process.stdout.write(minorVersions.join(' ')); |