From cab8258f828cc59a1adae71b2e85105e2cae0e6e Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Tue, 20 Nov 2018 10:22:56 +0100 Subject: [PATCH] fix(cdk init): fix 'lib' init template The init template used 'QueueArn' but that no long exists. Add integ test. Fixes #1214. --- .../aws-cdk/integ-tests/test-init-template.sh | 7 +++ .../lib/typescript/lib/index.template.ts | 2 +- .../lib/typescript/package.template.json | 44 +++++++++---------- .../lib/typescript/tsconfig.json | 38 ++++++++-------- 4 files changed, 49 insertions(+), 42 deletions(-) diff --git a/packages/aws-cdk/integ-tests/test-init-template.sh b/packages/aws-cdk/integ-tests/test-init-template.sh index 58e5ff562687a..a17bad0b3ce29 100755 --- a/packages/aws-cdk/integ-tests/test-init-template.sh +++ b/packages/aws-cdk/integ-tests/test-init-template.sh @@ -20,5 +20,12 @@ cdk init sample-app -l typescript npm run build cdk synth +rm -rf /tmp/cdk-integ-test +mkdir -p /tmp/cdk-integ-test +cd /tmp/cdk-integ-test + +cdk init lib -l typescript +npm run build + echo "✅ success" diff --git a/packages/aws-cdk/lib/init-templates/lib/typescript/lib/index.template.ts b/packages/aws-cdk/lib/init-templates/lib/typescript/lib/index.template.ts index e1eb924b6bdfe..f89e1abfa2343 100644 --- a/packages/aws-cdk/lib/init-templates/lib/typescript/lib/index.template.ts +++ b/packages/aws-cdk/lib/init-templates/lib/typescript/lib/index.template.ts @@ -13,7 +13,7 @@ export interface %name.PascalCased%Props { export class %name.PascalCased% extends cdk.Construct { /** @returns the ARN of the SQS queue */ - public readonly queueArn: sqs.QueueArn; + public readonly queueArn: string; constructor(parent: cdk.Construct, name: string, props: %name.PascalCased%Props = {}) { super(parent, name); 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 ca54d9905f023..bea17a1fe3e2e 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 @@ -1,24 +1,24 @@ { - "name": "%name%", - "version": "0.1.0", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "scripts": { - "prepare": "tsc", - "watch": "tsc -w", - "test": "nodeunit test/test.*.js" - }, - "devDependencies": { - "@types/nodeunit": "^0.0.30", - "nodeunit": "^0.11.2", - "typescript": "^3.1.2" - }, - "peerDependencies": { - "@aws-cdk/cdk": "^%cdk-version%" - }, - "dependencies": { - "@aws-cdk/aws-sns": "^%cdk-version%", - "@aws-cdk/aws-sqs": "^%cdk-version%", - "@aws-cdk/cdk": "^%cdk-version%" - } + "name": "%name%", + "version": "0.1.0", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "scripts": { + "build": "tsc", + "watch": "tsc -w", + "test": "nodeunit test/test.*.js" + }, + "devDependencies": { + "@types/nodeunit": "^0.0.30", + "nodeunit": "^0.11.2", + "typescript": "^3.1.2" + }, + "peerDependencies": { + "@aws-cdk/cdk": "^%cdk-version%" + }, + "dependencies": { + "@aws-cdk/aws-sns": "^%cdk-version%", + "@aws-cdk/aws-sqs": "^%cdk-version%", + "@aws-cdk/cdk": "^%cdk-version%" + } } diff --git a/packages/aws-cdk/lib/init-templates/lib/typescript/tsconfig.json b/packages/aws-cdk/lib/init-templates/lib/typescript/tsconfig.json index 86197fd793270..5aeac13cd6ea6 100644 --- a/packages/aws-cdk/lib/init-templates/lib/typescript/tsconfig.json +++ b/packages/aws-cdk/lib/init-templates/lib/typescript/tsconfig.json @@ -1,22 +1,22 @@ { - "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 - } + "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 + } }