Skip to content

Commit

Permalink
feat: Support AWS CDK v2
Browse files Browse the repository at this point in the history
# Description

Support AWS CDK v2

Per https://docs.aws.amazon.com/cdk/v1/guide/home.html,
the support for CDK v1 is until June 1, 2022.
Best to generate CDK v2 project
Example: https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html

# PR Checklist

- [X] Migrations have been added if necessary
- [X] Unit tests have been added or updated if necessary
- [X] e2e tests have been added or updated if necessary
- [X] Changelog has been updated if necessary
- [X] Documentation has been updated if necessary

# Issue

Resolves codebrewlab#7
  • Loading branch information
therk authored and jessecollier committed Mar 28, 2022
1 parent e68a947 commit 8f7f58d
Show file tree
Hide file tree
Showing 15 changed files with 390 additions and 45 deletions.
222 changes: 203 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"lint-stage": "lint-staged",
"commitlint": "commitlint",
"is-ci": "is-ci",
"test": "nx test",
"lint": "nx workspace-lint && nx lint",
"test": "nx test nx-aws-cdk",
"lint": "nx lint nx-aws-cdk",
"e2e": "nx e2e",
"format": "nx format:write",
"build:aws-cdk": "nx build nx-aws-cdk",
Expand All @@ -29,6 +29,8 @@
"tslib": "^2.0.0"
},
"devDependencies": {
"@angular-devkit/architect": "^0.1302.4",
"@angular-devkit/schematics": "^13.2.4",
"@commitlint/cli": "^13.2.1",
"@commitlint/config-conventional": "^13.2.0",
"@jscutlery/semver": "^2.10.0",
Expand All @@ -43,7 +45,7 @@
"@nrwl/workspace": "12.5.8",
"@types/jest": "26.0.8",
"@types/node": "14.14.33",
"@typescript-eslint/eslint-plugin": "4.19.0",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "4.19.0",
"dotenv": "8.2.0",
"eslint": "7.22.0",
Expand All @@ -52,6 +54,7 @@
"is-ci": "^3.0.0",
"jest": "27.0.3",
"lint-staged": "^11.2.3",
"nx": "^13.8.2",
"prettier": "^2.3.1",
"ts-jest": "27.0.3",
"ts-node": "~9.1.1",
Expand Down
10 changes: 6 additions & 4 deletions packages/nx-aws-cdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ yarn add --dev @codebrew/nx-aws-cdk

### Generate Application

Create Aws Cdk Application
Create AWS CDK v2 Application

More details on AWS CDK v2 can be found on https://docs.aws.amazon.com/cdk/v2/guide/home.html

```shell
nx generate @codebrew/nx-aws-cdk:application myApp
Expand Down Expand Up @@ -64,8 +66,8 @@ Options:
Generated applications expose several functions to the CLI that allow users to deploy, destroy and so on.

```shell
nx deploy {Project Name}
nx destroy {Project Name}
nx deploy myApp
nx destroy myApp
```

## Maintainers
Expand All @@ -74,7 +76,7 @@ nx destroy {Project Name}

## Contributing

See [the contributing file](../../contributing.md)!
See [the contributing file](../../CONTRIBUTING.md)!

PRs accepted.

Expand Down
25 changes: 25 additions & 0 deletions packages/nx-aws-cdk/migrations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"schematics": {
"update-2.0.0": {
"version": "2.0.0",
"description": "Update libraries",
"factory": "./src/migrations/update-2-0-0/update-2-0-0"
},
"migrate-to-cdk-2": {
"version": "2.0.0",
"description": "Update AWS CDK to v2: rename '@aws-cdk/core' to 'aws-cdk-lib' and '@aws-cdk/assert' to 'aws-cdk'",
"factory": "./src/migrations/update-2-0-0/migrate-to-cdk-2"
}
},
"packageJsonUpdates": {
"2.0.0": {
"version": "2.0.0",
"packages": {
"eslint-plugin-cdk": {
"version": "^1.7.0",
"alwaysAddToPackageJson": false
}
}
}
}
}
2 changes: 1 addition & 1 deletion packages/nx-aws-cdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codebrew/nx-aws-cdk",
"version": "1.0.3",
"version": "2.0.0",
"main": "src/index.js",
"generators": "./generators.json",
"executors": "./executors.json",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as cdk from '@aws-cdk/core';
import { App } from 'aws-cdk-lib';
import { AppStack } from './stacks/app-stack';

const app = new cdk.App();
const app = new App();
new AppStack(app, '<%= projectName %>');
Loading

0 comments on commit 8f7f58d

Please sign in to comment.