@aws/nx-plugin 0.1.6 → 0.2.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-THIRD-PARTY +114 -244
- package/generators.json +1 -7
- package/package.json +1 -1
- package/src/cloudscape-website/app/README.md +84 -48
- package/src/cloudscape-website/app/__snapshots__/generator.spec.ts.snap +157 -218
- package/src/cloudscape-website/app/files/app/README.md.template +44 -0
- package/src/cloudscape-website/app/files/app/src/layouts/App/index.tsx.template +40 -43
- package/src/cloudscape-website/app/files/app/src/layouts/App/navitems.ts.template +3 -3
- package/src/cloudscape-website/app/files/app/src/layouts/Routes/index.tsx.template +4 -6
- package/src/cloudscape-website/app/files/app/src/main.tsx.template +7 -10
- package/src/cloudscape-website/app/files/app/src/pages/Home/index.tsx.template +0 -2
- package/src/cloudscape-website/app/files/common/constructs/src/app/static-websites/__websiteNameKebabCase__.ts.template +13 -0
- package/src/cloudscape-website/app/files/common/constructs/src/{__websiteNameKebabCase__ → core}/static-website.ts.template +74 -144
- package/src/cloudscape-website/app/generator.js +74 -64
- package/src/cloudscape-website/app/generator.js.map +1 -1
- package/src/cloudscape-website/app/schema.d.ts +3 -4
- package/src/cloudscape-website/app/schema.json +1 -24
- package/src/cloudscape-website/cognito-auth/README.md +53 -32
- package/src/cloudscape-website/cognito-auth/__snapshots__/generator.spec.ts.snap +161 -125
- package/src/cloudscape-website/cognito-auth/files/app/components/CognitoAuth/index.tsx.template +53 -39
- package/src/cloudscape-website/cognito-auth/files/common/constructs/src/core/user-identity.ts.template +168 -0
- package/src/cloudscape-website/cognito-auth/generator.js +129 -46
- package/src/cloudscape-website/cognito-auth/generator.js.map +1 -1
- package/src/cloudscape-website/cognito-auth/schema.d.ts +1 -0
- package/src/cloudscape-website/cognito-auth/schema.json +7 -1
- package/src/cloudscape-website/runtime-config/__snapshots__/generator.spec.ts.snap +15 -17
- package/src/cloudscape-website/runtime-config/files/app/components/RuntimeConfig/index.tsx.template +7 -10
- package/src/cloudscape-website/runtime-config/files/app/hooks/useRuntimeConfig.tsx.template +13 -0
- package/src/cloudscape-website/runtime-config/generator.js +3 -1
- package/src/cloudscape-website/runtime-config/generator.js.map +1 -1
- package/src/infra/app/README.md +71 -46
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +114 -252
- package/src/infra/app/files/app/README.md.template +76 -0
- package/src/infra/app/files/app/src/main.ts.template +18 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/aws-prototyping.guard +1282 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/cfn-nag.guard +6839 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/hipaa-security.guard +2807 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/nist-csf.guard +2585 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/pci-dss-3-2-1.guard +2236 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/wa-reliability-pillar.guard +885 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/wa-security-pillar.guard +2205 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard.ts.template +63 -0
- package/src/infra/app/generator.js +17 -3
- package/src/infra/app/generator.js.map +1 -1
- package/src/infra/app/schema.d.ts +10 -1
- package/src/infra/app/schema.json +16 -8
- package/src/trpc/backend/README.md +102 -80
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +37 -17
- package/src/trpc/backend/files/backend/README.md.template +33 -0
- package/src/trpc/backend/files/common/constructs/src/app/trpc-apis/__apiNameKebabCase__.ts.template +18 -0
- package/src/trpc/backend/files/common/constructs/src/{__apiNameKebabCase__/index.ts.template → core/trpc-api.ts.template} +12 -16
- package/src/trpc/backend/files/schema/README.md.template +33 -0
- package/src/trpc/backend/generator.js +29 -43
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/trpc/backend/schema.d.ts +3 -1
- package/src/trpc/backend/schema.json +8 -13
- package/src/trpc/react/README.md +46 -66
- package/src/trpc/react/__snapshots__/generator.spec.ts.snap +104 -65
- package/src/trpc/react/files/src/components/TrpcClients/IsolatedTrpcProvider.tsx.template +75 -0
- package/src/trpc/react/files/src/components/TrpcClients/TrpcApis.tsx.template +1 -0
- package/src/trpc/react/files/src/components/TrpcClients/TrpcClientProviders.tsx.template +10 -0
- package/src/trpc/react/files/src/components/TrpcClients/index.tsx.template +5 -0
- package/src/trpc/react/files/src/hooks/useSigV4.tsx.template +38 -0
- package/src/trpc/react/files/src/hooks/use__apiNameClassName__.tsx.template +3 -0
- package/src/trpc/react/generator.js +123 -24
- package/src/trpc/react/generator.js.map +1 -1
- package/src/trpc/react/schema.json +2 -2
- package/src/ts/cjs-to-esm/generator.js.map +1 -1
- package/src/ts/lib/eslint.d.ts +1 -1
- package/src/ts/lib/eslint.js +59 -11
- package/src/ts/lib/eslint.js.map +1 -1
- package/src/ts/lib/files/README.md.template +33 -0
- package/src/ts/lib/generator.js +11 -4
- package/src/ts/lib/generator.js.map +1 -1
- package/src/ts/lib/schema.d.ts +1 -3
- package/src/ts/lib/schema.json +2 -15
- package/src/ts/lib/ts-project-utils.js.map +1 -1
- package/src/ts/lib/vitest.js +14 -0
- package/src/ts/lib/vitest.js.map +1 -1
- package/src/utils/ast.d.ts +13 -0
- package/src/utils/ast.js +102 -0
- package/src/utils/ast.js.map +1 -0
- package/src/utils/files/common/constructs/src/app/index.ts.template +0 -0
- package/src/utils/files/common/constructs/src/{runtime-config → core}/runtime-config.ts.template +3 -5
- package/src/utils/files/common/constructs/src/index.ts.template +2 -1
- package/src/utils/files/common/readme/README.md.template +33 -0
- package/src/utils/files/common/types/src/runtime-config.ts.template +1 -13
- package/src/utils/format.js.map +1 -1
- package/src/utils/names.d.ts +2 -0
- package/src/utils/names.js +27 -0
- package/src/utils/names.js.map +1 -0
- package/src/utils/npm-scope.js.map +1 -1
- package/src/utils/paths.js.map +1 -1
- package/src/utils/shared-constructs.js +37 -4
- package/src/utils/shared-constructs.js.map +1 -1
- package/src/utils/versions.d.ts +15 -9
- package/src/utils/versions.js +14 -8
- package/src/utils/versions.js.map +1 -1
- package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/cloudfront-web-acl.ts.template +0 -317
- package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/index.ts.template +0 -4
- package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/webacl_event_handler/index.ts.template +0 -301
- package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/index.ts.template +0 -4
- package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/user-identity.ts.template +0 -66
- package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/userpool-with-mfa.ts.template +0 -70
- package/src/gitlab/generator.d.ts +0 -8
- package/src/gitlab/generator.js +0 -16
- package/src/gitlab/generator.js.map +0 -1
- package/src/gitlab/schema.d.ts +0 -9
- package/src/gitlab/schema.json +0 -52
- package/src/infra/app/files/src/main.ts.template +0 -37
- package/src/trpc/react/files/src/components/TRPCClientProvider/index.tsx.template +0 -34
- package/src/trpc/react/files/src/hooks/useTrpc.tsx.template +0 -5
- /package/src/infra/app/files/{cdk.json → app/cdk.json} +0 -0
- /package/src/infra/app/files/{src → app/src}/stacks/application-stack.ts.template +0 -0
- /package/src/utils/files/common/constructs/src/{runtime-config → core}/index.ts.template +0 -0
|
@@ -2,18 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`infra generator > should add required dependencies to package.json > dependencies 1`] = `
|
|
4
4
|
{
|
|
5
|
-
"@
|
|
6
|
-
"aws-cdk": "^2.166.0",
|
|
7
|
-
"aws-cdk-lib": "^2.166.0",
|
|
8
|
-
"constructs": "^10.4.2",
|
|
9
|
-
"esbuild": "^0.24.0",
|
|
10
|
-
"source-map-support": "^0.5.21",
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
exports[`infra generator > should add required dependencies to package.json > dependencies 2`] = `
|
|
15
|
-
{
|
|
16
|
-
"@aws/pdk": "^0.25.7",
|
|
5
|
+
"@cdklabs/cdk-validator-cfnguard": "^0.0.60",
|
|
17
6
|
"aws-cdk": "^2.166.0",
|
|
18
7
|
"aws-cdk-lib": "^2.166.0",
|
|
19
8
|
"constructs": "^10.4.2",
|
|
@@ -23,81 +12,35 @@ exports[`infra generator > should add required dependencies to package.json > de
|
|
|
23
12
|
`;
|
|
24
13
|
|
|
25
14
|
exports[`infra generator > should add required dependencies to package.json > dev-dependencies 1`] = `
|
|
26
|
-
{
|
|
27
|
-
"@eslint/js": "^9.8.0",
|
|
28
|
-
"@nx/eslint": "20.0.10",
|
|
29
|
-
"@nx/eslint-plugin": "20.0.10",
|
|
30
|
-
"eslint": "^9.8.0",
|
|
31
|
-
"eslint-config-prettier": "^9.0.0",
|
|
32
|
-
"tsx": "^4.19.2",
|
|
33
|
-
"typescript-eslint": "^8.0.0",
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
exports[`infra generator > should add required dependencies to package.json > dev-dependencies 2`] = `
|
|
38
15
|
{
|
|
39
16
|
"@eslint/js": "^9.8.0",
|
|
40
17
|
"@nx/eslint": "20.3.1",
|
|
41
18
|
"@nx/eslint-plugin": "20.3.1",
|
|
19
|
+
"@nx/js": "20.3.1",
|
|
20
|
+
"@nx/vite": "20.3.1",
|
|
21
|
+
"@nx/web": "20.3.1",
|
|
22
|
+
"@swc-node/register": "~1.9.1",
|
|
23
|
+
"@swc/core": "~1.5.7",
|
|
24
|
+
"@swc/helpers": "~0.5.11",
|
|
25
|
+
"@vitest/coverage-v8": "^1.0.4",
|
|
26
|
+
"@vitest/ui": "^1.3.1",
|
|
42
27
|
"eslint": "^9.8.0",
|
|
43
28
|
"eslint-config-prettier": "^9.0.0",
|
|
29
|
+
"eslint-plugin-prettier": "^5.2.2",
|
|
30
|
+
"jsdom": "~22.1.0",
|
|
31
|
+
"prettier": "^3.4.2",
|
|
44
32
|
"tsx": "^4.19.2",
|
|
33
|
+
"typescript": "~5.6.2",
|
|
45
34
|
"typescript-eslint": "^8.13.0",
|
|
35
|
+
"vite": "^5.0.0",
|
|
36
|
+
"vitest": "^1.3.1",
|
|
46
37
|
}
|
|
47
38
|
`;
|
|
48
39
|
|
|
49
40
|
exports[`infra generator > should add required dependencies to package.json > package-json 1`] = `
|
|
50
41
|
{
|
|
51
42
|
"dependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"aws-cdk": "^2.166.0",
|
|
54
|
-
"aws-cdk-lib": "^2.166.0",
|
|
55
|
-
"constructs": "^10.4.2",
|
|
56
|
-
"esbuild": "^0.24.0",
|
|
57
|
-
"source-map-support": "^0.5.21",
|
|
58
|
-
},
|
|
59
|
-
"devDependencies": {
|
|
60
|
-
"@eslint/js": "^9.8.0",
|
|
61
|
-
"@nx/eslint": "20.0.10",
|
|
62
|
-
"@nx/eslint-plugin": "20.0.10",
|
|
63
|
-
"eslint": "^9.8.0",
|
|
64
|
-
"eslint-config-prettier": "^9.0.0",
|
|
65
|
-
"tsx": "^4.19.2",
|
|
66
|
-
"typescript-eslint": "^8.0.0",
|
|
67
|
-
},
|
|
68
|
-
"name": "@proj/source",
|
|
69
|
-
"type": "module",
|
|
70
|
-
}
|
|
71
|
-
`;
|
|
72
|
-
|
|
73
|
-
exports[`infra generator > should add required dependencies to package.json > package-json 2`] = `
|
|
74
|
-
{
|
|
75
|
-
"dependencies": {
|
|
76
|
-
"@aws/pdk": "^0.25.7",
|
|
77
|
-
"aws-cdk": "^2.166.0",
|
|
78
|
-
"aws-cdk-lib": "^2.166.0",
|
|
79
|
-
"constructs": "^10.4.2",
|
|
80
|
-
"esbuild": "^0.24.0",
|
|
81
|
-
"source-map-support": "^0.5.21",
|
|
82
|
-
},
|
|
83
|
-
"devDependencies": {
|
|
84
|
-
"@eslint/js": "^9.8.0",
|
|
85
|
-
"@nx/eslint": "20.3.1",
|
|
86
|
-
"@nx/eslint-plugin": "20.3.1",
|
|
87
|
-
"eslint": "^9.8.0",
|
|
88
|
-
"eslint-config-prettier": "^9.0.0",
|
|
89
|
-
"tsx": "^4.19.2",
|
|
90
|
-
"typescript-eslint": "^8.13.0",
|
|
91
|
-
},
|
|
92
|
-
"name": "@proj/source",
|
|
93
|
-
"type": "module",
|
|
94
|
-
}
|
|
95
|
-
`;
|
|
96
|
-
|
|
97
|
-
exports[`infra generator > should add required dependencies to package.json > package-json 3`] = `
|
|
98
|
-
{
|
|
99
|
-
"dependencies": {
|
|
100
|
-
"@aws/pdk": "^0.25.7",
|
|
43
|
+
"@cdklabs/cdk-validator-cfnguard": "^0.0.60",
|
|
101
44
|
"aws-cdk": "^2.166.0",
|
|
102
45
|
"aws-cdk-lib": "^2.166.0",
|
|
103
46
|
"constructs": "^10.4.2",
|
|
@@ -108,10 +51,24 @@ exports[`infra generator > should add required dependencies to package.json > pa
|
|
|
108
51
|
"@eslint/js": "^9.8.0",
|
|
109
52
|
"@nx/eslint": "20.3.1",
|
|
110
53
|
"@nx/eslint-plugin": "20.3.1",
|
|
54
|
+
"@nx/js": "20.3.1",
|
|
55
|
+
"@nx/vite": "20.3.1",
|
|
56
|
+
"@nx/web": "20.3.1",
|
|
57
|
+
"@swc-node/register": "~1.9.1",
|
|
58
|
+
"@swc/core": "~1.5.7",
|
|
59
|
+
"@swc/helpers": "~0.5.11",
|
|
60
|
+
"@vitest/coverage-v8": "^1.0.4",
|
|
61
|
+
"@vitest/ui": "^1.3.1",
|
|
111
62
|
"eslint": "^9.8.0",
|
|
112
63
|
"eslint-config-prettier": "^9.0.0",
|
|
64
|
+
"eslint-plugin-prettier": "^5.2.2",
|
|
65
|
+
"jsdom": "~22.1.0",
|
|
66
|
+
"prettier": "^3.4.2",
|
|
113
67
|
"tsx": "^4.19.2",
|
|
68
|
+
"typescript": "~5.6.2",
|
|
114
69
|
"typescript-eslint": "^8.13.0",
|
|
70
|
+
"vite": "^5.0.0",
|
|
71
|
+
"vitest": "^1.3.1",
|
|
115
72
|
},
|
|
116
73
|
"name": "@proj/source",
|
|
117
74
|
"type": "module",
|
|
@@ -193,12 +150,12 @@ exports[`infra generator > should configure project.json with correct targets >
|
|
|
193
150
|
"executor": "@nx/eslint:lint",
|
|
194
151
|
},
|
|
195
152
|
"test": {
|
|
196
|
-
"executor": "@nx/
|
|
153
|
+
"executor": "@nx/vite:test",
|
|
197
154
|
"options": {
|
|
198
|
-
"
|
|
155
|
+
"reportsDirectory": "../../coverage/packages/test",
|
|
199
156
|
},
|
|
200
157
|
"outputs": [
|
|
201
|
-
"{
|
|
158
|
+
"{options.reportsDirectory}",
|
|
202
159
|
],
|
|
203
160
|
},
|
|
204
161
|
},
|
|
@@ -275,43 +232,24 @@ exports[`infra generator > should generate consistent file content across runs >
|
|
|
275
232
|
}
|
|
276
233
|
}
|
|
277
234
|
",
|
|
278
|
-
"src/main.ts": "import {
|
|
279
|
-
import { CdkGraphDiagramPlugin } from '@aws/pdk/cdk-graph-plugin-diagram';
|
|
280
|
-
import { CdkGraphThreatComposerPlugin } from '@aws/pdk/cdk-graph-plugin-threat-composer';
|
|
281
|
-
import { AwsPrototypingChecks, PDKNag } from '@aws/pdk/pdk-nag';
|
|
235
|
+
"src/main.ts": "import { App } from 'aws-cdk-lib';
|
|
282
236
|
import { ApplicationStack } from './stacks/application-stack.js';
|
|
237
|
+
import { CfnGuardValidator, RuleSet } from ':proj/common-constructs';
|
|
283
238
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
const graph = new CdkGraph(app, {
|
|
299
|
-
plugins: [
|
|
300
|
-
new CdkGraphDiagramPlugin({
|
|
301
|
-
defaults: {
|
|
302
|
-
filterPlan: {
|
|
303
|
-
preset: FilterPreset.COMPACT,
|
|
304
|
-
filters: [{ store: Filters.pruneCustomResources() }],
|
|
305
|
-
},
|
|
306
|
-
},
|
|
307
|
-
}),
|
|
308
|
-
new CdkGraphThreatComposerPlugin(),
|
|
309
|
-
],
|
|
310
|
-
});
|
|
239
|
+
const app = new App({
|
|
240
|
+
policyValidationBeta1: [new CfnGuardValidator(RuleSet.AWS_PROTOTYPING)],
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
// Use this to deploy your own sandbox environment (assumes your CLI credentials)
|
|
244
|
+
new ApplicationStack(app, 'test-sandbox', {
|
|
245
|
+
env: {
|
|
246
|
+
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
247
|
+
region: process.env.CDK_DEFAULT_REGION,
|
|
248
|
+
},
|
|
249
|
+
crossRegionReferences: true,
|
|
250
|
+
});
|
|
311
251
|
|
|
312
|
-
|
|
313
|
-
await graph.report();
|
|
314
|
-
})();
|
|
252
|
+
app.synth();
|
|
315
253
|
",
|
|
316
254
|
"src/stacks/application-stack.ts": "import * as cdk from 'aws-cdk-lib';
|
|
317
255
|
import { Construct } from 'constructs';
|
|
@@ -413,43 +351,24 @@ exports[`infra generator > should generate files with correct content > cdk-json
|
|
|
413
351
|
`;
|
|
414
352
|
|
|
415
353
|
exports[`infra generator > should generate files with correct content > main-ts 1`] = `
|
|
416
|
-
"import {
|
|
417
|
-
import { CdkGraphDiagramPlugin } from '@aws/pdk/cdk-graph-plugin-diagram';
|
|
418
|
-
import { CdkGraphThreatComposerPlugin } from '@aws/pdk/cdk-graph-plugin-threat-composer';
|
|
419
|
-
import { AwsPrototypingChecks, PDKNag } from '@aws/pdk/pdk-nag';
|
|
354
|
+
"import { App } from 'aws-cdk-lib';
|
|
420
355
|
import { ApplicationStack } from './stacks/application-stack.js';
|
|
356
|
+
import { CfnGuardValidator, RuleSet } from ':proj/common-constructs';
|
|
421
357
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
nagPacks: [new AwsPrototypingChecks()],
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
// Use this to deploy your own sandbox environment (assumes your CLI credentials)
|
|
429
|
-
new ApplicationStack(app, 'test-sandbox', {
|
|
430
|
-
env: {
|
|
431
|
-
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
432
|
-
region: process.env.CDK_DEFAULT_REGION,
|
|
433
|
-
},
|
|
434
|
-
});
|
|
435
|
-
|
|
436
|
-
const graph = new CdkGraph(app, {
|
|
437
|
-
plugins: [
|
|
438
|
-
new CdkGraphDiagramPlugin({
|
|
439
|
-
defaults: {
|
|
440
|
-
filterPlan: {
|
|
441
|
-
preset: FilterPreset.COMPACT,
|
|
442
|
-
filters: [{ store: Filters.pruneCustomResources() }],
|
|
443
|
-
},
|
|
444
|
-
},
|
|
445
|
-
}),
|
|
446
|
-
new CdkGraphThreatComposerPlugin(),
|
|
447
|
-
],
|
|
448
|
-
});
|
|
358
|
+
const app = new App({
|
|
359
|
+
policyValidationBeta1: [new CfnGuardValidator(RuleSet.AWS_PROTOTYPING)],
|
|
360
|
+
});
|
|
449
361
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
362
|
+
// Use this to deploy your own sandbox environment (assumes your CLI credentials)
|
|
363
|
+
new ApplicationStack(app, 'test-sandbox', {
|
|
364
|
+
env: {
|
|
365
|
+
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
366
|
+
region: process.env.CDK_DEFAULT_REGION,
|
|
367
|
+
},
|
|
368
|
+
crossRegionReferences: true,
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
app.synth();
|
|
453
372
|
"
|
|
454
373
|
`;
|
|
455
374
|
|
|
@@ -544,10 +463,10 @@ exports[`infra generator > should generate files with correct content > project-
|
|
|
544
463
|
"executor": "@nx/eslint:lint"
|
|
545
464
|
},
|
|
546
465
|
"test": {
|
|
547
|
-
"executor": "@nx/
|
|
548
|
-
"outputs": ["{
|
|
466
|
+
"executor": "@nx/vite:test",
|
|
467
|
+
"outputs": ["{options.reportsDirectory}"],
|
|
549
468
|
"options": {
|
|
550
|
-
"
|
|
469
|
+
"reportsDirectory": "../../coverage/packages/test"
|
|
551
470
|
}
|
|
552
471
|
},
|
|
553
472
|
"compile": {
|
|
@@ -570,43 +489,24 @@ exports[`infra generator > should generate files with correct content > project-
|
|
|
570
489
|
}
|
|
571
490
|
}
|
|
572
491
|
",
|
|
573
|
-
"src/main.ts": "import {
|
|
574
|
-
import { CdkGraphDiagramPlugin } from '@aws/pdk/cdk-graph-plugin-diagram';
|
|
575
|
-
import { CdkGraphThreatComposerPlugin } from '@aws/pdk/cdk-graph-plugin-threat-composer';
|
|
576
|
-
import { AwsPrototypingChecks, PDKNag } from '@aws/pdk/pdk-nag';
|
|
492
|
+
"src/main.ts": "import { App } from 'aws-cdk-lib';
|
|
577
493
|
import { ApplicationStack } from './stacks/application-stack.js';
|
|
494
|
+
import { CfnGuardValidator, RuleSet } from ':proj/common-constructs';
|
|
578
495
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
nagPacks: [new AwsPrototypingChecks()],
|
|
583
|
-
});
|
|
584
|
-
|
|
585
|
-
// Use this to deploy your own sandbox environment (assumes your CLI credentials)
|
|
586
|
-
new ApplicationStack(app, 'test-sandbox', {
|
|
587
|
-
env: {
|
|
588
|
-
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
589
|
-
region: process.env.CDK_DEFAULT_REGION,
|
|
590
|
-
},
|
|
591
|
-
});
|
|
592
|
-
|
|
593
|
-
const graph = new CdkGraph(app, {
|
|
594
|
-
plugins: [
|
|
595
|
-
new CdkGraphDiagramPlugin({
|
|
596
|
-
defaults: {
|
|
597
|
-
filterPlan: {
|
|
598
|
-
preset: FilterPreset.COMPACT,
|
|
599
|
-
filters: [{ store: Filters.pruneCustomResources() }],
|
|
600
|
-
},
|
|
601
|
-
},
|
|
602
|
-
}),
|
|
603
|
-
new CdkGraphThreatComposerPlugin(),
|
|
604
|
-
],
|
|
605
|
-
});
|
|
496
|
+
const app = new App({
|
|
497
|
+
policyValidationBeta1: [new CfnGuardValidator(RuleSet.AWS_PROTOTYPING)],
|
|
498
|
+
});
|
|
606
499
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
500
|
+
// Use this to deploy your own sandbox environment (assumes your CLI credentials)
|
|
501
|
+
new ApplicationStack(app, 'test-sandbox', {
|
|
502
|
+
env: {
|
|
503
|
+
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
504
|
+
region: process.env.CDK_DEFAULT_REGION,
|
|
505
|
+
},
|
|
506
|
+
crossRegionReferences: true,
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
app.synth();
|
|
610
510
|
",
|
|
611
511
|
"src/stacks/application-stack.ts": "import * as cdk from 'aws-cdk-lib';
|
|
612
512
|
import { Construct } from 'constructs';
|
|
@@ -698,43 +598,24 @@ exports[`infra generator > should generate valid CDK application code > cdk-json
|
|
|
698
598
|
`;
|
|
699
599
|
|
|
700
600
|
exports[`infra generator > should generate valid CDK application code > main-ts-content 1`] = `
|
|
701
|
-
"import {
|
|
702
|
-
import { CdkGraphDiagramPlugin } from '@aws/pdk/cdk-graph-plugin-diagram';
|
|
703
|
-
import { CdkGraphThreatComposerPlugin } from '@aws/pdk/cdk-graph-plugin-threat-composer';
|
|
704
|
-
import { AwsPrototypingChecks, PDKNag } from '@aws/pdk/pdk-nag';
|
|
601
|
+
"import { App } from 'aws-cdk-lib';
|
|
705
602
|
import { ApplicationStack } from './stacks/application-stack.js';
|
|
603
|
+
import { CfnGuardValidator, RuleSet } from ':proj/common-constructs';
|
|
706
604
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
});
|
|
720
|
-
|
|
721
|
-
const graph = new CdkGraph(app, {
|
|
722
|
-
plugins: [
|
|
723
|
-
new CdkGraphDiagramPlugin({
|
|
724
|
-
defaults: {
|
|
725
|
-
filterPlan: {
|
|
726
|
-
preset: FilterPreset.COMPACT,
|
|
727
|
-
filters: [{ store: Filters.pruneCustomResources() }],
|
|
728
|
-
},
|
|
729
|
-
},
|
|
730
|
-
}),
|
|
731
|
-
new CdkGraphThreatComposerPlugin(),
|
|
732
|
-
],
|
|
733
|
-
});
|
|
605
|
+
const app = new App({
|
|
606
|
+
policyValidationBeta1: [new CfnGuardValidator(RuleSet.AWS_PROTOTYPING)],
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
// Use this to deploy your own sandbox environment (assumes your CLI credentials)
|
|
610
|
+
new ApplicationStack(app, 'test-sandbox', {
|
|
611
|
+
env: {
|
|
612
|
+
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
613
|
+
region: process.env.CDK_DEFAULT_REGION,
|
|
614
|
+
},
|
|
615
|
+
crossRegionReferences: true,
|
|
616
|
+
});
|
|
734
617
|
|
|
735
|
-
|
|
736
|
-
await graph.report();
|
|
737
|
-
})();
|
|
618
|
+
app.synth();
|
|
738
619
|
"
|
|
739
620
|
`;
|
|
740
621
|
|
|
@@ -822,43 +703,24 @@ exports[`infra generator > should handle custom project names correctly > custom
|
|
|
822
703
|
}
|
|
823
704
|
}
|
|
824
705
|
",
|
|
825
|
-
"src/main.ts": "import {
|
|
826
|
-
import { CdkGraphDiagramPlugin } from '@aws/pdk/cdk-graph-plugin-diagram';
|
|
827
|
-
import { CdkGraphThreatComposerPlugin } from '@aws/pdk/cdk-graph-plugin-threat-composer';
|
|
828
|
-
import { AwsPrototypingChecks, PDKNag } from '@aws/pdk/pdk-nag';
|
|
706
|
+
"src/main.ts": "import { App } from 'aws-cdk-lib';
|
|
829
707
|
import { ApplicationStack } from './stacks/application-stack.js';
|
|
708
|
+
import { CfnGuardValidator, RuleSet } from ':proj/common-constructs';
|
|
830
709
|
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
});
|
|
844
|
-
|
|
845
|
-
const graph = new CdkGraph(app, {
|
|
846
|
-
plugins: [
|
|
847
|
-
new CdkGraphDiagramPlugin({
|
|
848
|
-
defaults: {
|
|
849
|
-
filterPlan: {
|
|
850
|
-
preset: FilterPreset.COMPACT,
|
|
851
|
-
filters: [{ store: Filters.pruneCustomResources() }],
|
|
852
|
-
},
|
|
853
|
-
},
|
|
854
|
-
}),
|
|
855
|
-
new CdkGraphThreatComposerPlugin(),
|
|
856
|
-
],
|
|
857
|
-
});
|
|
710
|
+
const app = new App({
|
|
711
|
+
policyValidationBeta1: [new CfnGuardValidator(RuleSet.AWS_PROTOTYPING)],
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
// Use this to deploy your own sandbox environment (assumes your CLI credentials)
|
|
715
|
+
new ApplicationStack(app, 'custom-infra-sandbox', {
|
|
716
|
+
env: {
|
|
717
|
+
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
718
|
+
region: process.env.CDK_DEFAULT_REGION,
|
|
719
|
+
},
|
|
720
|
+
crossRegionReferences: true,
|
|
721
|
+
});
|
|
858
722
|
|
|
859
|
-
|
|
860
|
-
await graph.report();
|
|
861
|
-
})();
|
|
723
|
+
app.synth();
|
|
862
724
|
",
|
|
863
725
|
"src/stacks/application-stack.ts": "import * as cdk from 'aws-cdk-lib';
|
|
864
726
|
import { Construct } from 'constructs';
|
|
@@ -922,12 +784,12 @@ exports[`infra generator > should handle custom project names correctly > custom
|
|
|
922
784
|
"executor": "@nx/eslint:lint",
|
|
923
785
|
},
|
|
924
786
|
"test": {
|
|
925
|
-
"executor": "@nx/
|
|
787
|
+
"executor": "@nx/vite:test",
|
|
926
788
|
"options": {
|
|
927
|
-
"
|
|
789
|
+
"reportsDirectory": "../../coverage/packages/custom-infra",
|
|
928
790
|
},
|
|
929
791
|
"outputs": [
|
|
930
|
-
"{
|
|
792
|
+
"{options.reportsDirectory}",
|
|
931
793
|
],
|
|
932
794
|
},
|
|
933
795
|
},
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# <%= fullyQualifiedName %>
|
|
2
|
+
This library was generated with [@aws/nx-plugin](https://github.com/awslabs/nx-plugin-for-aws/).
|
|
3
|
+
|
|
4
|
+
## Building
|
|
5
|
+
|
|
6
|
+
Run `<%= pkgMgrCmd %> nx build <%= fullyQualifiedName %> [--skip-nx-cache]` to build the application.
|
|
7
|
+
|
|
8
|
+
## Running unit tests
|
|
9
|
+
|
|
10
|
+
Run `<%= pkgMgrCmd %> nx test <%= fullyQualifiedName %>` to execute the unit tests via Vitest.
|
|
11
|
+
|
|
12
|
+
### Updating snapshots
|
|
13
|
+
|
|
14
|
+
To update snapshots, run the following command:
|
|
15
|
+
|
|
16
|
+
`<%= pkgMgrCmd %> nx test <%= fullyQualifiedName %> --configuration=update-snapshot`
|
|
17
|
+
|
|
18
|
+
## Run lint
|
|
19
|
+
|
|
20
|
+
Run `<%= pkgMgrCmd %> nx lint <%= fullyQualifiedName %>`
|
|
21
|
+
|
|
22
|
+
### Fixable issues
|
|
23
|
+
|
|
24
|
+
You can also automatically fix some lint errors by running the following command:
|
|
25
|
+
|
|
26
|
+
`<%= pkgMgrCmd %> nx lint <%= fullyQualifiedName %> --configuration=fix`
|
|
27
|
+
|
|
28
|
+
## Deploy to AWS
|
|
29
|
+
|
|
30
|
+
### Deploy all Stacks
|
|
31
|
+
|
|
32
|
+
Run `<%= pkgMgrCmd %> nx deploy <%= fullyQualifiedName %> --all`
|
|
33
|
+
|
|
34
|
+
### Deploy a single Stack
|
|
35
|
+
|
|
36
|
+
Run `<%= pkgMgrCmd %> nx deploy <%= fullyQualifiedName %> [stackName]`
|
|
37
|
+
|
|
38
|
+
### Hotswap deployment
|
|
39
|
+
|
|
40
|
+
> [!CAUTION]
|
|
41
|
+
> Not to be used in production deployments
|
|
42
|
+
|
|
43
|
+
Use the --hotswap flag with the deploy target to attempt to update your AWS resources directly instead of generating an AWS CloudFormation change set and deploying it. Deployment falls back to AWS CloudFormation deployment if hot swapping is not possible.
|
|
44
|
+
|
|
45
|
+
Currently hot swapping supports Lambda functions, Step Functions state machines, and Amazon ECS container images. The --hotswap flag also disables rollback (i.e., implies --no-rollback).
|
|
46
|
+
|
|
47
|
+
Run `<%= pkgMgrCmd %> nx deploy <%= fullyQualifiedName %> --hotswap --all`
|
|
48
|
+
|
|
49
|
+
## Cfn Guard Suppressions
|
|
50
|
+
|
|
51
|
+
There may be instances where you want to suppress certain rules on resources. You can do this in two ways:
|
|
52
|
+
|
|
53
|
+
### Supress a rule on a given construct
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { suppressRule } from '<%= scopeAlias %>common-constructs';
|
|
57
|
+
|
|
58
|
+
...
|
|
59
|
+
// suppresses the RULE_NAME for the given construct.
|
|
60
|
+
suppressRule(construct, 'RULE_NAME');
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Supress a rule on a descendant construct
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import { suppressRule } from '<%= scopeAlias %>common-constructs';
|
|
67
|
+
|
|
68
|
+
...
|
|
69
|
+
// Supresses the RULE_NAME for the construct or any of its descendants if it is an instance of Bucket
|
|
70
|
+
suppressRule(construct, 'RULE_NAME', (construct) => construct instanceof Bucket);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Useful links
|
|
74
|
+
|
|
75
|
+
- [Infra reference docs](TODO)
|
|
76
|
+
- [Learn more about NX](https://nx.dev/getting-started/intro)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { App } from 'aws-cdk-lib';
|
|
2
|
+
import { ApplicationStack } from './stacks/application-stack.js';
|
|
3
|
+
import { CfnGuardValidator, RuleSet } from '<%= scopeAlias %>common-constructs';
|
|
4
|
+
|
|
5
|
+
const app = new App({
|
|
6
|
+
policyValidationBeta1: [new CfnGuardValidator(RuleSet.<%= ruleSet %>)]
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
// Use this to deploy your own sandbox environment (assumes your CLI credentials)
|
|
10
|
+
new ApplicationStack(app, '<%= name %>-sandbox', {
|
|
11
|
+
env: {
|
|
12
|
+
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
13
|
+
region: process.env.CDK_DEFAULT_REGION,
|
|
14
|
+
},
|
|
15
|
+
crossRegionReferences: true
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
app.synth();
|