Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cdk init): update 'app' init template #1209

Merged
merged 4 commits into from
Nov 20, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
#!/usr/bin/env node
import sns = require('@aws-cdk/aws-sns');
import sqs = require('@aws-cdk/aws-sqs');
import cdk = require('@aws-cdk/cdk');

class %name.PascalCased%Stack extends cdk.Stack {
constructor(parent: cdk.App, name: string, props?: cdk.StackProps) {
super(parent, name, props);

const queue = new sqs.Queue(this, '%name.PascalCased%Queue', {
visibilityTimeoutSec: 300
});

const topic = new sns.Topic(this, '%name.PascalCased%Topic');

topic.subscribeQueue(queue);
}
}
import { %name.PascalCased%Stack } from '../lib/%name%-stack';

const app = new cdk.App();

new %name.PascalCased%Stack(app, '%name.PascalCased%Stack');

app.run();
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"app": "node bin/%name%.js"
"app": "node bin/%name%.js"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import cdk = require('@aws-cdk/cdk');

export class %name.PascalCased%Stack extends cdk.Stack {
constructor(parent: cdk.App, name: string, props?: cdk.StackProps) {
super(parent, name, props);

// The code that defines your stack goes here
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
{
"name": "%name%",
"version": "0.1.0",
"main": "bin/index.js",
"types": "bin/index.d.ts",
"bin": {
"%name%": "bin/%name%.js"
},
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"cdk": "cdk"
},
"devDependencies": {
"@types/node": "^8.9.4",
"typescript": "^3.1.2",
"aws-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",
"bin": {
"%name%": "bin/%name%.js"
},
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"cdk": "cdk"
},
"devDependencies": {
"@types/node": "^8.9.4",
"typescript": "^3.1.2",
"aws-cdk": "^%cdk-version%"
},
"dependencies": {
"@aws-cdk/cdk": "^%cdk-version%"
}
eladb marked this conversation as resolved.
Show resolved Hide resolved
}
39 changes: 19 additions & 20 deletions packages/aws-cdk/lib/init-templates/app/typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
{
"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
}
}

4 changes: 4 additions & 0 deletions packages/aws-cdk/lib/init-templates/sample-app/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"description": "Example CDK Application with some constructs",
"aliases": ["sample", "example"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.js
*.d.ts
node_modules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.ts
!*.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Useful commands

* `npm run build` compile typescript to js
* `npm run watch` watch for changes and compile
* `cdk deploy` deploy this stack to your default AWS account/region
* `cdk diff` compare deployed stack with current state
* `cdk synth` emits the synthesized CloudFormation template
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env node
import cdk = require('@aws-cdk/cdk');
import { %name.PascalCased%Stack } from '../lib/%name%-stack';

const app = new cdk.App();
new %name.PascalCased%Stack(app, '%name.PascalCased%Stack');
app.run();
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"app": "node bin/%name%.js"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import sns = require('@aws-cdk/aws-sns');
import sqs = require('@aws-cdk/aws-sqs');
import cdk = require('@aws-cdk/cdk');

export class %name.PascalCased%Stack extends cdk.Stack {
constructor(parent: cdk.App, name: string, props?: cdk.StackProps) {
super(parent, name, props);

const queue = new sqs.Queue(this, '%name.PascalCased%Queue', {
visibilityTimeoutSec: 300
});

const topic = new sns.Topic(this, '%name.PascalCased%Topic');

topic.subscribeQueue(queue);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "%name%",
"version": "0.1.0",
"bin": {
"%name%": "bin/%name%.js"
},
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"cdk": "cdk"
},
"devDependencies": {
"@types/node": "^8.9.4",
"typescript": "^3.1.2",
"aws-cdk": "^%cdk-version%"
},
"dependencies": {
"@aws-cdk/aws-sns": "^%cdk-version%",
"@aws-cdk/aws-sqs": "^%cdk-version%",
"@aws-cdk/cdk": "^%cdk-version%"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"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
}
}