Skip to content

Commit 67960f8

Browse files
engineforcerix0rrr
authored andcommitted
feat(cli): add javascript init-templates 'sample-app' (#2535)
1 parent 584579e commit 67960f8

File tree

10 files changed

+95
-3
lines changed

10 files changed

+95
-3
lines changed

packages/aws-cdk/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
*.js
22
*.js.map
33
*.d.ts
4-
!lib/init-templates/app/javascript/**/*
4+
!lib/init-templates/**/javascript/**/*
55
node_modules
66
dist
77

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Useful commands
22

3-
* `npm run test` check javascript error
4-
* `npm run test:watch` watch for changes and check javascript error
3+
* `npm run test` check javascript error using the typescript compiler
4+
* `npm run test:watch` watch for changes and check javascript error using the typescript compiler
55
* `cdk deploy` deploy this stack to your default AWS account/region
66
* `cdk diff` compare deployed stack with current state
77
* `cdk synth` emits the synthesized CloudFormation template
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
3+
# CDK asset staging directory
4+
.cdk.staging
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# CDK asset staging directory
2+
.cdk.staging
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Useful commands
2+
3+
* `npm run test` check javascript error using the typescript compiler
4+
* `npm run test:watch` watch for changes and check javascript error using the typescript compiler
5+
* `cdk deploy` deploy this stack to your default AWS account/region
6+
* `cdk diff` compare deployed stack with current state
7+
* `cdk synth` emits the synthesized CloudFormation template
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env node
2+
const cdk = require('@aws-cdk/cdk');
3+
const { %name.PascalCased%Stack } = require('../lib/%name%-stack');
4+
5+
const app = new cdk.App();
6+
new %name.PascalCased%Stack(app, '%name.PascalCased%Stack');
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"app": "node bin/%name%.js"
3+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const sns = require('@aws-cdk/aws-sns');
2+
const sqs = require('@aws-cdk/aws-sqs');
3+
const cdk = require('@aws-cdk/cdk');
4+
5+
class %name.PascalCased%Stack extends cdk.Stack {
6+
/**
7+
* @param {cdk.App} scope
8+
* @param {string} id
9+
* @param {cdk.StackProps=} props
10+
*/
11+
constructor(scope, id, props) {
12+
super(scope, id, props);
13+
14+
const queue = new sqs.Queue(this, '%name.PascalCased%Queue', {
15+
visibilityTimeoutSec: 300
16+
});
17+
18+
const topic = new sns.Topic(this, '%name.PascalCased%Topic');
19+
20+
topic.subscribeQueue(queue);
21+
}
22+
}
23+
24+
module.exports = { %name.PascalCased%Stack }
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "%name%",
3+
"version": "0.1.0",
4+
"bin": {
5+
"%name%": "bin/%name%.js"
6+
},
7+
"scripts": {
8+
"test": "tsc",
9+
"test:watch": "tsc -w",
10+
"cdk": "cdk"
11+
},
12+
"devDependencies": {
13+
"@types/node": "8.10.45",
14+
"typescript": "^3.3.3333",
15+
"aws-cdk": "^%cdk-version%"
16+
},
17+
"dependencies": {
18+
"@aws-cdk/aws-sns": "^%cdk-version%",
19+
"@aws-cdk/aws-sqs": "^%cdk-version%",
20+
"@aws-cdk/cdk": "^%cdk-version%"
21+
}
22+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"compilerOptions": {
3+
"target":"ES2018",
4+
"module": "commonjs",
5+
"lib": ["es2016", "es2017.object", "es2017.string"],
6+
"declaration": true,
7+
"strict": true,
8+
"noImplicitAny": true,
9+
"strictNullChecks": true,
10+
"noImplicitThis": true,
11+
"alwaysStrict": true,
12+
"noUnusedLocals": true,
13+
"noUnusedParameters": true,
14+
"noImplicitReturns": true,
15+
"noFallthroughCasesInSwitch": false,
16+
"inlineSourceMap": true,
17+
"inlineSources": true,
18+
"experimentalDecorators": true,
19+
"strictPropertyInitialization":false,
20+
"allowJs": true,
21+
"checkJs": true,
22+
"noEmit": true
23+
}
24+
}

0 commit comments

Comments
 (0)