From 66b0647e9996c81994e3c1a389842ed2ff53f2fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=91=A8=F0=9F=8F=BC=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier-Muller?= Date: Wed, 28 Aug 2019 22:00:53 +0200 Subject: [PATCH 1/2] fix(init-templates): remove dependency on @types/node That was not required anymore since we no longer require passing the command line arguments to the `app.run()` call. This dependency has the potential of causing collisions with the ES libraries included by the TypeScript compiler, and specifying a correct version can be a delicate exercise, especially as those templates have to keep working in the future. Additionally, pinned the TypeScript compiler version to the current minor, as recommended by the TypeScript maintainers (TypeScript does not honor SemVer, but guarantees no breaking change between stable releases, which they indicate by issuing a new major version). Fixes #3839 --- .../app/javascript/bin/%name%.template.js | 2 -- .../app/javascript/package.template.json | 7 +---- .../app/javascript/tsconfig.json | 28 ------------------- .../app/typescript/package.template.json | 5 ++-- .../lib/typescript/package.template.json | 7 ++--- .../typescript/package.template.json | 5 ++-- 6 files changed, 7 insertions(+), 47 deletions(-) delete mode 100644 packages/aws-cdk/lib/init-templates/app/javascript/tsconfig.json diff --git a/packages/aws-cdk/lib/init-templates/app/javascript/bin/%name%.template.js b/packages/aws-cdk/lib/init-templates/app/javascript/bin/%name%.template.js index af77e06727f15..7ef6ca7df55c0 100644 --- a/packages/aws-cdk/lib/init-templates/app/javascript/bin/%name%.template.js +++ b/packages/aws-cdk/lib/init-templates/app/javascript/bin/%name%.template.js @@ -1,7 +1,5 @@ #!/usr/bin/env node -// @ts-ignore: Cannot find declaration file -require('source-map-support/register'); const cdk = require('@aws-cdk/core'); const { %name.PascalCased%Stack } = require('../lib/%name%-stack'); diff --git a/packages/aws-cdk/lib/init-templates/app/javascript/package.template.json b/packages/aws-cdk/lib/init-templates/app/javascript/package.template.json index e34d0a281878f..54cd150a7efc2 100644 --- a/packages/aws-cdk/lib/init-templates/app/javascript/package.template.json +++ b/packages/aws-cdk/lib/init-templates/app/javascript/package.template.json @@ -5,17 +5,12 @@ "%name%": "bin/%name%.js" }, "scripts": { - "test": "tsc", - "test:watch": "tsc -w", "cdk": "cdk" }, "devDependencies": { - "@types/node": "8.10.45", - "typescript": "^3.3.3333", "aws-cdk": "^%cdk-version%" }, "dependencies": { - "@aws-cdk/core": "^%cdk-version%", - "source-map-support": "^0.5.9" + "@aws-cdk/core": "^%cdk-version%" } } diff --git a/packages/aws-cdk/lib/init-templates/app/javascript/tsconfig.json b/packages/aws-cdk/lib/init-templates/app/javascript/tsconfig.json deleted file mode 100644 index 45b40c310fd62..0000000000000 --- a/packages/aws-cdk/lib/init-templates/app/javascript/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2018", - "module": "commonjs", - "lib": [ - "es2016", - "es2017.object", - "es2017.string" - ], - "declaration": true, - "strict": true, - "noImplicitAny": true, - "strictNullChecks": true, - "noImplicitThis": true, - "alwaysStrict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": false, - "inlineSourceMap": true, - "inlineSources": true, - "experimentalDecorators": true, - "strictPropertyInitialization": false, - "allowJs": true, - "checkJs": true, - "noEmit": true - } -} diff --git a/packages/aws-cdk/lib/init-templates/app/typescript/package.template.json b/packages/aws-cdk/lib/init-templates/app/typescript/package.template.json index b85fb951b5228..6f10274b247d5 100644 --- a/packages/aws-cdk/lib/init-templates/app/typescript/package.template.json +++ b/packages/aws-cdk/lib/init-templates/app/typescript/package.template.json @@ -10,10 +10,9 @@ "cdk": "cdk" }, "devDependencies": { - "@types/node": "8.10.45", - "typescript": "^3.3.3333", + "aws-cdk": "^%cdk-version%", "ts-node": "^8.1.0", - "aws-cdk": "^%cdk-version%" + "typescript": "~3.5.2" }, "dependencies": { "@aws-cdk/core": "^%cdk-version%", diff --git a/packages/aws-cdk/lib/init-templates/lib/typescript/package.template.json b/packages/aws-cdk/lib/init-templates/lib/typescript/package.template.json index 7d540375c6ea9..2dec31b1e3e4d 100644 --- a/packages/aws-cdk/lib/init-templates/lib/typescript/package.template.json +++ b/packages/aws-cdk/lib/init-templates/lib/typescript/package.template.json @@ -5,13 +5,10 @@ "types": "lib/index.d.ts", "scripts": { "build": "tsc", - "watch": "tsc -w", - "test": "nodeunit test/test.*.js" + "watch": "tsc -w" }, "devDependencies": { - "@types/nodeunit": "^0.0.30", - "nodeunit": "^0.11.2", - "typescript": "^3.3.3333" + "typescript": "~3.5.2" }, "peerDependencies": { "@aws-cdk/core": "^%cdk-version%" diff --git a/packages/aws-cdk/lib/init-templates/sample-app/typescript/package.template.json b/packages/aws-cdk/lib/init-templates/sample-app/typescript/package.template.json index dce1fdadd186a..fd513635f6d10 100644 --- a/packages/aws-cdk/lib/init-templates/sample-app/typescript/package.template.json +++ b/packages/aws-cdk/lib/init-templates/sample-app/typescript/package.template.json @@ -10,10 +10,9 @@ "cdk": "cdk" }, "devDependencies": { - "@types/node": "8.10.45", - "typescript": "^3.3.3333", + "aws-cdk": "^%cdk-version%", "ts-node": "^8.1.0", - "aws-cdk": "^%cdk-version%" + "typescript": "~3.5.2" }, "dependencies": { "@aws-cdk/aws-sns": "^%cdk-version%", From 03eb26a282719097a70e401867759c63170f319e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=91=A8=F0=9F=8F=BC=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier-Muller?= Date: Wed, 28 Aug 2019 22:11:34 +0200 Subject: [PATCH 2/2] also pin typescript compiler version to current minor --- package-lock.json | 2 +- package.json | 2 +- .../lib/init-templates/app/typescript/package.template.json | 2 +- .../lib/init-templates/lib/typescript/package.template.json | 2 +- .../init-templates/sample-app/typescript/package.template.json | 2 +- packages/decdk/package-lock.json | 2 +- tools/awslint/package.json | 2 +- tools/cdk-build-tools/package-lock.json | 2 +- tools/cdk-build-tools/package.json | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 218c36dfb8662..a529e3d480836 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6650,7 +6650,7 @@ "jsii-reflect": "^0.15.1", "jsii-spec": "^0.15.1", "log4js": "^5.0.0", - "typescript": "^3.5.3", + "typescript": "~3.5.3", "yargs": "^13.3.0" }, "dependencies": { diff --git a/package.json b/package.json index e2896b7395098..df874a857488b 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "nyc": "^14.1.1", "ts-jest": "^24.0.2", "tslint": "^5.19.0", - "typescript": "^3.5.3" + "typescript": "~3.5.3" }, "repository": { "type": "git", diff --git a/packages/aws-cdk/lib/init-templates/app/typescript/package.template.json b/packages/aws-cdk/lib/init-templates/app/typescript/package.template.json index 6f10274b247d5..d54f98609d874 100644 --- a/packages/aws-cdk/lib/init-templates/app/typescript/package.template.json +++ b/packages/aws-cdk/lib/init-templates/app/typescript/package.template.json @@ -12,7 +12,7 @@ "devDependencies": { "aws-cdk": "^%cdk-version%", "ts-node": "^8.1.0", - "typescript": "~3.5.2" + "typescript": "~3.5.3" }, "dependencies": { "@aws-cdk/core": "^%cdk-version%", diff --git a/packages/aws-cdk/lib/init-templates/lib/typescript/package.template.json b/packages/aws-cdk/lib/init-templates/lib/typescript/package.template.json index 2dec31b1e3e4d..fe48cfdc9cced 100644 --- a/packages/aws-cdk/lib/init-templates/lib/typescript/package.template.json +++ b/packages/aws-cdk/lib/init-templates/lib/typescript/package.template.json @@ -8,7 +8,7 @@ "watch": "tsc -w" }, "devDependencies": { - "typescript": "~3.5.2" + "typescript": "~3.5.3" }, "peerDependencies": { "@aws-cdk/core": "^%cdk-version%" diff --git a/packages/aws-cdk/lib/init-templates/sample-app/typescript/package.template.json b/packages/aws-cdk/lib/init-templates/sample-app/typescript/package.template.json index fd513635f6d10..13c3c179d596f 100644 --- a/packages/aws-cdk/lib/init-templates/sample-app/typescript/package.template.json +++ b/packages/aws-cdk/lib/init-templates/sample-app/typescript/package.template.json @@ -12,7 +12,7 @@ "devDependencies": { "aws-cdk": "^%cdk-version%", "ts-node": "^8.1.0", - "typescript": "~3.5.2" + "typescript": "~3.5.3" }, "dependencies": { "@aws-cdk/aws-sns": "^%cdk-version%", diff --git a/packages/decdk/package-lock.json b/packages/decdk/package-lock.json index d681e13a49dcf..99d8928166056 100644 --- a/packages/decdk/package-lock.json +++ b/packages/decdk/package-lock.json @@ -3176,7 +3176,7 @@ "semver": "^6.3.0", "sort-json": "^2.0.0", "spdx-license-list": "^6.1.0", - "typescript": "^3.5.3", + "typescript": "~3.5.3", "yargs": "^13.3.0" }, "dependencies": { diff --git a/tools/awslint/package.json b/tools/awslint/package.json index 42871671356cd..837c9805c30e5 100644 --- a/tools/awslint/package.json +++ b/tools/awslint/package.json @@ -28,7 +28,7 @@ "@types/fs-extra": "^8.0.0", "@types/yargs": "^13.0.2", "tslint": "^5.18.0", - "typescript": "^3.5.3" + "typescript": "~3.5.3" }, "repository": { "type": "git", diff --git a/tools/cdk-build-tools/package-lock.json b/tools/cdk-build-tools/package-lock.json index ebbbb2af7be1f..47490b3078a31 100644 --- a/tools/cdk-build-tools/package-lock.json +++ b/tools/cdk-build-tools/package-lock.json @@ -3106,7 +3106,7 @@ "semver": "^6.3.0", "sort-json": "^2.0.0", "spdx-license-list": "^6.1.0", - "typescript": "^3.5.3", + "typescript": "~3.5.3", "yargs": "^13.3.0" }, "dependencies": { diff --git a/tools/cdk-build-tools/package.json b/tools/cdk-build-tools/package.json index a4d9f5d2acaf5..02c71f9d8797a 100644 --- a/tools/cdk-build-tools/package.json +++ b/tools/cdk-build-tools/package.json @@ -46,7 +46,7 @@ "nyc": "^14.1.1", "ts-jest": "^24.0.2", "tslint": "^5.18.0", - "typescript": "^3.5.3", + "typescript": "~3.5.3", "yargs": "^13.3.0" }, "keywords": [