@wolsok/nx-aws-cdk-v2 2.6.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +204 -52
- package/executors.json +4 -4
- package/generators.json +3 -2
- package/migrations.json +5 -0
- package/package.json +37 -8
- package/src/executors/bootstrap/bootstrap.js +14 -13
- package/src/executors/bootstrap/bootstrap.js.map +1 -1
- package/src/executors/bootstrap/schema.d.ts +3 -0
- package/src/executors/bootstrap/schema.json +16 -2
- package/src/executors/deploy/deploy.js +16 -18
- package/src/executors/deploy/deploy.js.map +1 -1
- package/src/executors/deploy/schema.d.ts +5 -0
- package/src/executors/deploy/schema.json +16 -3
- package/src/executors/destroy/destroy.js +14 -13
- package/src/executors/destroy/destroy.js.map +1 -1
- package/src/executors/destroy/schema.d.ts +5 -0
- package/src/executors/destroy/schema.json +15 -2
- package/src/executors/synth/schema.d.ts +5 -0
- package/src/executors/synth/schema.json +16 -3
- package/src/executors/synth/synth.js +13 -13
- package/src/executors/synth/synth.js.map +1 -1
- package/src/generators/application/application.js +85 -67
- package/src/generators/application/application.js.map +1 -1
- package/src/generators/application/files/cdk.json__template__ +2 -2
- package/src/generators/application/files/src/main.ts__template__ +1 -1
- package/src/generators/application/files/src/stacks/app-stack.ts__template__ +4 -3
- package/src/generators/application/jest-files/src/main.test.ts__template__ +7 -7
- package/src/generators/application/schema.d.ts +6 -0
- package/src/generators/application/schema.json +10 -8
- package/src/generators/init/init.js +30 -24
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/init/schema.d.ts +2 -0
- package/src/generators/init/schema.json +6 -4
- package/src/index.d.ts +20 -0
- package/src/index.js +31 -0
- package/src/index.js.map +1 -1
- package/src/interfaces/parsed-executor.interface.js.map +1 -1
- package/src/utils/cdk-shared.d.ts +25 -2
- package/src/utils/cdk-shared.js +26 -3
- package/src/utils/cdk-shared.js.map +1 -1
- package/src/utils/executor.util.js +20 -13
- package/src/utils/executor.util.js.map +1 -1
- package/src/utils/testing.js.map +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Wolfram Sokollek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,97 +1,249 @@
|
|
|
1
|
-
[](https://github.com/RichardLitt/standard-readme)
|
|
2
|
-
[](https://github.com/WolfSoko/nx-aws-cdk-v2/tree/main/packages/aws-cdk-v2)
|
|
3
|
-
[](https://www.typescriptlang.org/)
|
|
4
|
-
[](https://www.npmjs.com/package/@wolsok/nx-aws-cdk-v2)
|
|
5
1
|
[](https://www.npmjs.com/package/@wolsok/nx-aws-cdk-v2)
|
|
6
2
|
[](https://www.npmjs.com/package/@wolsok/nx-aws-cdk-v2)
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@wolsok/nx-aws-cdk-v2)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
9
5
|
|
|
10
6
|
# @wolsok/nx-aws-cdk-v2
|
|
11
7
|
|
|
12
|
-
|
|
8
|
+
Generate, synthesize, deploy and destroy [AWS CDK v2](https://docs.aws.amazon.com/cdk/v2/guide/home.html)
|
|
9
|
+
applications from inside an [Nx](https://nx.dev) workspace.
|
|
10
|
+
|
|
11
|
+
The plugin adds one generator and four executors. The executors are thin, predictable wrappers
|
|
12
|
+
around the CDK Toolkit CLI: they build a `cdk` command line and run it, so anything you know about
|
|
13
|
+
`cdk` keeps working, and anything Nx gives you — the project graph, `nx affected`, task caching,
|
|
14
|
+
`nx release` — applies to your infrastructure code as well.
|
|
13
15
|
|
|
14
|
-
## Table of
|
|
16
|
+
## Table of contents
|
|
15
17
|
|
|
18
|
+
- [Requirements](#requirements)
|
|
16
19
|
- [Install](#install)
|
|
17
|
-
- [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- [
|
|
20
|
+
- [Quick start](#quick-start)
|
|
21
|
+
- [Generator: `application`](#generator-application)
|
|
22
|
+
- [Executors](#executors)
|
|
23
|
+
- [`deploy`](#deploy)
|
|
24
|
+
- [`synth`](#synth)
|
|
25
|
+
- [`destroy`](#destroy)
|
|
26
|
+
- [`bootstrap`](#bootstrap)
|
|
27
|
+
- [Passing extra CDK flags](#passing-extra-cdk-flags)
|
|
28
|
+
- [How the executors invoke the CDK CLI](#how-the-executors-invoke-the-cdk-cli)
|
|
29
|
+
- [Documentation](#documentation)
|
|
21
30
|
- [Contributing](#contributing)
|
|
22
31
|
- [License](#license)
|
|
23
32
|
|
|
33
|
+
## Requirements
|
|
34
|
+
|
|
35
|
+
| Requirement | Version |
|
|
36
|
+
| --------------- | --------------------------------------------------------------------------------- |
|
|
37
|
+
| Node.js | `>= 20.19` |
|
|
38
|
+
| Nx | `>= 21` (built and tested against Nx 23) |
|
|
39
|
+
| AWS CDK | v2 — installed into your workspace by the generator |
|
|
40
|
+
| AWS credentials | Any method the AWS SDK understands (`aws configure`, `AWS_PROFILE`, SSO, OIDC, …) |
|
|
41
|
+
|
|
42
|
+
`@nx/devkit` is a peer dependency. `@nx/jest` is an optional peer dependency and is only needed if
|
|
43
|
+
you generate applications with the default `--unitTestRunner=jest`.
|
|
44
|
+
|
|
24
45
|
## Install
|
|
25
46
|
|
|
26
47
|
```shell
|
|
27
|
-
# npm
|
|
28
48
|
npm install --save-dev @wolsok/nx-aws-cdk-v2
|
|
29
|
-
|
|
30
|
-
|
|
49
|
+
# or
|
|
50
|
+
pnpm add --save-dev @wolsok/nx-aws-cdk-v2
|
|
51
|
+
# or
|
|
31
52
|
yarn add --dev @wolsok/nx-aws-cdk-v2
|
|
32
53
|
```
|
|
33
54
|
|
|
34
|
-
##
|
|
55
|
+
## Quick start
|
|
56
|
+
|
|
57
|
+
```shell
|
|
58
|
+
# 1. Scaffold a CDK app (adds aws-cdk-lib, constructs and the CDK Toolkit to your workspace)
|
|
59
|
+
nx generate @wolsok/nx-aws-cdk-v2:application my-app
|
|
60
|
+
|
|
61
|
+
# 2. Prepare the target AWS environment - once per account/region
|
|
62
|
+
nx bootstrap my-app --profile=my-profile
|
|
63
|
+
|
|
64
|
+
# 3. Check what CloudFormation the app produces
|
|
65
|
+
nx synth my-app
|
|
66
|
+
|
|
67
|
+
# 4. Ship it
|
|
68
|
+
nx deploy my-app
|
|
69
|
+
|
|
70
|
+
# 5. Tear it down again
|
|
71
|
+
nx destroy my-app
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Generator: `application`
|
|
75
|
+
|
|
76
|
+
```shell
|
|
77
|
+
nx generate @wolsok/nx-aws-cdk-v2:application <name> [options]
|
|
78
|
+
# alias: nx g @wolsok/nx-aws-cdk-v2:app <name>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
| Option | Type | Default | Description |
|
|
82
|
+
| --------------------------- | ---------------- | ------- | ------------------------------------------------------------------------------------------- |
|
|
83
|
+
| `--name` | `string` | — | Name of the application. Can also be passed as the first positional argument. **Required.** |
|
|
84
|
+
| `--directory`, `-d` | `string` | — | Directory the project is placed in, relative to the workspace's apps directory. |
|
|
85
|
+
| `--tags`, `-t` | `string` | — | Comma separated tags, used by lint rules and `nx affected` filtering. |
|
|
86
|
+
| `--unitTestRunner` | `jest` \| `none` | `jest` | Adds a Jest configuration and a sample stack test. |
|
|
87
|
+
| `--skipFormat` | `boolean` | `false` | Skip formatting the generated files with Prettier. |
|
|
88
|
+
| `--setParserOptionsProject` | `boolean` | `false` | Configure ESLint's `parserOptions.project`. Off by default for lint performance. |
|
|
89
|
+
|
|
90
|
+
### Where the project is created
|
|
91
|
+
|
|
92
|
+
The project root is `<appsDir>/<directory>/<name>`, where `<appsDir>` is
|
|
93
|
+
`workspaceLayout.appsDir` from `nx.json` if set, otherwise `apps/` or `packages/` if either exists,
|
|
94
|
+
otherwise the workspace root. The Nx project name is the path below `<appsDir>` with `/` replaced by
|
|
95
|
+
`-`, so `--directory=aws my-app` becomes the project `aws-my-app`.
|
|
96
|
+
|
|
97
|
+
### What gets generated
|
|
98
|
+
|
|
99
|
+
```text
|
|
100
|
+
<project-root>/
|
|
101
|
+
├── cdk.json # used when you run the cdk CLI yourself from this directory
|
|
102
|
+
├── jest.config.cts # only with --unitTestRunner=jest
|
|
103
|
+
├── project.json # deploy / synth / destroy / bootstrap targets
|
|
104
|
+
├── src/
|
|
105
|
+
│ ├── main.ts # CDK app entry point - the executors point cdk at this file
|
|
106
|
+
│ ├── main.test.ts # only with --unitTestRunner=jest
|
|
107
|
+
│ └── stacks/
|
|
108
|
+
│ └── app-stack.ts # your stack - start adding constructs here
|
|
109
|
+
├── tsconfig.app.json
|
|
110
|
+
├── tsconfig.json
|
|
111
|
+
└── tsconfig.spec.json # only with --unitTestRunner=jest
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The generator also adds `aws-cdk-lib` and `constructs` to `dependencies`, and the `aws-cdk` CLI plus
|
|
115
|
+
the TypeScript loaders (`ts-node`, `tsconfig-paths`, `tsx`) to `devDependencies` of your workspace.
|
|
116
|
+
|
|
117
|
+
> The CDK Toolkit CLI (`aws-cdk`) and the construct library (`aws-cdk-lib`) are released on separate
|
|
118
|
+
> version lines — `2.1xxx.x` for the CLI, `2.x` for the library. They are pinned independently.
|
|
119
|
+
|
|
120
|
+
## Executors
|
|
121
|
+
|
|
122
|
+
Every generated project gets four targets. Run them with `nx <target> <project>` or
|
|
123
|
+
`nx run <project>:<target>`.
|
|
124
|
+
|
|
125
|
+
Options shared by all four executors:
|
|
126
|
+
|
|
127
|
+
| Option | Type | Description |
|
|
128
|
+
| ----------------- | ---------------------- | ----------------------------------------------------------------------- |
|
|
129
|
+
| `--profile` | `string` | AWS profile from `~/.aws/credentials` or `~/.aws/config`. |
|
|
130
|
+
| `--context`, `-c` | `string` \| `string[]` | CDK context values as `KEY=VALUE`. Repeat the flag for multiple values. |
|
|
131
|
+
|
|
132
|
+
### `deploy`
|
|
133
|
+
|
|
134
|
+
Deploys the project's stacks to AWS.
|
|
135
|
+
|
|
136
|
+
| Option | Type | Description |
|
|
137
|
+
| ---------- | -------- | -------------------------------------------------------------------------------------------- |
|
|
138
|
+
| `--stacks` | `string` | Stack names or glob patterns to deploy, space separated. Defaults to every stack in the app. |
|
|
139
|
+
|
|
140
|
+
```shell
|
|
141
|
+
nx deploy my-app
|
|
142
|
+
nx deploy my-app --stacks=MyStack
|
|
143
|
+
nx deploy my-app --profile=production --context=env=prod
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### `synth`
|
|
147
|
+
|
|
148
|
+
Synthesizes the app into CloudFormation templates without touching AWS. Useful in CI as a fast
|
|
149
|
+
"does this still compile into valid infrastructure" check.
|
|
150
|
+
|
|
151
|
+
| Option | Type | Description |
|
|
152
|
+
| ---------- | -------- | --------------------------------------------------------- |
|
|
153
|
+
| `--stacks` | `string` | Stacks to synthesize. Defaults to every stack in the app. |
|
|
154
|
+
|
|
155
|
+
```shell
|
|
156
|
+
nx synth my-app
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### `destroy`
|
|
160
|
+
|
|
161
|
+
Removes the project's deployed stacks.
|
|
35
162
|
|
|
36
|
-
|
|
163
|
+
| Option | Type | Description |
|
|
164
|
+
| ---------- | -------- | ------------------------------------------------------ |
|
|
165
|
+
| `--stacks` | `string` | Stacks to destroy. Defaults to every stack in the app. |
|
|
166
|
+
|
|
167
|
+
```shell
|
|
168
|
+
nx destroy my-app
|
|
169
|
+
nx destroy my-app --stacks=MyStack --profile=staging
|
|
170
|
+
```
|
|
37
171
|
|
|
38
|
-
|
|
172
|
+
### `bootstrap`
|
|
39
173
|
|
|
40
|
-
|
|
174
|
+
Prepares an AWS environment (account + region pair) so CDK stacks can be deployed into it. Needed
|
|
175
|
+
once per environment — see the
|
|
176
|
+
[CDK bootstrapping guide](https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html).
|
|
41
177
|
|
|
42
178
|
```shell
|
|
43
|
-
nx
|
|
179
|
+
nx bootstrap my-app --profile=my-profile
|
|
180
|
+
nx bootstrap my-app aws://123456789012/us-east-1
|
|
44
181
|
```
|
|
45
182
|
|
|
46
|
-
|
|
183
|
+
### Passing extra CDK flags
|
|
47
184
|
|
|
185
|
+
Any option that is not part of an executor's schema is forwarded to the CDK CLI as
|
|
186
|
+
`--<option> <value>`, so the whole `cdk` surface stays reachable:
|
|
187
|
+
|
|
188
|
+
```shell
|
|
189
|
+
nx deploy my-app --hotswap=true # -> cdk deploy --hotswap true
|
|
190
|
+
nx deploy my-app --requireApproval=never # -> cdk deploy --requireApproval never
|
|
191
|
+
nx synth my-app --quiet=true # -> cdk synth --quiet true
|
|
48
192
|
```
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
193
|
+
|
|
194
|
+
You can also set them permanently in the project's `project.json`:
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"targets": {
|
|
199
|
+
"deploy": {
|
|
200
|
+
"executor": "@wolsok/nx-aws-cdk-v2:deploy",
|
|
201
|
+
"options": {
|
|
202
|
+
"profile": "production",
|
|
203
|
+
"requireApproval": "never"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
61
208
|
```
|
|
62
209
|
|
|
63
|
-
|
|
210
|
+
## How the executors invoke the CDK CLI
|
|
64
211
|
|
|
65
|
-
|
|
212
|
+
All four executors build the same shape of command and run it **from the workspace root**:
|
|
66
213
|
|
|
67
214
|
```shell
|
|
68
|
-
|
|
69
|
-
nx deploy myApp
|
|
70
|
-
nx destroy myApp
|
|
71
|
-
nx bootstrap myApp --profile=profile
|
|
72
|
-
#see how to use aws environments https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html#bootstrapping-howto-cli
|
|
73
|
-
nx bootstrap myApp aws://123456789012/us-east-1
|
|
215
|
+
<pm-exec> cdk -a "<pm-exec> <loader> <workspace-root>/<project-root>/src/main.ts" <command> [stacks] [--flags]
|
|
74
216
|
```
|
|
75
217
|
|
|
76
|
-
|
|
218
|
+
- `<pm-exec>` is `npx` for npm workspaces, otherwise your package manager (`pnpm`, `yarn`, `bun`),
|
|
219
|
+
detected by Nx.
|
|
220
|
+
- `<loader>` is `tsx` when the nearest `package.json` has `"type": "module"`, otherwise
|
|
221
|
+
`ts-node --require tsconfig-paths/register --project <project-root>/tsconfig.app.json`.
|
|
222
|
+
- Because `cdk` runs with the workspace root as its working directory, `cdk.out` is written to the
|
|
223
|
+
**workspace root**, and the generated `cdk.json` is _not_ read. That file exists for the times you
|
|
224
|
+
invoke `cdk` yourself from the project directory.
|
|
77
225
|
|
|
78
|
-
|
|
226
|
+
Run any target with `--verbose` to see the exact command that is executed.
|
|
79
227
|
|
|
80
|
-
##
|
|
228
|
+
## Documentation
|
|
81
229
|
|
|
82
|
-
|
|
230
|
+
- [Getting started](https://github.com/WolfSoko/wol-sok-mono/blob/main/docs/nx-aws-cdk-v2/getting-started.md)
|
|
231
|
+
- [API reference](https://github.com/WolfSoko/wol-sok-mono/blob/main/docs/nx-aws-cdk-v2/api-documentation.md)
|
|
232
|
+
- [Architecture](https://github.com/WolfSoko/wol-sok-mono/blob/main/docs/nx-aws-cdk-v2/architecture.md)
|
|
233
|
+
- [Troubleshooting](https://github.com/WolfSoko/wol-sok-mono/blob/main/docs/nx-aws-cdk-v2/troubleshooting.md)
|
|
83
234
|
|
|
84
|
-
|
|
235
|
+
## Contributing
|
|
85
236
|
|
|
86
|
-
|
|
237
|
+
Issues and pull requests are welcome — see
|
|
238
|
+
[CONTRIBUTING.md](https://github.com/WolfSoko/wol-sok-mono/blob/main/docs/CONTRIBUTING.md).
|
|
87
239
|
|
|
88
240
|
## License
|
|
89
241
|
|
|
90
|
-
|
|
242
|
+
MIT © Wolfram Sokollek
|
|
91
243
|
|
|
92
244
|
## Special thanks
|
|
93
245
|
|
|
94
|
-
This
|
|
95
|
-
[nx-plugins](https://github.com/codebrewlab/nx-plugins)
|
|
96
|
-
|
|
97
|
-
|
|
246
|
+
This project is based on [@tienne](https://github.com/tienne)'s
|
|
247
|
+
[nx-plugins](https://github.com/codebrewlab/nx-plugins), and on
|
|
248
|
+
[@adrian-goe](https://github.com/adrian-goe)'s [nx-aws-cdk-v2](https://github.com/adrian-goe/nx-aws-cdk-v2).
|
|
249
|
+
Thanks to [@therk](https://github.com/therk) for the work on migrating to CDK v2.
|
package/executors.json
CHANGED
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
"deploy": {
|
|
5
5
|
"implementation": "./src/executors/deploy/deploy",
|
|
6
6
|
"schema": "./src/executors/deploy/schema.json",
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "Deploy the CDK stacks of a project to AWS."
|
|
8
8
|
},
|
|
9
9
|
"destroy": {
|
|
10
10
|
"implementation": "./src/executors/destroy/destroy",
|
|
11
11
|
"schema": "./src/executors/destroy/schema.json",
|
|
12
|
-
"description": "
|
|
12
|
+
"description": "Destroy the deployed CDK stacks of a project."
|
|
13
13
|
},
|
|
14
14
|
"synth": {
|
|
15
15
|
"implementation": "./src/executors/synth/synth",
|
|
16
16
|
"schema": "./src/executors/synth/schema.json",
|
|
17
|
-
"description": "
|
|
17
|
+
"description": "Synthesize the CDK app of a project into a CloudFormation template."
|
|
18
18
|
},
|
|
19
19
|
"bootstrap": {
|
|
20
20
|
"implementation": "./src/executors/bootstrap/bootstrap",
|
|
21
21
|
"schema": "./src/executors/bootstrap/schema.json",
|
|
22
|
-
"description": "
|
|
22
|
+
"description": "Bootstrap an AWS environment for CDK deployments."
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
package/generators.json
CHANGED
|
@@ -6,14 +6,15 @@
|
|
|
6
6
|
"init": {
|
|
7
7
|
"factory": "./src/generators/init/init",
|
|
8
8
|
"schema": "./src/generators/init/schema.json",
|
|
9
|
-
"description": "
|
|
9
|
+
"description": "Add the AWS CDK dependencies to the workspace. Runs automatically as part of the application generator.",
|
|
10
10
|
"aliases": ["ng-add"],
|
|
11
11
|
"hidden": true
|
|
12
12
|
},
|
|
13
13
|
"application": {
|
|
14
14
|
"factory": "./src/generators/application/application",
|
|
15
15
|
"schema": "./src/generators/application/schema.json",
|
|
16
|
-
"
|
|
16
|
+
"aliases": ["app"],
|
|
17
|
+
"description": "Create an AWS CDK v2 application with deploy, destroy, synth and bootstrap targets."
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
}
|
package/migrations.json
ADDED
package/package.json
CHANGED
|
@@ -1,26 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wolsok/nx-aws-cdk-v2",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
4
|
+
"description": "Nx plugin to generate, synthesize, deploy and destroy AWS CDK v2 applications inside an Nx workspace.",
|
|
4
5
|
"main": "src/index.js",
|
|
6
|
+
"types": "src/index.d.ts",
|
|
5
7
|
"generators": "./generators.json",
|
|
6
8
|
"executors": "./executors.json",
|
|
9
|
+
"nx-migrations": {
|
|
10
|
+
"migrations": "./migrations.json"
|
|
11
|
+
},
|
|
7
12
|
"keywords": [
|
|
8
13
|
"nx",
|
|
14
|
+
"nx-plugin",
|
|
15
|
+
"aws",
|
|
9
16
|
"aws-cdk",
|
|
10
|
-
"monorepo",
|
|
11
17
|
"aws cdk",
|
|
18
|
+
"cdk",
|
|
19
|
+
"cdk-v2",
|
|
20
|
+
"cloudformation",
|
|
21
|
+
"infrastructure-as-code",
|
|
22
|
+
"monorepo",
|
|
12
23
|
"Node"
|
|
13
24
|
],
|
|
14
|
-
"ng-update": {
|
|
15
|
-
"requirements": {},
|
|
16
|
-
"migrations": "./migrations.json"
|
|
17
|
-
},
|
|
18
25
|
"author": "Wolfram Sokollek",
|
|
26
|
+
"homepage": "https://github.com/WolfSoko/wol-sok-mono/tree/main/libs/public/nx-aws-cdk-v2#readme",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/WolfSoko/wol-sok-mono/issues"
|
|
29
|
+
},
|
|
19
30
|
"repository": {
|
|
20
31
|
"type": "git",
|
|
21
|
-
"url": "git
|
|
32
|
+
"url": "git+https://github.com/WolfSoko/wol-sok-mono.git",
|
|
33
|
+
"directory": "libs/public/nx-aws-cdk-v2"
|
|
22
34
|
},
|
|
23
35
|
"license": "MIT",
|
|
24
|
-
"
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=20.19.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"tslib": "^2.3.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@nx/devkit": ">=21.0.0",
|
|
44
|
+
"@nx/jest": ">=21.0.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependenciesMeta": {
|
|
47
|
+
"@nx/jest": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
25
54
|
"type": "commonjs"
|
|
26
55
|
}
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = runExecutor;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const executor_util_1 = require("../../utils/executor.util");
|
|
6
|
-
function runExecutor(options, context) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
});
|
|
5
|
+
async function runExecutor(options, context) {
|
|
6
|
+
const normalizedOptions = normalizeOptions(options, context);
|
|
7
|
+
const result = await runBootstrap(normalizedOptions, context);
|
|
8
|
+
return {
|
|
9
|
+
success: result,
|
|
10
|
+
};
|
|
14
11
|
}
|
|
15
12
|
function runBootstrap(options, context) {
|
|
16
13
|
const command = (0, executor_util_1.createCommand)('bootstrap', options);
|
|
17
14
|
return (0, executor_util_1.runCommandProcess)(command, context.root);
|
|
18
15
|
}
|
|
19
16
|
function normalizeOptions(options, context) {
|
|
20
|
-
var _a;
|
|
21
17
|
const parsedArgs = (0, executor_util_1.parseArgs)(options);
|
|
22
18
|
let profile;
|
|
23
19
|
if (Object.prototype.hasOwnProperty.call(options, 'profile')) {
|
|
24
20
|
profile = `--profile ${options.profile}`;
|
|
25
21
|
}
|
|
22
|
+
const { sourceRoot, root } =
|
|
26
23
|
// eslint-disable-next-line no-unsafe-optional-chaining
|
|
27
|
-
|
|
28
|
-
return
|
|
24
|
+
context?.projectsConfigurations?.projects[context.projectName];
|
|
25
|
+
return {
|
|
26
|
+
...options,
|
|
27
|
+
parseArgs: parsedArgs,
|
|
28
|
+
profile,
|
|
29
29
|
sourceRoot,
|
|
30
|
-
root
|
|
30
|
+
root,
|
|
31
|
+
};
|
|
31
32
|
}
|
|
32
33
|
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../../../../libs/public/nx-aws-cdk-v2/src/executors/bootstrap/bootstrap.ts"],"names":[],"mappings":";;AAgBA,8BAUC;AAzBD,6DAImC;AAWpB,KAAK,UAAU,WAAW,CACvC,OAAgC,EAChC,OAAwB;IAExB,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IAE9D,OAAO;QACL,OAAO,EAAE,MAAM;KAChB,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,OAAsC,EACtC,OAAwB;IAExB,MAAM,OAAO,GAAG,IAAA,6BAAa,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACpD,OAAO,IAAA,iCAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,gBAAgB,CACvB,OAAgC,EAChC,OAAwB;IAExB,MAAM,UAAU,GAAG,IAAA,yBAAS,EAAC,OAAO,CAAC,CAAC;IACtC,IAAI,OAAO,CAAC;IAEZ,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;QAC7D,OAAO,GAAG,aAAa,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3C,CAAC;IAED,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE;IACxB,uDAAuD;IACvD,OAAO,EAAE,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAEjE,OAAO;QACL,GAAG,OAAO;QACV,SAAS,EAAE,UAAU;QACrB,OAAO;QACP,UAAU;QACV,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/schema",
|
|
3
3
|
"title": "Bootstrap executor",
|
|
4
|
-
"description": "",
|
|
4
|
+
"description": "Prepare (bootstrap) an AWS environment so CDK stacks of this project can be deployed into it.",
|
|
5
5
|
"type": "object",
|
|
6
|
-
"properties": {
|
|
6
|
+
"properties": {
|
|
7
|
+
"profile": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Name of the AWS profile (from ~/.aws/credentials or ~/.aws/config) to bootstrap with."
|
|
10
|
+
},
|
|
11
|
+
"context": {
|
|
12
|
+
"oneOf": [
|
|
13
|
+
{ "type": "string" },
|
|
14
|
+
{ "type": "array", "items": { "type": "string" } }
|
|
15
|
+
],
|
|
16
|
+
"description": "Additional CDK context values as KEY=VALUE pairs. Pass the option multiple times for multiple values.",
|
|
17
|
+
"alias": "c"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"additionalProperties": true,
|
|
7
21
|
"required": []
|
|
8
22
|
}
|
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = runExecutor;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const executor_util_1 = require("../../utils/executor.util");
|
|
6
|
-
function runExecutor(options, context) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
});
|
|
5
|
+
async function runExecutor(options, context) {
|
|
6
|
+
const normalizedOptions = normalizeOptions(options, context);
|
|
7
|
+
const result = await runDeploy(normalizedOptions, context);
|
|
8
|
+
return {
|
|
9
|
+
success: result,
|
|
10
|
+
};
|
|
14
11
|
}
|
|
15
|
-
function runDeploy(options, context) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return (0, executor_util_1.runCommandProcess)(command, context.root);
|
|
19
|
-
});
|
|
12
|
+
async function runDeploy(options, context) {
|
|
13
|
+
const command = (0, executor_util_1.createCommand)('deploy', options);
|
|
14
|
+
return (0, executor_util_1.runCommandProcess)(command, context.root);
|
|
20
15
|
}
|
|
21
16
|
function normalizeOptions(options, context) {
|
|
22
|
-
var _a, _b;
|
|
23
17
|
const parsedArgs = (0, executor_util_1.parseArgs)(options);
|
|
24
18
|
let stacks;
|
|
25
19
|
if (Object.prototype.hasOwnProperty.call(options, 'stacks')) {
|
|
26
20
|
stacks = options.stacks;
|
|
27
21
|
}
|
|
28
|
-
const { sourceRoot, root } =
|
|
29
|
-
return
|
|
22
|
+
const { sourceRoot, root } = context?.projectsConfigurations?.projects[context.projectName] ?? {};
|
|
23
|
+
return {
|
|
24
|
+
...options,
|
|
25
|
+
parseArgs: parsedArgs,
|
|
26
|
+
stacks,
|
|
30
27
|
sourceRoot,
|
|
31
|
-
root
|
|
28
|
+
root,
|
|
29
|
+
};
|
|
32
30
|
}
|
|
33
31
|
//# sourceMappingURL=deploy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../../../../../libs/public/nx-aws-cdk-v2/src/executors/deploy/deploy.ts"],"names":[],"mappings":";;AAeA,8BAUC;AAxBD,6DAImC;AAUpB,KAAK,UAAU,WAAW,CACvC,OAA6B,EAC7B,OAAwB;IAExB,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IAE3D,OAAO;QACL,OAAO,EAAE,MAAM;KAChB,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,SAAS,CACtB,OAAmC,EACnC,OAAwB;IAExB,MAAM,OAAO,GAAG,IAAA,6BAAa,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjD,OAAO,IAAA,iCAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,gBAAgB,CACvB,OAA6B,EAC7B,OAAwB;IAExB,MAAM,UAAU,GAAG,IAAA,yBAAS,EAAC,OAAO,CAAC,CAAC;IACtC,IAAI,MAAM,CAAC;IAEX,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC5D,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GACxB,OAAO,EAAE,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAEvE,OAAO;QACL,GAAG,OAAO;QACV,SAAS,EAAE,UAAU;QACrB,MAAM;QACN,UAAU;QACV,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export interface DeployExecutorSchema {
|
|
2
|
+
/** Stacks to deploy. Defaults to every stack in the app. */
|
|
2
3
|
stacks?: string;
|
|
4
|
+
/** AWS profile to use. */
|
|
5
|
+
profile?: string;
|
|
6
|
+
/** Additional CDK context values as `KEY=VALUE` pairs. */
|
|
7
|
+
context?: string | string[];
|
|
3
8
|
}
|
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"title": "
|
|
4
|
-
"description": "",
|
|
3
|
+
"title": "Deploy executor",
|
|
4
|
+
"description": "Deploy the CDK stacks of this project to AWS.",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
7
7
|
"stacks": {
|
|
8
8
|
"type": "string",
|
|
9
|
-
"description": "
|
|
9
|
+
"description": "Stacks to deploy. Accepts stack names or glob patterns, space separated. Defaults to every stack in the app."
|
|
10
|
+
},
|
|
11
|
+
"profile": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "Name of the AWS profile (from ~/.aws/credentials or ~/.aws/config) to use."
|
|
14
|
+
},
|
|
15
|
+
"context": {
|
|
16
|
+
"oneOf": [
|
|
17
|
+
{ "type": "string" },
|
|
18
|
+
{ "type": "array", "items": { "type": "string" } }
|
|
19
|
+
],
|
|
20
|
+
"description": "Additional CDK context values as KEY=VALUE pairs. Pass the option multiple times for multiple values.",
|
|
21
|
+
"alias": "c"
|
|
10
22
|
}
|
|
11
23
|
},
|
|
24
|
+
"additionalProperties": true,
|
|
12
25
|
"required": []
|
|
13
26
|
}
|