@wolsok/nx-aws-cdk-v2 2.6.0 → 2.7.0

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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +204 -52
  3. package/executors.json +4 -4
  4. package/generators.json +3 -2
  5. package/migrations.json +5 -0
  6. package/package.json +31 -8
  7. package/src/executors/bootstrap/bootstrap.js +13 -13
  8. package/src/executors/bootstrap/bootstrap.js.map +1 -1
  9. package/src/executors/bootstrap/schema.d.ts +3 -0
  10. package/src/executors/bootstrap/schema.json +13 -2
  11. package/src/executors/deploy/deploy.js +16 -18
  12. package/src/executors/deploy/deploy.js.map +1 -1
  13. package/src/executors/deploy/schema.d.ts +5 -0
  14. package/src/executors/deploy/schema.json +13 -3
  15. package/src/executors/destroy/destroy.js +13 -13
  16. package/src/executors/destroy/destroy.js.map +1 -1
  17. package/src/executors/destroy/schema.d.ts +5 -0
  18. package/src/executors/destroy/schema.json +12 -2
  19. package/src/executors/synth/schema.d.ts +5 -0
  20. package/src/executors/synth/schema.json +13 -3
  21. package/src/executors/synth/synth.js +13 -13
  22. package/src/executors/synth/synth.js.map +1 -1
  23. package/src/generators/application/application.js +79 -65
  24. package/src/generators/application/application.js.map +1 -1
  25. package/src/generators/application/files/cdk.json__template__ +2 -2
  26. package/src/generators/application/files/src/main.ts__template__ +1 -1
  27. package/src/generators/application/files/src/stacks/app-stack.ts__template__ +4 -3
  28. package/src/generators/application/jest-files/src/main.test.ts__template__ +7 -7
  29. package/src/generators/application/schema.d.ts +6 -0
  30. package/src/generators/application/schema.json +10 -8
  31. package/src/generators/init/init.js +30 -24
  32. package/src/generators/init/init.js.map +1 -1
  33. package/src/generators/init/schema.d.ts +2 -0
  34. package/src/generators/init/schema.json +6 -4
  35. package/src/index.d.ts +20 -0
  36. package/src/index.js +31 -0
  37. package/src/index.js.map +1 -1
  38. package/src/utils/cdk-shared.d.ts +25 -2
  39. package/src/utils/cdk-shared.js +26 -3
  40. package/src/utils/cdk-shared.js.map +1 -1
  41. package/src/utils/executor.util.js +20 -13
  42. package/src/utils/executor.util.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
- [![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
2
- [![@wolsok/nx-aws-cdk-v2](https://img.shields.io/badge/%40adrian--goe-nx--aws--cdk-green)](https://github.com/WolfSoko/nx-aws-cdk-v2/tree/main/packages/aws-cdk-v2)
3
- [![Typescript](https://badgen.net/badge/icon/typescript?icon=typescript&label)](https://www.typescriptlang.org/)
4
- [![LICENSE](https://img.shields.io/npm/l/@wolsok/nx-aws-cdk-v2.svg)](https://www.npmjs.com/package/@wolsok/nx-aws-cdk-v2)
5
1
  [![npm version](https://img.shields.io/npm/v/@wolsok/nx-aws-cdk-v2.svg)](https://www.npmjs.com/package/@wolsok/nx-aws-cdk-v2)
6
2
  [![Downloads](https://img.shields.io/npm/dm/@wolsok/nx-aws-cdk-v2.svg)](https://www.npmjs.com/package/@wolsok/nx-aws-cdk-v2)
7
-
8
- <hr>
3
+ [![LICENSE](https://img.shields.io/npm/l/@wolsok/nx-aws-cdk-v2.svg)](https://www.npmjs.com/package/@wolsok/nx-aws-cdk-v2)
4
+ [![Typescript](https://badgen.net/badge/icon/typescript?icon=typescript&label)](https://www.typescriptlang.org/)
9
5
 
10
6
  # @wolsok/nx-aws-cdk-v2
11
7
 
12
- An Nx plugin for developing [aws-cdk](https://docs.aws.amazon.com/cdk/latest/guide/home.html)
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 Contents
16
+ ## Table of contents
15
17
 
18
+ - [Requirements](#requirements)
16
19
  - [Install](#install)
17
- - [Usage](#usage)
18
- - [Generate Application](#generate-application)
19
- - [Targets](#targets)
20
- - [Maintainers](#maintainers)
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
- # yarn
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
- ## Usage
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
- ### Generate Application
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
- Create AWS CDK v2 Application
172
+ ### `bootstrap`
39
173
 
40
- More details on AWS CDK v2 can be found on https://docs.aws.amazon.com/cdk/v2/guide/home.html
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 generate @wolsok/nx-aws-cdk-v2:application myApp
179
+ nx bootstrap my-app --profile=my-profile
180
+ nx bootstrap my-app aws://123456789012/us-east-1
44
181
  ```
45
182
 
46
- you can customize it further by passing these options:
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
- nx generate @wolsok/nx-aws-cdk-v2:application [name] [options,...]
50
-
51
- Options:
52
- --name
53
- --tags Add tags to the project (used for linting)
54
- --directory A directory where the project is placed
55
- --skipFormat Skip formatting files
56
- --unitTestRunner Adds the specified unit test runner (default: jest)
57
- --setParserOptionsProject Whether or not to configure the ESLint "parserOptions.project" option. We do not do this by default for lint performance reasons.
58
- --dryRun Runs through and reports activity without writing to disk.
59
- --skip-nx-cache Skip the use of Nx cache.
60
- --help Show available options for project target.
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
- ### Targets
210
+ ## How the executors invoke the CDK CLI
64
211
 
65
- Generated applications expose several functions to the CLI that allow users to synthesize, deploy, destroy and bootstrap.
212
+ All four executors build the same shape of command and run it **from the workspace root**:
66
213
 
67
214
  ```shell
68
- nx synth myApp
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
- ## Maintainers
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
- [@WolfSoko](https://github.com/WolfSoko)
226
+ Run any target with `--verbose` to see the exact command that is executed.
79
227
 
80
- ## Contributing
228
+ ## Documentation
81
229
 
82
- See [the contributing file](../../CONTRIBUTING.md)!
230
+ - [Getting started](https://github.com/WolfSoko/nx-aws-cdk-v2/blob/main/docs/getting-started.md)
231
+ - [API reference](https://github.com/WolfSoko/nx-aws-cdk-v2/blob/main/docs/api-documentation.md)
232
+ - [Architecture](https://github.com/WolfSoko/nx-aws-cdk-v2/blob/main/docs/architecture.md)
233
+ - [Troubleshooting](https://github.com/WolfSoko/nx-aws-cdk-v2/blob/main/docs/troubleshooting.md)
83
234
 
84
- PRs accepted.
235
+ ## Contributing
85
236
 
86
- If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.
237
+ Issues and pull requests are welcome — see
238
+ [CONTRIBUTING.md](https://github.com/WolfSoko/nx-aws-cdk-v2/blob/main/CONTRIBUTING.md).
87
239
 
88
240
  ## License
89
241
 
90
- This project is MIT licensed 2022 Wolfram Sokollek
242
+ MIT © Wolfram Sokollek
91
243
 
92
244
  ## Special thanks
93
245
 
94
- This Project is based on [@tienne](https://github.com/tienne)'s
95
- [nx-plugins](https://github.com/codebrewlab/nx-plugins).
96
-
97
- Also thanks to [@therk](https://github.com/therk) for his work on migrating to cdk v2.
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": "build executor"
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": "destroy executor"
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": "synth executor"
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": "bootstrap executor"
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": "init generator",
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
- "description": "create aws-cdk application"
16
+ "aliases": ["app"],
17
+ "description": "Create an AWS CDK v2 application with deploy, destroy, synth and bootstrap targets."
17
18
  }
18
19
  }
19
20
  }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "generators": {},
4
+ "packageJsonUpdates": {}
5
+ }
package/package.json CHANGED
@@ -1,26 +1,49 @@
1
1
  {
2
2
  "name": "@wolsok/nx-aws-cdk-v2",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
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/nx-aws-cdk-v2/tree/main/packages/aws-cdk-v2#readme",
27
+ "bugs": {
28
+ "url": "https://github.com/WolfSoko/nx-aws-cdk-v2/issues"
29
+ },
19
30
  "repository": {
20
31
  "type": "git",
21
- "url": "git@github.com:WolfSoko/nx-aws-cdk-v2"
32
+ "url": "git+https://github.com/WolfSoko/nx-aws-cdk-v2.git",
33
+ "directory": "packages/aws-cdk-v2"
22
34
  },
23
35
  "license": "MIT",
24
- "types": "./src/index.d.ts",
36
+ "engines": {
37
+ "node": ">=20.19.0"
38
+ },
39
+ "peerDependencies": {
40
+ "@nx/devkit": ">=21.0.0",
41
+ "@nx/jest": ">=21.0.0"
42
+ },
43
+ "peerDependenciesMeta": {
44
+ "@nx/jest": {
45
+ "optional": true
46
+ }
47
+ },
25
48
  "type": "commonjs"
26
49
  }
@@ -1,32 +1,32 @@
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
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
- const normalizedOptions = normalizeOptions(options, context);
9
- const result = yield runBootstrap(normalizedOptions, context);
10
- return {
11
- success: result,
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
  }
26
22
  // eslint-disable-next-line no-unsafe-optional-chaining
27
- const { sourceRoot, root } = (_a = context === null || context === void 0 ? void 0 : context.projectsConfigurations) === null || _a === void 0 ? void 0 : _a.projects[context.projectName];
28
- return Object.assign(Object.assign({}, options), { parseArgs: parsedArgs, profile,
23
+ const { sourceRoot, root } = context?.projectsConfigurations?.projects[context.projectName];
24
+ return {
25
+ ...options,
26
+ parseArgs: parsedArgs,
27
+ profile,
29
28
  sourceRoot,
30
- root });
29
+ root,
30
+ };
31
31
  }
32
32
  //# sourceMappingURL=bootstrap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../../../packages/aws-cdk-v2/src/executors/bootstrap/bootstrap.ts"],"names":[],"mappings":";;AAYA,8BAOC;;AAlBD,6DAAwF;AAWxF,SAA8B,WAAW,CAAC,OAAgC,EAAE,OAAwB;;QAClG,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;QAE9D,OAAO;YACL,OAAO,EAAE,MAAM;SAChB,CAAC;IACJ,CAAC;CAAA;AAED,SAAS,YAAY,CAAC,OAAsC,EAAE,OAAwB;IACpF,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,CAAC,OAAgC,EAAE,OAAwB;;IAClF,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,uDAAuD;IACvD,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,sBAAsB,0CAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAE5F,uCACK,OAAO,KACV,SAAS,EAAE,UAAU,EACrB,OAAO;QACP,UAAU;QACV,IAAI,IACJ;AACJ,CAAC"}
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../../../packages/aws-cdk-v2/src/executors/bootstrap/bootstrap.ts"],"names":[],"mappings":";;AAYA,8BAOC;AAlBD,6DAAwF;AAWzE,KAAK,UAAU,WAAW,CAAC,OAAgC,EAAE,OAAwB;IAClG,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,CAAC,OAAsC,EAAE,OAAwB;IACpF,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,CAAC,OAAgC,EAAE,OAAwB;IAClF,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,uDAAuD;IACvD,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAE5F,OAAO;QACL,GAAG,OAAO;QACV,SAAS,EAAE,UAAU;QACrB,OAAO;QACP,UAAU;QACV,IAAI;KACL,CAAC;AACJ,CAAC"}
@@ -1,3 +1,6 @@
1
1
  export interface BootstrapExecutorSchema {
2
+ /** AWS profile to bootstrap with. */
2
3
  profile?: string;
4
+ /** Additional CDK context values as `KEY=VALUE` pairs. */
5
+ context?: string | string[];
3
6
  }
@@ -1,8 +1,19 @@
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": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }],
13
+ "description": "Additional CDK context values as KEY=VALUE pairs. Pass the option multiple times for multiple values.",
14
+ "alias": "c"
15
+ }
16
+ },
17
+ "additionalProperties": true,
7
18
  "required": []
8
19
  }
@@ -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
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
- const normalizedOptions = normalizeOptions(options, context);
9
- const result = yield runDeploy(normalizedOptions, context);
10
- return {
11
- success: result,
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
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
17
- const command = (0, executor_util_1.createCommand)('deploy', options);
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 } = (_b = (_a = context === null || context === void 0 ? void 0 : context.projectsConfigurations) === null || _a === void 0 ? void 0 : _a.projects[context.projectName]) !== null && _b !== void 0 ? _b : {};
29
- return Object.assign(Object.assign({}, options), { parseArgs: parsedArgs, stacks,
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":["../../../../../../packages/aws-cdk-v2/src/executors/deploy/deploy.ts"],"names":[],"mappings":";;AAWA,8BAOC;;AAjBD,6DAAwF;AAUxF,SAA8B,WAAW,CAAC,OAA6B,EAAE,OAAwB;;QAC/F,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;QAE3D,OAAO;YACL,OAAO,EAAE,MAAM;SAChB,CAAC;IACJ,CAAC;CAAA;AAED,SAAe,SAAS,CAAC,OAAmC,EAAE,OAAwB;;QACpF,MAAM,OAAO,GAAG,IAAA,6BAAa,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACjD,OAAO,IAAA,iCAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;CAAA;AAED,SAAS,gBAAgB,CAAC,OAA6B,EAAE,OAAwB;;IAC/E,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,GAAG,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,sBAAsB,0CAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,mCAAI,EAAE,CAAC;IAElG,uCACK,OAAO,KACV,SAAS,EAAE,UAAU,EACrB,MAAM;QACN,UAAU;QACV,IAAI,IACJ;AACJ,CAAC"}
1
+ {"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../../../../packages/aws-cdk-v2/src/executors/deploy/deploy.ts"],"names":[],"mappings":";;AAWA,8BAOC;AAjBD,6DAAwF;AAUzE,KAAK,UAAU,WAAW,CAAC,OAA6B,EAAE,OAAwB;IAC/F,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,CAAC,OAAmC,EAAE,OAAwB;IACpF,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,CAAC,OAA6B,EAAE,OAAwB;IAC/E,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,GAAG,OAAO,EAAE,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAElG,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,23 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
- "title": "deploy executor",
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": "use deploy named STACKS"
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": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }],
17
+ "description": "Additional CDK context values as KEY=VALUE pairs. Pass the option multiple times for multiple values.",
18
+ "alias": "c"
10
19
  }
11
20
  },
21
+ "additionalProperties": true,
12
22
  "required": []
13
23
  }