@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.
- 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 +31 -8
- package/src/executors/bootstrap/bootstrap.js +13 -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 +13 -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 +13 -3
- package/src/executors/destroy/destroy.js +13 -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 +12 -2
- package/src/executors/synth/schema.d.ts +5 -0
- package/src/executors/synth/schema.json +13 -3
- package/src/executors/synth/synth.js +13 -13
- package/src/executors/synth/synth.js.map +1 -1
- package/src/generators/application/application.js +79 -65
- 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/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
|
@@ -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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
});
|
|
5
|
+
async function runExecutor(options, context) {
|
|
6
|
+
const normalizedOptions = normalizeOptions(options, context);
|
|
7
|
+
const result = await runDestroy(normalizedOptions, context);
|
|
8
|
+
return {
|
|
9
|
+
success: result,
|
|
10
|
+
};
|
|
14
11
|
}
|
|
15
12
|
function runDestroy(options, context) {
|
|
16
13
|
const command = (0, executor_util_1.createCommand)('destroy', 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 stacks;
|
|
23
19
|
if (Object.prototype.hasOwnProperty.call(options, 'stacks')) {
|
|
24
20
|
stacks = options.stacks;
|
|
25
21
|
}
|
|
26
22
|
// eslint-disable-next-line no-unsafe-optional-chaining
|
|
27
|
-
const { sourceRoot, root } =
|
|
28
|
-
return
|
|
23
|
+
const { sourceRoot, root } = context?.projectsConfigurations?.projects[context.projectName];
|
|
24
|
+
return {
|
|
25
|
+
...options,
|
|
26
|
+
parseArgs: parsedArgs,
|
|
27
|
+
stacks,
|
|
29
28
|
sourceRoot,
|
|
30
|
-
root
|
|
29
|
+
root,
|
|
30
|
+
};
|
|
31
31
|
}
|
|
32
32
|
//# sourceMappingURL=destroy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destroy.js","sourceRoot":"","sources":["../../../../../../packages/aws-cdk-v2/src/executors/destroy/destroy.ts"],"names":[],"mappings":";;AAYA,8BAOC
|
|
1
|
+
{"version":3,"file":"destroy.js","sourceRoot":"","sources":["../../../../../../packages/aws-cdk-v2/src/executors/destroy/destroy.ts"],"names":[],"mappings":";;AAYA,8BAOC;AAlBD,6DAAwF;AAWzE,KAAK,UAAU,WAAW,CAAC,OAA8B,EAAE,OAAwB;IAChG,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IAE5D,OAAO;QACL,OAAO,EAAE,MAAM;KAChB,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,OAAoC,EAAE,OAAwB;IAChF,MAAM,OAAO,GAAG,IAAA,6BAAa,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAClD,OAAO,IAAA,iCAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,gBAAgB,CAAC,OAA8B,EAAE,OAAwB;IAChF,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,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,MAAM;QACN,UAAU;QACV,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export interface DestroyExecutorSchema {
|
|
2
|
+
/** Stacks to destroy. 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
3
|
"title": "Destroy executor",
|
|
4
|
-
"description": "",
|
|
4
|
+
"description": "Destroy the deployed CDK stacks of this project.",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
7
7
|
"stacks": {
|
|
8
8
|
"type": "string",
|
|
9
|
-
"description": "
|
|
9
|
+
"description": "Stacks to destroy. 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
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export interface SynthExecutorSchema {
|
|
2
|
+
/** Stacks to synthesize. 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": "
|
|
4
|
-
"description": "",
|
|
3
|
+
"title": "Synth executor",
|
|
4
|
+
"description": "Synthesize the CDK app of this project into a CloudFormation template.",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
7
7
|
"stacks": {
|
|
8
8
|
"type": "string",
|
|
9
|
-
"description": "
|
|
9
|
+
"description": "Stacks to synthesize. 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
|
}
|
|
@@ -1,31 +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 runSynth(normalizedOptions, context);
|
|
8
|
+
return {
|
|
9
|
+
success: result,
|
|
10
|
+
};
|
|
14
11
|
}
|
|
15
12
|
function runSynth(options, context) {
|
|
16
13
|
const command = (0, executor_util_1.createCommand)('synth', options);
|
|
17
14
|
return (0, executor_util_1.runCommandProcess)(command, context.root);
|
|
18
15
|
}
|
|
19
16
|
function normalizeOptions(options, context) {
|
|
20
|
-
var _a, _b;
|
|
21
17
|
const parsedArgs = (0, executor_util_1.parseArgs)(options);
|
|
22
18
|
let stacks;
|
|
23
19
|
if (Object.prototype.hasOwnProperty.call(options, 'stacks')) {
|
|
24
20
|
stacks = options.stacks;
|
|
25
21
|
}
|
|
26
|
-
const { sourceRoot, root } =
|
|
27
|
-
return
|
|
22
|
+
const { sourceRoot, root } = context?.projectsConfigurations?.projects[context.projectName] ?? {};
|
|
23
|
+
return {
|
|
24
|
+
...options,
|
|
25
|
+
parseArgs: parsedArgs,
|
|
26
|
+
stacks,
|
|
28
27
|
sourceRoot,
|
|
29
|
-
root
|
|
28
|
+
root,
|
|
29
|
+
};
|
|
30
30
|
}
|
|
31
31
|
//# sourceMappingURL=synth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synth.js","sourceRoot":"","sources":["../../../../../../packages/aws-cdk-v2/src/executors/synth/synth.ts"],"names":[],"mappings":";;AAYA,8BAOC
|
|
1
|
+
{"version":3,"file":"synth.js","sourceRoot":"","sources":["../../../../../../packages/aws-cdk-v2/src/executors/synth/synth.ts"],"names":[],"mappings":";;AAYA,8BAOC;AAhBD,6DAAwF;AASzE,KAAK,UAAU,WAAW,CAAC,OAA4B,EAAE,OAAwB;IAC9F,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IAE1D,OAAO;QACL,OAAO,EAAE,MAAM;KAChB,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,OAAkC,EAAE,OAAwB;IAC5E,MAAM,OAAO,GAAG,IAAA,6BAAa,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAChD,OAAO,IAAA,iCAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,gBAAgB,CAAC,OAA4B,EAAE,OAAwB;IAC9E,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"}
|
|
@@ -8,87 +8,101 @@ const devkit_1 = require("@nx/devkit");
|
|
|
8
8
|
const jest_1 = require("@nx/jest");
|
|
9
9
|
const init_1 = require("../init/init");
|
|
10
10
|
function normalizeOptions(host, options) {
|
|
11
|
-
var _a;
|
|
12
11
|
const name = (0, devkit_1.names)(options.name).fileName;
|
|
13
12
|
const projectDirectory = options.directory ? `${(0, devkit_1.names)(options.directory).fileName}/${name}` : name;
|
|
14
13
|
const projectName = projectDirectory.replace(new RegExp('/', 'g'), '-');
|
|
15
14
|
const projectRoot = `${(0, devkit_1.getWorkspaceLayout)(host).appsDir}/${projectDirectory}`;
|
|
16
15
|
const parsedTags = options.tags ? options.tags.split(',').map((s) => s.trim()) : [];
|
|
17
|
-
return
|
|
16
|
+
return {
|
|
17
|
+
...options,
|
|
18
|
+
projectName,
|
|
18
19
|
projectRoot,
|
|
19
20
|
projectDirectory,
|
|
20
|
-
parsedTags,
|
|
21
|
+
parsedTags,
|
|
22
|
+
unitTestRunner: options.unitTestRunner ?? 'jest',
|
|
23
|
+
};
|
|
21
24
|
}
|
|
22
25
|
function addFiles(host, options) {
|
|
23
|
-
const templateOptions =
|
|
26
|
+
const templateOptions = {
|
|
27
|
+
...options,
|
|
28
|
+
...(0, devkit_1.names)(options.projectName),
|
|
29
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot),
|
|
30
|
+
template: '',
|
|
31
|
+
};
|
|
24
32
|
(0, devkit_1.generateFiles)(host, path.join(__dirname, 'files'), options.projectRoot, templateOptions);
|
|
25
33
|
}
|
|
26
34
|
function addJestFiles(host, options) {
|
|
27
|
-
const templateOptions =
|
|
35
|
+
const templateOptions = {
|
|
36
|
+
...options,
|
|
37
|
+
...(0, devkit_1.names)(options.projectName),
|
|
38
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot),
|
|
39
|
+
template: '',
|
|
40
|
+
};
|
|
28
41
|
(0, devkit_1.generateFiles)(host, path.join(__dirname, 'jest-files'), options.projectRoot, templateOptions);
|
|
29
42
|
}
|
|
30
|
-
function applicationGenerator(host, options) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
executor: '@wolsok/nx-aws-cdk-v2:bootstrap',
|
|
55
|
-
options: {},
|
|
56
|
-
},
|
|
43
|
+
async function applicationGenerator(host, options) {
|
|
44
|
+
const tasks = [];
|
|
45
|
+
const normalizedOptions = normalizeOptions(host, options);
|
|
46
|
+
const initTask = await (0, init_1.initGenerator)(host, {
|
|
47
|
+
...options,
|
|
48
|
+
skipFormat: true,
|
|
49
|
+
});
|
|
50
|
+
tasks.push(initTask);
|
|
51
|
+
const project = {
|
|
52
|
+
root: normalizedOptions.projectRoot,
|
|
53
|
+
projectType: 'application',
|
|
54
|
+
sourceRoot: `${normalizedOptions.projectRoot}/src`,
|
|
55
|
+
targets: {
|
|
56
|
+
deploy: {
|
|
57
|
+
executor: '@wolsok/nx-aws-cdk-v2:deploy',
|
|
58
|
+
options: {},
|
|
59
|
+
},
|
|
60
|
+
synth: {
|
|
61
|
+
executor: '@wolsok/nx-aws-cdk-v2:synth',
|
|
62
|
+
options: {},
|
|
63
|
+
},
|
|
64
|
+
destroy: {
|
|
65
|
+
executor: '@wolsok/nx-aws-cdk-v2:destroy',
|
|
66
|
+
options: {},
|
|
57
67
|
},
|
|
58
|
-
|
|
68
|
+
bootstrap: {
|
|
69
|
+
executor: '@wolsok/nx-aws-cdk-v2:bootstrap',
|
|
70
|
+
options: {},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
tags: normalizedOptions.parsedTags,
|
|
74
|
+
};
|
|
75
|
+
(0, devkit_1.addProjectConfiguration)(host, normalizedOptions.projectName, project);
|
|
76
|
+
const workspace = (0, devkit_1.readProjectConfiguration)(host, normalizedOptions.projectName);
|
|
77
|
+
(0, devkit_1.updateProjectConfiguration)(host, normalizedOptions.projectName, workspace);
|
|
78
|
+
addFiles(host, normalizedOptions);
|
|
79
|
+
if (normalizedOptions.unitTestRunner === 'jest') {
|
|
80
|
+
// `configurationGenerator` forwards its whole options object to `@nx/js`'s init
|
|
81
|
+
// generator, where `skipFormat` only guards the formatFiles call - `ensurePackage`
|
|
82
|
+
// for prettier still runs unless `formatter: 'none'` is set too. Since we already
|
|
83
|
+
// skip formatting here, also skip ensuring prettier: requiring the real prettier
|
|
84
|
+
// package from inside Jest's own module sandbox (i.e. when this generator runs in
|
|
85
|
+
// a unit test) crashes with "dynamic import callback ... without --experimental-vm-modules".
|
|
86
|
+
// `formatter` isn't part of JestProjectSchema's public type, so build the options
|
|
87
|
+
// object separately to avoid TypeScript's excess-property check on the call site.
|
|
88
|
+
const jestConfigOptions = {
|
|
89
|
+
project: normalizedOptions.projectName,
|
|
90
|
+
setupFile: 'none',
|
|
91
|
+
skipSerializers: true,
|
|
92
|
+
supportTsx: false,
|
|
93
|
+
babelJest: false,
|
|
94
|
+
testEnvironment: 'node',
|
|
95
|
+
skipFormat: true,
|
|
96
|
+
formatter: 'none',
|
|
59
97
|
};
|
|
60
|
-
(0,
|
|
61
|
-
|
|
62
|
-
(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// skip formatting here, also skip ensuring prettier: requiring the real prettier
|
|
69
|
-
// package from inside Jest's own module sandbox (i.e. when this generator runs in
|
|
70
|
-
// a unit test) crashes with "dynamic import callback ... without --experimental-vm-modules".
|
|
71
|
-
// `formatter` isn't part of JestProjectSchema's public type, so build the options
|
|
72
|
-
// object separately to avoid TypeScript's excess-property check on the call site.
|
|
73
|
-
const jestConfigOptions = {
|
|
74
|
-
project: normalizedOptions.projectName,
|
|
75
|
-
setupFile: 'none',
|
|
76
|
-
skipSerializers: true,
|
|
77
|
-
supportTsx: false,
|
|
78
|
-
babelJest: false,
|
|
79
|
-
testEnvironment: 'node',
|
|
80
|
-
skipFormat: true,
|
|
81
|
-
formatter: 'none',
|
|
82
|
-
};
|
|
83
|
-
const jestTask = yield (0, jest_1.configurationGenerator)(host, jestConfigOptions);
|
|
84
|
-
tasks.push(jestTask);
|
|
85
|
-
addJestFiles(host, normalizedOptions);
|
|
86
|
-
}
|
|
87
|
-
if (!options.skipFormat) {
|
|
88
|
-
yield (0, devkit_1.formatFiles)(host);
|
|
89
|
-
}
|
|
90
|
-
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
91
|
-
});
|
|
98
|
+
const jestTask = await (0, jest_1.configurationGenerator)(host, jestConfigOptions);
|
|
99
|
+
tasks.push(jestTask);
|
|
100
|
+
addJestFiles(host, normalizedOptions);
|
|
101
|
+
}
|
|
102
|
+
if (!options.skipFormat) {
|
|
103
|
+
await (0, devkit_1.formatFiles)(host);
|
|
104
|
+
}
|
|
105
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
92
106
|
}
|
|
93
107
|
exports.default = applicationGenerator;
|
|
94
108
|
exports.applicationSchematic = (0, devkit_1.convertNxGenerator)(applicationGenerator);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../packages/aws-cdk-v2/src/generators/application/application.ts"],"names":[],"mappings":";;;AAkEA,oDAqEC;;AAvID,mDAA6B;AAC7B,uCAcoB;AACpB,mCAAkD;AAGlD,uCAA6C;AAS7C,SAAS,gBAAgB,CAAC,IAAU,EAAE,OAA0B
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../packages/aws-cdk-v2/src/generators/application/application.ts"],"names":[],"mappings":";;;AAkEA,oDAqEC;;AAvID,mDAA6B;AAC7B,uCAcoB;AACpB,mCAAkD;AAGlD,uCAA6C;AAS7C,SAAS,gBAAgB,CAAC,IAAU,EAAE,OAA0B;IAC9D,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;IAC1C,MAAM,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACnG,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACxE,MAAM,WAAW,GAAG,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC,OAAO,IAAI,gBAAgB,EAAE,CAAC;IAC9E,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAA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E,IAAI;YAChB,SAAS,EAAE,MAAM;SACT,CAAC;QACX,MAAM,QAAQ,GAAG,MAAM,IAAA,6BAAsB,EAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;QACvE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,YAAY,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;AACpC,CAAC;AAED,kBAAe,oBAAoB,CAAC;AACvB,QAAA,oBAAoB,GAAG,IAAA,2BAAkB,EAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"app": "npx ts-node src/main.ts",
|
|
3
|
-
"output": "<%= offsetFromRoot %>dist/
|
|
2
|
+
"app": "npx ts-node --require tsconfig-paths/register --project tsconfig.app.json src/main.ts",
|
|
3
|
+
"output": "<%= offsetFromRoot %>dist/cdk.out/<%= projectName %>",
|
|
4
4
|
"requireApproval": "never",
|
|
5
5
|
"watch": {
|
|
6
6
|
"include": [
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { App, Stack, StackProps } from 'aws-cdk-lib';
|
|
2
2
|
|
|
3
3
|
export class AppStack extends Stack {
|
|
4
4
|
constructor(scope: App, id: string, props?: StackProps) {
|
|
5
5
|
super(scope, id, props);
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
}
|
|
7
|
+
// Define your infrastructure here, for example:
|
|
8
|
+
// new Bucket(this, 'MyBucket', { versioned: true });
|
|
9
|
+
}
|
|
9
10
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { App } from 'aws-cdk-lib';
|
|
2
2
|
import { Template } from 'aws-cdk-lib/assertions';
|
|
3
3
|
import { AppStack } from './stacks/app-stack';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
describe('<%= className %>', () => {
|
|
6
|
+
it('synthesizes an empty stack', () => {
|
|
6
7
|
const app = new App();
|
|
7
|
-
|
|
8
|
+
|
|
8
9
|
const stack = new AppStack(app, '<%= projectName %>TestStack');
|
|
9
|
-
|
|
10
|
-
Template.fromStack(stack
|
|
11
|
-
|
|
12
|
-
});
|
|
10
|
+
|
|
11
|
+
Template.fromStack(stack).templateMatches({ Resources: {} });
|
|
12
|
+
});
|
|
13
13
|
});
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
export interface ApplicationSchema {
|
|
2
|
+
/** The name of the application. */
|
|
2
3
|
name: string;
|
|
4
|
+
/** Comma separated list of tags to add to the project. */
|
|
3
5
|
tags?: string;
|
|
6
|
+
/** Directory the project is placed in, relative to the workspace's apps directory. */
|
|
4
7
|
directory?: string;
|
|
8
|
+
/** Skip formatting the generated files with Prettier. */
|
|
5
9
|
skipFormat?: boolean;
|
|
10
|
+
/** Unit test runner to configure for the generated application. */
|
|
6
11
|
unitTestRunner?: 'jest' | 'none';
|
|
12
|
+
/** Whether to configure the ESLint `parserOptions.project` option. */
|
|
7
13
|
setParserOptionsProject?: boolean;
|
|
8
14
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"id": "
|
|
4
|
-
"
|
|
3
|
+
"$id": "AwsCdkApplication",
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"title": "Create an AWS CDK v2 application",
|
|
6
|
+
"description": "Scaffolds an AWS CDK v2 application with deploy, destroy, synth and bootstrap targets.",
|
|
5
7
|
"type": "object",
|
|
6
8
|
"properties": {
|
|
7
9
|
"name": {
|
|
8
10
|
"type": "string",
|
|
9
|
-
"description": "",
|
|
11
|
+
"description": "The name of the application.",
|
|
10
12
|
"$default": {
|
|
11
13
|
"$source": "argv",
|
|
12
14
|
"index": 0
|
|
@@ -15,28 +17,28 @@
|
|
|
15
17
|
},
|
|
16
18
|
"tags": {
|
|
17
19
|
"type": "string",
|
|
18
|
-
"description": "
|
|
20
|
+
"description": "Comma separated list of tags to add to the project (used for linting and for `nx affected` filtering).",
|
|
19
21
|
"alias": "t"
|
|
20
22
|
},
|
|
21
23
|
"directory": {
|
|
22
24
|
"type": "string",
|
|
23
|
-
"description": "
|
|
25
|
+
"description": "The directory the project is placed in, relative to the workspace's apps directory.",
|
|
24
26
|
"alias": "d"
|
|
25
27
|
},
|
|
26
28
|
"skipFormat": {
|
|
27
|
-
"description": "Skip formatting files",
|
|
29
|
+
"description": "Skip formatting the generated files with Prettier.",
|
|
28
30
|
"type": "boolean",
|
|
29
31
|
"default": false
|
|
30
32
|
},
|
|
31
33
|
"unitTestRunner": {
|
|
32
|
-
"description": "
|
|
34
|
+
"description": "The unit test runner to configure for the generated application.",
|
|
33
35
|
"type": "string",
|
|
34
36
|
"enum": ["jest", "none"],
|
|
35
37
|
"default": "jest"
|
|
36
38
|
},
|
|
37
39
|
"setParserOptionsProject": {
|
|
38
40
|
"type": "boolean",
|
|
39
|
-
"description": "Whether
|
|
41
|
+
"description": "Whether to configure the ESLint \"parserOptions.project\" option. Off by default for lint performance reasons.",
|
|
40
42
|
"default": false
|
|
41
43
|
}
|
|
42
44
|
},
|
|
@@ -2,36 +2,42 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initSchematic = void 0;
|
|
4
4
|
exports.initGenerator = initGenerator;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
5
|
const devkit_1 = require("@nx/devkit");
|
|
7
6
|
const jest_1 = require("@nx/jest");
|
|
8
7
|
const cdk_shared_1 = require("../../utils/cdk-shared");
|
|
9
8
|
function normalizeOptions(schema) {
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
return {
|
|
10
|
+
...schema,
|
|
11
|
+
unitTestRunner: schema.unitTestRunner ?? 'jest',
|
|
12
|
+
};
|
|
12
13
|
}
|
|
13
|
-
function initGenerator(host, options) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
yield jestInstall();
|
|
31
|
-
}
|
|
32
|
-
yield installTask();
|
|
33
|
-
});
|
|
14
|
+
async function initGenerator(host, options) {
|
|
15
|
+
let jestInstall;
|
|
16
|
+
const schema = normalizeOptions(options);
|
|
17
|
+
if (schema.unitTestRunner === 'jest') {
|
|
18
|
+
jestInstall = await (0, jest_1.jestInitGenerator)(host, {});
|
|
19
|
+
}
|
|
20
|
+
const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, {
|
|
21
|
+
'aws-cdk-lib': cdk_shared_1.CDK_LIB_VERSION,
|
|
22
|
+
constructs: cdk_shared_1.CDK_CONSTRUCTS_VERSION,
|
|
23
|
+
}, {
|
|
24
|
+
// The CDK Toolkit and the TypeScript loaders are only ever invoked by the
|
|
25
|
+
// executors, so they belong in devDependencies rather than shipping with
|
|
26
|
+
// whatever the workspace publishes.
|
|
27
|
+
'aws-cdk': cdk_shared_1.CDK_CLI_VERSION,
|
|
28
|
+
'ts-node': cdk_shared_1.TS_NODE_VERSION,
|
|
29
|
+
'tsconfig-paths': cdk_shared_1.TSCONFIG_PATHS_VERSION,
|
|
30
|
+
tsx: cdk_shared_1.TSX_VERSION,
|
|
34
31
|
});
|
|
32
|
+
if (!schema.skipFormat) {
|
|
33
|
+
await (0, devkit_1.formatFiles)(host);
|
|
34
|
+
}
|
|
35
|
+
return async () => {
|
|
36
|
+
if (jestInstall) {
|
|
37
|
+
await jestInstall();
|
|
38
|
+
}
|
|
39
|
+
await installTask();
|
|
40
|
+
};
|
|
35
41
|
}
|
|
36
42
|
exports.default = initGenerator;
|
|
37
43
|
exports.initSchematic = (0, devkit_1.convertNxGenerator)(initGenerator);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/aws-cdk-v2/src/generators/init/init.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/aws-cdk-v2/src/generators/init/init.ts"],"names":[],"mappings":";;;AAoBA,sCAmCC;AAvDD,uCAAoH;AACpH,mCAA6C;AAG7C,uDAOgC;AAEhC,SAAS,gBAAgB,CAAC,MAA2B;IACnD,OAAO;QACL,GAAG,MAAM;QACT,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI,MAAM;KAChD,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,aAAa,CAAC,IAAU,EAAE,OAA4B;IAC1E,IAAI,WAA8B,CAAC;IACnC,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAEzC,IAAI,MAAM,CAAC,cAAc,KAAK,MAAM,EAAE,CAAC;QACrC,WAAW,GAAG,MAAM,IAAA,wBAAiB,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,WAAW,GAAG,IAAA,qCAA4B,EAC9C,IAAI,EACJ;QACE,aAAa,EAAE,4BAAe;QAC9B,UAAU,EAAE,mCAAsB;KACnC,EACD;QACE,0EAA0E;QAC1E,yEAAyE;QACzE,oCAAoC;QACpC,SAAS,EAAE,4BAAe;QAC1B,SAAS,EAAE,4BAAe;QAC1B,gBAAgB,EAAE,mCAAsB;QACxC,GAAG,EAAE,wBAAW;KACjB,CACF,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,KAAK,IAAI,EAAE;QAChB,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,WAAW,EAAE,CAAC;QACtB,CAAC;QACD,MAAM,WAAW,EAAE,CAAC;IACtB,CAAC,CAAC;AACJ,CAAC;AAED,kBAAe,aAAa,CAAC;AAChB,QAAA,aAAa,GAAG,IAAA,2BAAkB,EAAC,aAAa,CAAC,CAAC"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"id": "AwsCdkInit",
|
|
4
|
-
"
|
|
3
|
+
"$id": "AwsCdkInit",
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"title": "Add the AWS CDK dependencies to the workspace",
|
|
6
|
+
"description": "Adds aws-cdk-lib, constructs, the CDK Toolkit CLI and the TypeScript loaders the executors need. Runs automatically as part of the application generator.",
|
|
5
7
|
"type": "object",
|
|
6
8
|
"properties": {
|
|
7
9
|
"unitTestRunner": {
|
|
8
|
-
"description": "
|
|
10
|
+
"description": "The unit test runner to initialise for the workspace.",
|
|
9
11
|
"type": "string",
|
|
10
12
|
"enum": ["jest", "none"],
|
|
11
13
|
"default": "jest"
|
|
12
14
|
},
|
|
13
15
|
"skipFormat": {
|
|
14
|
-
"description": "Skip formatting files",
|
|
16
|
+
"description": "Skip formatting the touched files with Prettier.",
|
|
15
17
|
"type": "boolean",
|
|
16
18
|
"default": false
|
|
17
19
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public entry point of `@wolsok/nx-aws-cdk-v2`.
|
|
3
|
+
*
|
|
4
|
+
* Generators and executors are resolved by Nx through `generators.json` and
|
|
5
|
+
* `executors.json`; the exports below are for consumers who want to compose the
|
|
6
|
+
* generators from their own Nx plugin, or reuse the option types.
|
|
7
|
+
*/
|
|
8
|
+
export { applicationGenerator, applicationSchematic } from './generators/application/application';
|
|
9
|
+
export { initGenerator, initSchematic } from './generators/init/init';
|
|
10
|
+
export type { ApplicationSchema } from './generators/application/schema';
|
|
11
|
+
export type { InitGeneratorSchema } from './generators/init/schema';
|
|
12
|
+
export { default as bootstrapExecutor } from './executors/bootstrap/bootstrap';
|
|
13
|
+
export { default as deployExecutor } from './executors/deploy/deploy';
|
|
14
|
+
export { default as destroyExecutor } from './executors/destroy/destroy';
|
|
15
|
+
export { default as synthExecutor } from './executors/synth/synth';
|
|
16
|
+
export type { BootstrapExecutorSchema } from './executors/bootstrap/schema';
|
|
17
|
+
export type { DeployExecutorSchema } from './executors/deploy/schema';
|
|
18
|
+
export type { DestroyExecutorSchema } from './executors/destroy/schema';
|
|
19
|
+
export type { SynthExecutorSchema } from './executors/synth/schema';
|
|
20
|
+
export { CDK_CLI_VERSION, CDK_CONSTRUCTS_VERSION, CDK_LIB_VERSION, TS_NODE_VERSION, TSCONFIG_PATHS_VERSION, TSX_VERSION, } from './utils/cdk-shared';
|