Version: 0.1.0
Last Updated: Unknown
This is a start to help bootstrap a new AWS CDK kit.
You will need to run npm i in the folder post-install.
| Variable | Data Type |
|---|---|
| stack | string |
| description | string |
| name | string |
1{2 "app": "node index"3}
1node_modules/2.env3cdk.out/
1import cdk = require('@aws-cdk/core');2import { <%= stack %> } from './stacks/import-your-stack';3require('dotenv').config();45const app = new cdk.App();67const stack = new <%= stack %>(app, '<%= stack %>');89cdk.Tag.add(stack, 'Project', 'Your-Project');1011app.synth();
1#!/usr/bin/env node2const path = require('path');3const fs = require('fs');4const dir = __dirname;5const cwd = process.cwd();6const map = JSON.parse(7 fs.readFileSync(path.resolve(dir, './map.json'), 'utf-8'),8);910let filesErr = [];1112const build = ({ dependencies, data, file, output, basedir }) => {13 dependencies.ejs.renderFile(file, data, {}, function (err, str) {14 // str => Rendered HTML string15 if (err) {16 filesErr.push(output);17 throw err;18 }1920 const outputFilePath = `${basedir}/${output}`;21 dependencies.fs.outputFileSync(outputFilePath, str);22 });23};2425module.exports = async function (options) {26 console.log('Bridging AWS CDK Startup');27 try {28 const files = await options.dependencies.recursiveReaddir(dir, ['!*.ejs']);29 const basedir = options.data.basedir30 ? path.resolve(cwd, options.data.basedir)31 : cwd;3233 for (const file of files) {34 let filepath = file.replace(dir + '/', '');35 console.log(`\t - Scaffolding: ${filepath}`);36 build({ ...options, file, output: map[filepath], basedir });37 }3839 return options;40 } catch (err) {41 console.error(err);42 }43};
1{2 "cdkjson.ejs": "cdk.json",3 "index.ejs": "index.ts",4 "gitignore.ejs": ".gitignore",5 "pkgjson.ejs": "package.json",6 "tsconfig.json.ejs": "tsconfig.json"7}
1{2 "name": "<%= name %>",3 "version": "1.0.0",4 "description": "<%= description %>",5 "private": true,6 "scripts": {7 "build": "tsc",8 "watch": "tsc -w",9 "cdk": "cdk",10 "deploy": "cdk deploy",11 "destroy": "cdk destroy",12 "synth": "cdk synth"13 },14 "author": {15 "name": "Dennis O'Keeffe",16 "url": "https://dennisokeeffe.com"17 },18 "devDependencies": {19 "@types/node": "^10.17.28",20 "typescript": "~3.7.2"21 },22 "dependencies": {23 "@aws-cdk/core": "^1.57.0",24 "@types/dotenv": "^8.2.0",25 "dotenv": "^8.2.0"26 }27}
1