-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): add javascript init-templates 'sample-app' (#2535)
- Loading branch information
1 parent
584579e
commit 67960f8
Showing
10 changed files
with
95 additions
and
3 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Useful commands | ||
|
||
* `npm run test` check javascript error | ||
* `npm run test:watch` watch for changes and check javascript error | ||
* `npm run test` check javascript error using the typescript compiler | ||
* `npm run test:watch` watch for changes and check javascript error using the typescript compiler | ||
* `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 |
4 changes: 4 additions & 0 deletions
4
packages/aws-cdk/lib/init-templates/sample-app/javascript/.template.gitignore
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,4 @@ | ||
node_modules | ||
|
||
# CDK asset staging directory | ||
.cdk.staging |
2 changes: 2 additions & 0 deletions
2
packages/aws-cdk/lib/init-templates/sample-app/javascript/.template.npmignore
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,2 @@ | ||
# CDK asset staging directory | ||
.cdk.staging |
7 changes: 7 additions & 0 deletions
7
packages/aws-cdk/lib/init-templates/sample-app/javascript/README.md
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,7 @@ | ||
# Useful commands | ||
|
||
* `npm run test` check javascript error using the typescript compiler | ||
* `npm run test:watch` watch for changes and check javascript error using the typescript compiler | ||
* `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 |
6 changes: 6 additions & 0 deletions
6
packages/aws-cdk/lib/init-templates/sample-app/javascript/bin/%name%.template.js
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,6 @@ | ||
#!/usr/bin/env node | ||
const cdk = require('@aws-cdk/cdk'); | ||
const { %name.PascalCased%Stack } = require('../lib/%name%-stack'); | ||
|
||
const app = new cdk.App(); | ||
new %name.PascalCased%Stack(app, '%name.PascalCased%Stack'); |
3 changes: 3 additions & 0 deletions
3
packages/aws-cdk/lib/init-templates/sample-app/javascript/cdk.template.json
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,3 @@ | ||
{ | ||
"app": "node bin/%name%.js" | ||
} |
24 changes: 24 additions & 0 deletions
24
packages/aws-cdk/lib/init-templates/sample-app/javascript/lib/%name%-stack.template.js
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,24 @@ | ||
const sns = require('@aws-cdk/aws-sns'); | ||
const sqs = require('@aws-cdk/aws-sqs'); | ||
const cdk = require('@aws-cdk/cdk'); | ||
|
||
class %name.PascalCased%Stack extends cdk.Stack { | ||
/** | ||
* @param {cdk.App} scope | ||
* @param {string} id | ||
* @param {cdk.StackProps=} props | ||
*/ | ||
constructor(scope, id, props) { | ||
super(scope, id, props); | ||
|
||
const queue = new sqs.Queue(this, '%name.PascalCased%Queue', { | ||
visibilityTimeoutSec: 300 | ||
}); | ||
|
||
const topic = new sns.Topic(this, '%name.PascalCased%Topic'); | ||
|
||
topic.subscribeQueue(queue); | ||
} | ||
} | ||
|
||
module.exports = { %name.PascalCased%Stack } |
22 changes: 22 additions & 0 deletions
22
packages/aws-cdk/lib/init-templates/sample-app/javascript/package.template.json
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,22 @@ | ||
{ | ||
"name": "%name%", | ||
"version": "0.1.0", | ||
"bin": { | ||
"%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/aws-sns": "^%cdk-version%", | ||
"@aws-cdk/aws-sqs": "^%cdk-version%", | ||
"@aws-cdk/cdk": "^%cdk-version%" | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
packages/aws-cdk/lib/init-templates/sample-app/javascript/tsconfig.json
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,24 @@ | ||
{ | ||
"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 | ||
} | ||
} |