@aws/nx-plugin 1.0.0-rc.90 → 1.0.0-rc.92
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 +2 -2
- package/migrations.json +32 -27
- package/package.json +4 -4
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/internal/test-matrix/generator.js +28 -0
- package/src/internal/test-matrix/generator.js.map +1 -1
- package/src/migrations/latest/react-website-unique-dev-ports/metadata.json +3 -0
- package/src/migrations/latest/react-website-unique-dev-ports/migration.js +79 -0
- package/src/migrations/latest/react-website-unique-dev-ports/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.87/0001-add-destroy-sandbox-target/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.87/0002-terraform-rdb-proxy-iam-connect-grant/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.88/0001-python-version-drop-exact-patch/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.88/0001-python-version-drop-exact-patch/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.88/0002-react-website-nx-react-express-override/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.89/0001-nx-parallel-default/migration.js.map +1 -0
- package/src/preset/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +2 -2
- package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +1 -1
- package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +91 -116
- package/src/py/agent/files/package/main.py.template +13 -0
- package/src/py/agent/generator.d.ts +6 -1
- package/src/py/agent/generator.js +82 -45
- package/src/py/agent/generator.js.map +1 -1
- package/src/py/agent/schema.d.js.map +1 -1
- package/src/py/agent/schema.d.ts +2 -1
- package/src/py/agent/schema.json +2 -2
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +66 -115
- package/src/py/mcp-server/files/package/main.py.template +13 -0
- package/src/py/mcp-server/generator.d.ts +6 -1
- package/src/py/mcp-server/generator.js +79 -43
- package/src/py/mcp-server/generator.js.map +1 -1
- package/src/py/mcp-server/schema.d.js.map +1 -1
- package/src/py/mcp-server/schema.d.ts +2 -1
- package/src/py/mcp-server/schema.json +2 -2
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +14 -61
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +78 -115
- package/src/ts/agent/generator.d.ts +26 -1
- package/src/ts/agent/generator.js +71 -45
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/agent/schema.d.js.map +1 -1
- package/src/ts/agent/schema.d.ts +2 -1
- package/src/ts/agent/schema.json +2 -2
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +65 -114
- package/src/ts/mcp-server/generator.d.ts +26 -1
- package/src/ts/mcp-server/generator.js +66 -38
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/mcp-server/schema.d.js.map +1 -1
- package/src/ts/mcp-server/schema.d.ts +2 -1
- package/src/ts/mcp-server/schema.json +2 -2
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +16 -110
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +12 -10
- package/src/ts/react-website/app/generator.js +16 -0
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +1 -1
- package/src/ts/react-website/cognito-auth/generator.js +14 -2
- package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
- package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +25 -6
- package/src/utils/agent-core-constructs/agent-core-constructs.js +36 -7
- package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
- package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/__nameKebabCase__.ts.template +20 -4
- package/src/utils/agent-core-constructs/files/terraform/app/agent-core/__nameKebabCase__/__nameKebabCase__.tf.template +34 -1
- package/src/utils/agent-core-constructs/files/terraform/core/agent-core/runtime.tf.template +51 -112
- package/src/utils/agent-core-constructs/files/terraform/core/agent-core-code/runtime.tf.template +204 -0
- package/src/utils/agent-core-constructs/files/terraform/core/agent-core-container/runtime.tf.template +235 -0
- package/src/utils/agent-core-packaging.d.ts +119 -0
- package/src/utils/agent-core-packaging.js +131 -0
- package/src/utils/agent-core-packaging.js.map +1 -0
- package/src/utils/agent-core-runtime-resolution.d.ts +35 -0
- package/src/utils/agent-core-runtime-resolution.js +68 -0
- package/src/utils/agent-core-runtime-resolution.js.map +1 -0
- package/src/utils/files/terraform/src/core/asset-ecr/asset-ecr.tf.template +137 -0
- package/src/utils/identity-constructs/files/cdk/core/user-identity.ts.template +1 -1
- package/src/utils/identity-constructs/files/terraform/core/user-identity/identity/identity.tf.template +1 -4
- package/src/utils/identity-constructs/identity-constructs.d.ts +22 -2
- package/src/utils/identity-constructs/identity-constructs.js +75 -5
- package/src/utils/identity-constructs/identity-constructs.js.map +1 -1
- package/src/utils/port.d.ts +5 -0
- package/src/utils/port.js +1 -1
- package/src/utils/port.js.map +1 -1
- package/src/utils/rdb-constructs/files/terraform/app/dbs/__nameKebabCase__/__nameKebabCase__.tf.template +12 -59
- package/src/utils/versions.d.ts +51 -31
- package/src/utils/versions.js +48 -31
- package/src/utils/versions.js.map +1 -1
- package/src/migrations/latest/add-destroy-sandbox-target/migration.js.map +0 -1
- package/src/migrations/latest/nx-parallel-default/migration.js.map +0 -1
- package/src/migrations/latest/python-version-drop-exact-patch/migration.js.map +0 -1
- package/src/migrations/latest/react-website-nx-react-express-override/migration.js.map +0 -1
- package/src/migrations/latest/terraform-rdb-proxy-iam-connect-grant/migration.js.map +0 -1
- /package/src/migrations/latest/{add-destroy-sandbox-target → react-website-unique-dev-ports}/migration.d.ts +0 -0
- /package/src/migrations/{latest/add-destroy-sandbox-target → v1.0.0-rc.87/0001-add-destroy-sandbox-target}/metadata.json +0 -0
- /package/src/migrations/{latest/python-version-drop-exact-patch → v1.0.0-rc.87/0001-add-destroy-sandbox-target}/migration.d.ts +0 -0
- /package/src/migrations/{latest/add-destroy-sandbox-target → v1.0.0-rc.87/0001-add-destroy-sandbox-target}/migration.js +0 -0
- /package/src/migrations/{latest/terraform-rdb-proxy-iam-connect-grant → v1.0.0-rc.87/0002-terraform-rdb-proxy-iam-connect-grant}/__snapshots__/migration.spec.ts.snap +0 -0
- /package/src/migrations/{latest/terraform-rdb-proxy-iam-connect-grant → v1.0.0-rc.87/0002-terraform-rdb-proxy-iam-connect-grant}/metadata.json +0 -0
- /package/src/migrations/{latest/terraform-rdb-proxy-iam-connect-grant → v1.0.0-rc.87/0002-terraform-rdb-proxy-iam-connect-grant}/migration.d.ts +0 -0
- /package/src/migrations/{latest/terraform-rdb-proxy-iam-connect-grant → v1.0.0-rc.87/0002-terraform-rdb-proxy-iam-connect-grant}/migration.js +0 -0
- /package/src/migrations/{latest/python-version-drop-exact-patch → v1.0.0-rc.88/0001-python-version-drop-exact-patch}/metadata.json +0 -0
- /package/src/migrations/{latest/python-version-drop-exact-patch → v1.0.0-rc.88/0001-python-version-drop-exact-patch}/migration.js +0 -0
- /package/src/migrations/{latest/react-website-nx-react-express-override → v1.0.0-rc.88/0002-react-website-nx-react-express-override}/metadata.json +0 -0
- /package/src/migrations/{latest/react-website-nx-react-express-override → v1.0.0-rc.88/0002-react-website-nx-react-express-override}/migration.d.ts +0 -0
- /package/src/migrations/{latest/react-website-nx-react-express-override → v1.0.0-rc.88/0002-react-website-nx-react-express-override}/migration.js +0 -0
- /package/src/migrations/{latest/nx-parallel-default → v1.0.0-rc.89/0001-nx-parallel-default}/metadata.json +0 -0
- /package/src/migrations/{latest/nx-parallel-default → v1.0.0-rc.89/0001-nx-parallel-default}/migration.d.ts +0 -0
- /package/src/migrations/{latest/nx-parallel-default → v1.0.0-rc.89/0001-nx-parallel-default}/migration.js +0 -0
- /package/src/ts/mcp-server/files/{http.ts.template → app/http.ts.template} +0 -0
- /package/src/ts/mcp-server/files/{index.ts.template → app/index.ts.template} +0 -0
- /package/src/ts/mcp-server/files/{resources → app/resources}/sample-guidance.ts.template +0 -0
- /package/src/ts/mcp-server/files/{server.ts.template → app/server.ts.template} +0 -0
- /package/src/ts/mcp-server/files/{stdio.ts.template → app/stdio.ts.template} +0 -0
- /package/src/ts/mcp-server/files/{tools → app/tools}/divide.ts.template +0 -0
- /package/src/ts/mcp-server/files/{Dockerfile.template → deploy/Dockerfile.template} +0 -0
package/LICENSE-THIRD-PARTY
CHANGED
|
@@ -217,7 +217,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|
|
217
217
|
|
|
218
218
|
---
|
|
219
219
|
|
|
220
|
-
The following software may be included in this product: @astral-sh/ruff-wasm-nodejs (0.16.
|
|
220
|
+
The following software may be included in this product: @astral-sh/ruff-wasm-nodejs (0.16.5)
|
|
221
221
|
This software contains the following license and notice below:
|
|
222
222
|
|
|
223
223
|
MIT License
|
|
@@ -26613,7 +26613,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|
|
26613
26613
|
|
|
26614
26614
|
---
|
|
26615
26615
|
|
|
26616
|
-
The following software may be included in this product: zod (4.4
|
|
26616
|
+
The following software may be included in this product: zod (4.5.4)
|
|
26617
26617
|
This software contains the following license and notice below:
|
|
26618
26618
|
|
|
26619
26619
|
MIT License
|
package/migrations.json
CHANGED
|
@@ -2,31 +2,6 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/schema",
|
|
3
3
|
"name": "@aws/nx-plugin",
|
|
4
4
|
"generators": {
|
|
5
|
-
"latest-add-destroy-sandbox-target": {
|
|
6
|
-
"version": "1.0.0-rc.87",
|
|
7
|
-
"description": "Add a destroy-sandbox target to CDK infrastructure projects which destroys the sandbox stage, and drop the --require-approval flag from cdk destroy, which has no such option",
|
|
8
|
-
"implementation": "./src/migrations/latest/add-destroy-sandbox-target/migration"
|
|
9
|
-
},
|
|
10
|
-
"latest-terraform-rdb-proxy-iam-connect-grant": {
|
|
11
|
-
"version": "1.0.0-rc.87",
|
|
12
|
-
"description": "Replace the MySQL RDS Proxy role's admin secret access with the rds-db:connect grant it needs for end-to-end IAM auth",
|
|
13
|
-
"implementation": "./src/migrations/latest/terraform-rdb-proxy-iam-connect-grant/migration"
|
|
14
|
-
},
|
|
15
|
-
"latest-python-version-drop-exact-patch": {
|
|
16
|
-
"version": "1.0.0-rc.88",
|
|
17
|
-
"description": "Drop the exact CPython patch from .python-version to the Lambda runtime's major.minor",
|
|
18
|
-
"implementation": "./src/migrations/latest/python-version-drop-exact-patch/migration"
|
|
19
|
-
},
|
|
20
|
-
"latest-react-website-nx-react-express-override": {
|
|
21
|
-
"version": "1.0.0-rc.88",
|
|
22
|
-
"description": "Add an npm override pinning the express @nx/react resolves to the version generated websites use, so npm can satisfy its optional peer",
|
|
23
|
-
"implementation": "./src/migrations/latest/react-website-nx-react-express-override/migration"
|
|
24
|
-
},
|
|
25
|
-
"latest-nx-parallel-default": {
|
|
26
|
-
"version": "1.0.0-rc.89",
|
|
27
|
-
"description": "Set nx.json parallel to 8 so full builds use available cores, preserving an existing value",
|
|
28
|
-
"implementation": "./src/migrations/latest/nx-parallel-default/migration"
|
|
29
|
-
},
|
|
30
5
|
"latest-dev-target-depends-on-pull-image": {
|
|
31
6
|
"version": "1.0.0-rc.90",
|
|
32
7
|
"description": "Add dependsOn pull-image to the dev target of ts#dynamodb and ts#rdb projects",
|
|
@@ -72,6 +47,11 @@
|
|
|
72
47
|
"description": "Make the terraform fmt target check formatting rather than rewrite its own inputs, moving the write to a fix configuration, and add a lint target which orchestrates it",
|
|
73
48
|
"implementation": "./src/migrations/latest/terraform-fmt-check/migration"
|
|
74
49
|
},
|
|
50
|
+
"latest-react-website-unique-dev-ports": {
|
|
51
|
+
"version": "1.0.0-rc.92",
|
|
52
|
+
"description": "Assign each react-website project its own dev-server and preview port, and allow-list them for any connected Cognito auth",
|
|
53
|
+
"implementation": "./src/migrations/latest/react-website-unique-dev-ports/migration"
|
|
54
|
+
},
|
|
75
55
|
"v1.0.0-rc.50-0001-modernize-function-props-cast": {
|
|
76
56
|
"version": "1.0.0-rc.50",
|
|
77
57
|
"description": "Replace the legacy angle-bracket FunctionProps type assertion with the modern as syntax in generated API constructs",
|
|
@@ -287,8 +267,33 @@
|
|
|
287
267
|
"description": "Add the Terraform checkov target and config, make bootstrap-destroy non-interactive, and declare required_version in the vended providers.tf",
|
|
288
268
|
"implementation": "./src/migrations/v1.0.0-rc.85/0001-terraform-project-checkov-target-and-bootstrap-destroy/migration"
|
|
289
269
|
},
|
|
270
|
+
"v1.0.0-rc.87-0001-add-destroy-sandbox-target": {
|
|
271
|
+
"version": "1.0.0-rc.87",
|
|
272
|
+
"description": "Add a destroy-sandbox target to CDK infrastructure projects which destroys the sandbox stage, and drop the --require-approval flag from cdk destroy, which has no such option",
|
|
273
|
+
"implementation": "./src/migrations/v1.0.0-rc.87/0001-add-destroy-sandbox-target/migration"
|
|
274
|
+
},
|
|
275
|
+
"v1.0.0-rc.87-0002-terraform-rdb-proxy-iam-connect-grant": {
|
|
276
|
+
"version": "1.0.0-rc.87",
|
|
277
|
+
"description": "Replace the MySQL RDS Proxy role's admin secret access with the rds-db:connect grant it needs for end-to-end IAM auth",
|
|
278
|
+
"implementation": "./src/migrations/v1.0.0-rc.87/0002-terraform-rdb-proxy-iam-connect-grant/migration"
|
|
279
|
+
},
|
|
280
|
+
"v1.0.0-rc.88-0001-python-version-drop-exact-patch": {
|
|
281
|
+
"version": "1.0.0-rc.88",
|
|
282
|
+
"description": "Drop the exact CPython patch from .python-version to the Lambda runtime's major.minor",
|
|
283
|
+
"implementation": "./src/migrations/v1.0.0-rc.88/0001-python-version-drop-exact-patch/migration"
|
|
284
|
+
},
|
|
285
|
+
"v1.0.0-rc.88-0002-react-website-nx-react-express-override": {
|
|
286
|
+
"version": "1.0.0-rc.88",
|
|
287
|
+
"description": "Add an npm override pinning the express @nx/react resolves to the version generated websites use, so npm can satisfy its optional peer",
|
|
288
|
+
"implementation": "./src/migrations/v1.0.0-rc.88/0002-react-website-nx-react-express-override/migration"
|
|
289
|
+
},
|
|
290
|
+
"v1.0.0-rc.89-0001-nx-parallel-default": {
|
|
291
|
+
"version": "1.0.0-rc.89",
|
|
292
|
+
"description": "Set nx.json parallel to 8 so full builds use available cores, preserving an existing value",
|
|
293
|
+
"implementation": "./src/migrations/v1.0.0-rc.89/0001-nx-parallel-default/migration"
|
|
294
|
+
},
|
|
290
295
|
"sync-vended-versions": {
|
|
291
|
-
"version": "1.0.0-rc.
|
|
296
|
+
"version": "1.0.0-rc.92",
|
|
292
297
|
"description": "Sync vended dependency versions and the tracked plugin version to those vended by this release",
|
|
293
298
|
"implementation": "./src/utils/version-upgrade-migration/migration"
|
|
294
299
|
}
|
|
@@ -328,7 +333,7 @@
|
|
|
328
333
|
}
|
|
329
334
|
},
|
|
330
335
|
"nx-23.1.2-nx-packages": {
|
|
331
|
-
"version": "1.0.0-rc.
|
|
336
|
+
"version": "1.0.0-rc.88",
|
|
332
337
|
"packages": {
|
|
333
338
|
"nx": {
|
|
334
339
|
"version": "23.1.2",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws/nx-plugin",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.92",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/awslabs/nx-plugin-for-aws.git",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@apidevtools/swagger-parser": "12.1.0",
|
|
43
|
-
"@astral-sh/ruff-wasm-nodejs": "0.16.
|
|
43
|
+
"@astral-sh/ruff-wasm-nodejs": "0.16.5",
|
|
44
44
|
"@biomejs/js-api": "6.0.0",
|
|
45
|
-
"@biomejs/wasm-nodejs": "2.5.
|
|
45
|
+
"@biomejs/wasm-nodejs": "2.5.11",
|
|
46
46
|
"@getgrit/gritql": "0.0.3",
|
|
47
47
|
"@iarna/toml": "2.2.5",
|
|
48
48
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"unist-util-visit": "5.1.0",
|
|
82
82
|
"vite": "8.2.2",
|
|
83
83
|
"vitest": "4.1.11",
|
|
84
|
-
"zod": "4.4
|
|
84
|
+
"zod": "4.5.4"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@types/semver": "7.8.0"
|
|
@@ -56,7 +56,7 @@ exports[`infra generator > should configure Checkov target correctly > checkov-t
|
|
|
56
56
|
"{workspaceRoot}/dist/{projectRoot}/cdk.out",
|
|
57
57
|
],
|
|
58
58
|
"options": {
|
|
59
|
-
"command": "uvx --from checkov==3.3.
|
|
59
|
+
"command": "uvx --from checkov==3.3.16 checkov --config-file {projectRoot}/checkov.yml --directory dist/{projectRoot}/cdk.out --framework cloudformation",
|
|
60
60
|
},
|
|
61
61
|
"outputs": [
|
|
62
62
|
"{workspaceRoot}/dist/{projectRoot}/checkov",
|
|
@@ -156,7 +156,7 @@ exports[`infra generator > should configure project.json with correct targets >
|
|
|
156
156
|
"{workspaceRoot}/dist/{projectRoot}/cdk.out",
|
|
157
157
|
],
|
|
158
158
|
"options": {
|
|
159
|
-
"command": "uvx --from checkov==3.3.
|
|
159
|
+
"command": "uvx --from checkov==3.3.16 checkov --config-file {projectRoot}/checkov.yml --directory dist/{projectRoot}/cdk.out --framework cloudformation",
|
|
160
160
|
},
|
|
161
161
|
"outputs": [
|
|
162
162
|
"{workspaceRoot}/dist/{projectRoot}/checkov",
|
|
@@ -768,7 +768,7 @@ exports[`infra generator > should handle custom project names correctly > custom
|
|
|
768
768
|
"{workspaceRoot}/dist/{projectRoot}/cdk.out",
|
|
769
769
|
],
|
|
770
770
|
"options": {
|
|
771
|
-
"command": "uvx --from checkov==3.3.
|
|
771
|
+
"command": "uvx --from checkov==3.3.16 checkov --config-file {projectRoot}/checkov.yml --directory dist/{projectRoot}/cdk.out --framework cloudformation",
|
|
772
772
|
},
|
|
773
773
|
"outputs": [
|
|
774
774
|
"{workspaceRoot}/dist/{projectRoot}/checkov",
|
|
@@ -238,6 +238,22 @@ import { getNpmScope, getNpmScopePrefix } from "../../utils/npm-scope.js";
|
|
|
238
238
|
iac: 'inherit',
|
|
239
239
|
...defaults
|
|
240
240
|
});
|
|
241
|
+
// Container-packaged variants, so both packagings are covered and a workspace
|
|
242
|
+
// mixing them vends one copy of the shared runtime module.
|
|
243
|
+
await tsMcpServerGenerator(tree, {
|
|
244
|
+
project: 'ts-project',
|
|
245
|
+
name: 'ecr-mcp-server',
|
|
246
|
+
infra: 'agentcore-ecr',
|
|
247
|
+
iac: 'inherit',
|
|
248
|
+
...defaults
|
|
249
|
+
});
|
|
250
|
+
await pyMcpServerGenerator(tree, {
|
|
251
|
+
project: 'py_project',
|
|
252
|
+
name: 'ecr-mcp-server',
|
|
253
|
+
infra: 'agentcore-ecr',
|
|
254
|
+
iac: 'inherit',
|
|
255
|
+
...defaults
|
|
256
|
+
});
|
|
241
257
|
// OAuth DCR proxy for Cognito-authenticated MCP servers.
|
|
242
258
|
await tsDcrProxyGenerator(tree, {
|
|
243
259
|
name: 'my-dcr-proxy',
|
|
@@ -258,6 +274,12 @@ import { getNpmScope, getNpmScopePrefix } from "../../utils/npm-scope.js";
|
|
|
258
274
|
infra: 'agentcore',
|
|
259
275
|
iac: 'inherit'
|
|
260
276
|
},
|
|
277
|
+
{
|
|
278
|
+
project: 'ts-project',
|
|
279
|
+
name: 'my-ts-ecr-agent',
|
|
280
|
+
infra: 'agentcore-ecr',
|
|
281
|
+
iac: 'inherit'
|
|
282
|
+
},
|
|
261
283
|
{
|
|
262
284
|
project: 'ts-project',
|
|
263
285
|
name: 'my-ts-a2a-agent',
|
|
@@ -297,6 +319,12 @@ import { getNpmScope, getNpmScopePrefix } from "../../utils/npm-scope.js";
|
|
|
297
319
|
infra: 'agentcore',
|
|
298
320
|
iac: 'inherit'
|
|
299
321
|
},
|
|
322
|
+
{
|
|
323
|
+
project: 'py_project',
|
|
324
|
+
name: 'my-py-ecr-agent',
|
|
325
|
+
infra: 'agentcore-ecr',
|
|
326
|
+
iac: 'inherit'
|
|
327
|
+
},
|
|
300
328
|
{
|
|
301
329
|
project: 'py_project',
|
|
302
330
|
name: 'my-py-a2a-agent',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/internal/test-matrix/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { GeneratorCallback, Tree } from '@nx/devkit';\nimport { agentcoreGatewayGenerator } from '../../sdk/agentcore-gateway.js';\nimport { agentcoreHarnessGenerator } from '../../sdk/agentcore-harness.js';\nimport {\n type ConnectionGeneratorSchema,\n connectionGenerator,\n} from '../../sdk/connection.js';\nimport { licenseGenerator } from '../../sdk/license.js';\nimport {\n type PyAgentGeneratorSchema,\n type PyApiGeneratorSchema,\n type PyRdbGeneratorSchema,\n pyAgentGenerator,\n pyApiGenerator,\n pyDynamoDBGenerator,\n pyLambdaFunctionGenerator,\n pyMcpServerGenerator,\n pyProjectGenerator,\n pyRdbGenerator,\n} from '../../sdk/py.js';\nimport { smithyProjectGenerator } from '../../sdk/smithy.js';\nimport { terraformProjectGenerator } from '../../sdk/terraform.js';\nimport {\n type TsAgentGeneratorSchema,\n type TsApiGeneratorSchema,\n type TsNxMigrationGeneratorSchema,\n type TsRdbGeneratorSchema,\n tsAgentGenerator,\n tsApiGenerator,\n tsAstroDocsGenerator,\n tsDcrProxyGenerator,\n tsDynamoDBGenerator,\n tsInfraGenerator,\n tsLambdaFunctionGenerator,\n tsMcpServerGenerator,\n tsNxGeneratorGenerator,\n tsNxMigrationGenerator,\n tsNxPluginGenerator,\n tsProjectGenerator,\n tsRdbGenerator,\n tsWebsiteAuthGenerator,\n tsWebsiteGenerator,\n} from '../../sdk/ts.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { toSnakeCase } from '../../utils/names.js';\nimport { getNpmScope, getNpmScopePrefix } from '../../utils/npm-scope.js';\nimport type { InternalTestMatrixGeneratorSchema } from './schema';\n\n/**\n * Scaffolds every generator, component and connection permutation the e2e tests\n * cover, by composing the generators in-process on a single tree.\n *\n * This ships with the plugin so each released version carries the matrix of the\n * generators *it* had. A test upgrading an old workspace scaffolds with the\n * released version's own matrix and never has to reason about which generators\n * existed when — driving the CLI from the test repo instead would couple the\n * test to a generator list that only describes today's plugin.\n *\n * Hidden and undocumented: it exists for the e2e suite, not for users.\n *\n * Options are typed against each generator's schema, so adding a required option\n * or changing an enum breaks the build here rather than silently reducing\n * coverage.\n *\n * Projects are generated with `preferInstallDependencies: false` by default and\n * the returned callback installs once. Nothing composed here reads the project\n * graph (only `ts#sync` does, which is not part of the matrix), so no\n * intermediate install is needed.\n */\nexport const internalTestMatrixGenerator = async (\n tree: Tree,\n options: InternalTestMatrixGeneratorSchema = {},\n): Promise<GeneratorCallback> => {\n const preferInstallDependencies = options.preferInstallDependencies ?? false;\n const defaults = { preferInstallDependencies };\n const projectDefaults = { ...defaults, directory: 'packages' };\n // Fully-qualified project names, which differ per language: TypeScript\n // projects are scope-prefixed, Python ones are dotted snake_case. Derived from\n // the workspace rather than hardcoded, so the matrix works in any workspace.\n const ts = (name: string) => `${getNpmScopePrefix(tree)}${name}`;\n const py = (name: string) =>\n `${toSnakeCase(getNpmScope(tree))}.${toSnakeCase(name)}`;\n\n // The infrastructure project every other generator deploys into. Which\n // generator owns it depends on the workspace's IaC provider, so the caller\n // asks for the one matching the workspace it created.\n if (options.infra === 'terraform') {\n await terraformProjectGenerator(tree, {\n name: 'infra',\n type: 'application',\n ...projectDefaults,\n });\n } else {\n await tsInfraGenerator(tree, { name: 'infra', ...projectDefaults });\n // A second CDK app with stage config, which only ts#infra offers.\n await tsInfraGenerator(tree, {\n name: 'infra-with-stages',\n stageConfig: true,\n ...projectDefaults,\n });\n }\n\n // Websites (with and without TanStack Router), a docs site, and auth on each.\n await tsWebsiteGenerator(tree, {\n name: 'website',\n iac: 'inherit',\n ...projectDefaults,\n });\n await tsWebsiteGenerator(tree, {\n name: 'website-no-router',\n tanstackRouter: false,\n iac: 'inherit',\n ...projectDefaults,\n });\n await tsAstroDocsGenerator(tree, { name: 'docs-site', ...defaults });\n await tsWebsiteAuthGenerator(tree, {\n project: ts('website'),\n cognitoDomain: 'test',\n allowSignup: true,\n iac: 'inherit',\n ...defaults,\n });\n await tsWebsiteAuthGenerator(tree, {\n project: ts('website-no-router'),\n cognitoDomain: 'test-no-router',\n allowSignup: true,\n iac: 'inherit',\n ...defaults,\n });\n\n // tRPC APIs — REST + HTTP, with Cognito and custom auth.\n const tsApis: TsApiGeneratorSchema[] = [\n { name: 'my-api', infra: 'rest-lambda', auth: 'iam', iac: 'inherit' },\n { name: 'my-api-http', infra: 'http-lambda', auth: 'iam', iac: 'inherit' },\n // The APIs above take the default `isolated` integration pattern; these\n // cover `shared`.\n {\n name: 'my-api-shared',\n infra: 'rest-lambda',\n auth: 'iam',\n integrationPattern: 'shared',\n iac: 'inherit',\n },\n {\n name: 'my-api-shared-http',\n infra: 'http-lambda',\n auth: 'iam',\n integrationPattern: 'shared',\n iac: 'inherit',\n },\n {\n name: 'my-api-custom',\n infra: 'rest-lambda',\n auth: 'custom',\n iac: 'inherit',\n },\n {\n name: 'my-api-custom-http',\n infra: 'http-lambda',\n auth: 'custom',\n iac: 'inherit',\n },\n {\n name: 'my-smithy-api',\n framework: 'smithy',\n infra: 'rest-lambda',\n auth: 'iam',\n iac: 'inherit',\n },\n ];\n for (const api of tsApis) {\n await tsApiGenerator(tree, { ...api, ...projectDefaults });\n }\n\n // A Smithy shape library; `my-smithy-api` covers consuming one.\n await smithyProjectGenerator(tree, {\n name: 'my-shapes',\n type: 'shapes',\n ...projectDefaults,\n });\n\n // Python FastAPI — REST + HTTP, with Cognito and custom auth.\n const pyApis: PyApiGeneratorSchema[] = [\n { name: 'py-api', infra: 'rest-lambda', auth: 'iam', iac: 'inherit' },\n { name: 'py-api-http', infra: 'http-lambda', auth: 'iam', iac: 'inherit' },\n {\n name: 'py-api-custom',\n infra: 'rest-lambda',\n auth: 'custom',\n iac: 'inherit',\n },\n {\n name: 'py-api-custom-http',\n infra: 'http-lambda',\n auth: 'custom',\n iac: 'inherit',\n },\n ];\n for (const api of pyApis) {\n await pyApiGenerator(tree, { ...api, ...projectDefaults });\n }\n\n // Library projects hosting the components below, each with a lambda function.\n await pyProjectGenerator(tree, {\n name: 'py-project',\n type: 'application',\n ...projectDefaults,\n });\n await tsProjectGenerator(tree, { name: 'ts-project', ...projectDefaults });\n await pyLambdaFunctionGenerator(tree, {\n project: py('py-project'),\n name: 'my-function',\n event: 'Any',\n iac: 'inherit',\n ...defaults,\n });\n await tsLambdaFunctionGenerator(tree, {\n project: 'ts-project',\n name: 'my-function',\n event: 'Any',\n iac: 'inherit',\n ...defaults,\n });\n\n // MCP servers — uninfra'd and hosted on AgentCore.\n await pyMcpServerGenerator(tree, {\n project: 'py_project',\n name: 'my-mcp-server',\n infra: 'agentcore',\n iac: 'inherit',\n ...defaults,\n });\n await tsMcpServerGenerator(tree, {\n project: 'ts-project',\n name: 'my-mcp-server',\n infra: 'none',\n iac: 'inherit',\n ...defaults,\n });\n await tsMcpServerGenerator(tree, {\n project: 'ts-project',\n name: 'hosted-mcp-server',\n infra: 'agentcore',\n iac: 'inherit',\n ...defaults,\n });\n\n // OAuth DCR proxy for Cognito-authenticated MCP servers.\n await tsDcrProxyGenerator(tree, {\n name: 'my-dcr-proxy',\n iac: 'inherit',\n ...projectDefaults,\n });\n\n // TypeScript agents across every protocol and auth permutation. The unnamed\n // one takes the generator's default name, which the connections below use.\n const tsAgents: TsAgentGeneratorSchema[] = [\n {\n project: 'ts-project',\n name: 'my-ts-agent',\n infra: 'none',\n iac: 'inherit',\n },\n { project: 'ts-project', infra: 'agentcore', iac: 'inherit' },\n {\n project: 'ts-project',\n name: 'my-ts-a2a-agent',\n protocol: 'a2a',\n infra: 'agentcore',\n iac: 'inherit',\n },\n {\n project: 'ts-project',\n name: 'my-ts-a2a-agent-cognito',\n protocol: 'a2a',\n auth: 'cognito',\n infra: 'agentcore',\n iac: 'inherit',\n },\n {\n project: 'ts-project',\n name: 'my-ts-agui-agent',\n protocol: 'ag-ui',\n infra: 'agentcore',\n iac: 'inherit',\n },\n ];\n for (const agent of tsAgents) {\n await tsAgentGenerator(tree, { ...agent, ...defaults });\n }\n\n // Python agents: Strands across every protocol, plus LangChain in its own\n // project — langchain's dependency closure would push the zip-bundled Lambda\n // in py-project past its unzipped size limit.\n const pyAgents: PyAgentGeneratorSchema[] = [\n {\n project: 'py_project',\n name: 'my-agent',\n infra: 'agentcore',\n iac: 'inherit',\n },\n {\n project: 'py_project',\n name: 'my-py-a2a-agent',\n protocol: 'a2a',\n infra: 'agentcore',\n iac: 'inherit',\n },\n {\n project: 'py_project',\n name: 'my-py-a2a-agent-cognito',\n protocol: 'a2a',\n auth: 'cognito',\n infra: 'agentcore',\n iac: 'inherit',\n },\n {\n project: 'py_project',\n name: 'my-py-agui-agent',\n protocol: 'ag-ui',\n infra: 'agentcore',\n iac: 'inherit',\n },\n ];\n for (const agent of pyAgents) {\n await pyAgentGenerator(tree, { ...agent, ...defaults });\n }\n await pyProjectGenerator(tree, {\n name: 'py-langchain-project',\n type: 'application',\n ...projectDefaults,\n });\n const langchainAgents: PyAgentGeneratorSchema[] = [\n {\n project: 'py_langchain_project',\n name: 'my-py-langchain-agent',\n protocol: 'ag-ui',\n iac: 'inherit',\n },\n {\n project: 'py_langchain_project',\n name: 'my-py-langchain-http-agent',\n protocol: 'http',\n iac: 'inherit',\n },\n {\n project: 'py_langchain_project',\n name: 'my-py-langchain-a2a-agent',\n protocol: 'a2a',\n iac: 'inherit',\n },\n ];\n for (const agent of langchainAgents) {\n await pyAgentGenerator(tree, {\n ...agent,\n framework: 'langchain',\n infra: 'agentcore',\n ...defaults,\n });\n }\n\n // AgentCore gateways, including a parent fronting the first (chained), and\n // an http-protocol gateway fronting agent runtime targets.\n await agentcoreGatewayGenerator(tree, {\n name: 'my-gateway',\n iac: 'inherit',\n ...projectDefaults,\n });\n await agentcoreGatewayGenerator(tree, {\n name: 'parent-gateway',\n iac: 'inherit',\n ...projectDefaults,\n });\n await agentcoreGatewayGenerator(tree, {\n name: 'agent-gateway',\n protocol: 'http',\n iac: 'inherit',\n ...projectDefaults,\n });\n\n // AgentCore Harness — a standalone invocation project.\n await agentcoreHarnessGenerator(tree, {\n name: 'my-harness',\n infra: 'agentcore',\n iac: 'inherit',\n ...projectDefaults,\n });\n\n // Databases — DynamoDB, plus Aurora across both engines and ORMs.\n await tsDynamoDBGenerator(tree, {\n name: 'my-table',\n framework: 'electrodb',\n infra: 'dynamodb',\n iac: 'inherit',\n ...projectDefaults,\n });\n await pyDynamoDBGenerator(tree, {\n name: 'my-py-table',\n framework: 'pynamodb',\n infra: 'dynamodb',\n iac: 'inherit',\n ...projectDefaults,\n });\n const tsRdbs: TsRdbGeneratorSchema[] = [\n {\n name: 'postgres-db',\n infra: 'aurora',\n engine: 'postgres',\n framework: 'prisma',\n iac: 'inherit',\n },\n {\n name: 'my-sql-db',\n infra: 'aurora',\n engine: 'mysql',\n framework: 'prisma',\n iac: 'inherit',\n },\n ];\n for (const rdb of tsRdbs) {\n await tsRdbGenerator(tree, { ...rdb, ...projectDefaults });\n }\n const pyRdbs: PyRdbGeneratorSchema[] = [\n {\n name: 'py-postgres-db',\n infra: 'aurora',\n engine: 'postgres',\n framework: 'sqlmodel',\n iac: 'inherit',\n },\n {\n name: 'py-mysql-db',\n infra: 'aurora',\n engine: 'mysql',\n framework: 'sqlmodel',\n iac: 'inherit',\n },\n ];\n for (const rdb of pyRdbs) {\n await pyRdbGenerator(tree, { ...rdb, ...projectDefaults });\n }\n\n // Every connection edge the matrix covers.\n const connections: ConnectionGeneratorSchema[] = [\n // Website -> API\n { sourceProject: ts('website'), targetProject: ts('my-api') },\n { sourceProject: ts('website-no-router'), targetProject: ts('my-api') },\n { sourceProject: 'website', targetProject: 'py_api' },\n { sourceProject: 'website', targetProject: 'my-smithy-api' },\n // Agent -> MCP server\n {\n sourceProject: 'ts-project',\n sourceComponent: 'agent',\n targetProject: 'ts-project',\n targetComponent: 'hosted-mcp-server',\n },\n {\n sourceProject: 'ts-project',\n sourceComponent: 'my-ts-agui-agent',\n targetProject: 'ts-project',\n targetComponent: 'hosted-mcp-server',\n },\n {\n sourceProject: 'ts-project',\n sourceComponent: 'agent',\n targetProject: 'py_project',\n targetComponent: 'my-mcp-server',\n },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-agent',\n targetProject: 'py_project',\n targetComponent: 'my-mcp-server',\n },\n {\n sourceProject: 'py_langchain_project',\n sourceComponent: 'my-py-langchain-agent',\n targetProject: 'py_project',\n targetComponent: 'my-mcp-server',\n },\n // HTTP agent <-> A2A agent\n {\n sourceProject: 'ts-project',\n sourceComponent: 'agent',\n targetProject: 'ts-project',\n targetComponent: 'my-ts-a2a-agent',\n },\n {\n sourceProject: 'ts-project',\n sourceComponent: 'agent',\n targetProject: 'py_project',\n targetComponent: 'my-py-a2a-agent',\n },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-agent',\n targetProject: 'ts-project',\n targetComponent: 'my-ts-a2a-agent',\n },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-agent',\n targetProject: 'py_project',\n targetComponent: 'my-py-a2a-agent',\n },\n {\n sourceProject: 'py_langchain_project',\n sourceComponent: 'my-py-langchain-agent',\n targetProject: 'py_project',\n targetComponent: 'my-py-a2a-agent',\n },\n // Agent -> gateway, gateway -> MCP server, gateway -> gateway\n {\n sourceProject: 'ts-project',\n sourceComponent: 'agent',\n targetProject: ts('my-gateway'),\n },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-agent',\n targetProject: ts('my-gateway'),\n },\n {\n sourceProject: 'py_langchain_project',\n sourceComponent: 'my-py-langchain-agent',\n targetProject: ts('my-gateway'),\n },\n {\n sourceProject: ts('my-gateway'),\n targetProject: 'ts-project',\n targetComponent: 'hosted-mcp-server',\n },\n {\n sourceProject: ts('my-gateway'),\n targetProject: 'py_project',\n targetComponent: 'my-mcp-server',\n },\n { sourceProject: ts('parent-gateway'), targetProject: ts('my-gateway') },\n // Gateway -> agent (http gateway fronting agent runtime targets: every\n // supported protocol permutation), then website -> gateway.\n {\n sourceProject: ts('agent-gateway'),\n targetProject: 'ts-project',\n targetComponent: 'my-ts-agui-agent',\n },\n {\n sourceProject: ts('agent-gateway'),\n targetProject: 'ts-project',\n targetComponent: 'my-ts-a2a-agent',\n },\n {\n sourceProject: ts('agent-gateway'),\n targetProject: 'py_project',\n targetComponent: 'my-py-agui-agent',\n },\n {\n sourceProject: ts('agent-gateway'),\n targetProject: 'py_project',\n targetComponent: 'my-agent',\n },\n {\n sourceProject: ts('agent-gateway'),\n targetProject: 'py_project',\n targetComponent: 'my-py-a2a-agent',\n },\n {\n sourceProject: ts('website-no-router'),\n targetProject: ts('agent-gateway'),\n },\n // Website -> agent\n {\n sourceProject: ts('website'),\n targetProject: 'ts-project',\n targetComponent: 'agent',\n },\n {\n sourceProject: ts('website'),\n targetProject: 'ts-project',\n targetComponent: 'my-ts-agui-agent',\n },\n {\n sourceProject: ts('website'),\n targetProject: 'py_project',\n targetComponent: 'my-agent',\n },\n {\n sourceProject: ts('website'),\n targetProject: 'py_project',\n targetComponent: 'my-py-agui-agent',\n },\n {\n sourceProject: ts('website'),\n targetProject: 'py_langchain_project',\n targetComponent: 'my-py-langchain-agent',\n },\n {\n sourceProject: ts('website'),\n targetProject: 'py_langchain_project',\n targetComponent: 'my-py-langchain-http-agent',\n },\n // DynamoDB\n { sourceProject: 'my-api', targetProject: ts('my-table') },\n { sourceProject: 'my-smithy-api', targetProject: ts('my-table') },\n {\n sourceProject: 'ts-project',\n sourceComponent: 'my-ts-agent',\n targetProject: ts('my-table'),\n },\n {\n sourceProject: 'ts-project',\n sourceComponent: 'my-mcp-server',\n targetProject: ts('my-table'),\n },\n { sourceProject: 'py_api', targetProject: 'my_py_table' },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-agent',\n targetProject: 'my_py_table',\n },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-mcp-server',\n targetProject: 'my_py_table',\n },\n {\n sourceProject: 'py_langchain_project',\n sourceComponent: 'my-py-langchain-http-agent',\n targetProject: 'my_py_table',\n },\n // Relational databases\n { sourceProject: 'py_api', targetProject: 'py_postgres_db' },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-agent',\n targetProject: 'py_postgres_db',\n },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-mcp-server',\n targetProject: 'py_postgres_db',\n },\n ];\n for (const connection of connections) {\n await connectionGenerator(tree, { ...connection, ...defaults });\n }\n\n // Licensing, then an Nx plugin with a custom generator.\n await licenseGenerator(tree, {\n license: 'Apache-2.0',\n copyrightHolder: 'Amazon.com, Inc. or its affiliates',\n ...defaults,\n });\n await tsNxPluginGenerator(tree, {\n ...projectDefaults,\n name: 'plugin',\n directory: 'tools',\n });\n await tsNxGeneratorGenerator(tree, {\n project: ts('plugin'),\n name: 'my#generator',\n ...defaults,\n });\n\n // A migration of each kind, so the scaffolded codemods compile and the\n // plugin's migrations.json (created by the first run) registers all three.\n const migrations: Omit<TsNxMigrationGeneratorSchema, 'project'>[] = [\n {\n name: 'rename-foo-target',\n description: 'Rename the foo target to bar',\n },\n {\n name: 'migrate-custom-handlers',\n description: 'Update custom handlers for the new API',\n kind: 'agentic',\n },\n {\n name: 'upgrade-framework',\n description: 'Upgrade the framework and reconcile call sites',\n kind: 'hybrid',\n },\n ];\n for (const migration of migrations) {\n await tsNxMigrationGenerator(tree, {\n ...migration,\n project: ts('plugin'),\n ...defaults,\n });\n }\n\n return () =>\n installDependencies(tree, preferInstallDependencies, {\n languages: ['typescript', 'python'],\n });\n};\n\nexport default internalTestMatrixGenerator;\n"],"names":["agentcoreGatewayGenerator","agentcoreHarnessGenerator","connectionGenerator","licenseGenerator","pyAgentGenerator","pyApiGenerator","pyDynamoDBGenerator","pyLambdaFunctionGenerator","pyMcpServerGenerator","pyProjectGenerator","pyRdbGenerator","smithyProjectGenerator","terraformProjectGenerator","tsAgentGenerator","tsApiGenerator","tsAstroDocsGenerator","tsDcrProxyGenerator","tsDynamoDBGenerator","tsInfraGenerator","tsLambdaFunctionGenerator","tsMcpServerGenerator","tsNxGeneratorGenerator","tsNxMigrationGenerator","tsNxPluginGenerator","tsProjectGenerator","tsRdbGenerator","tsWebsiteAuthGenerator","tsWebsiteGenerator","installDependencies","toSnakeCase","getNpmScope","getNpmScopePrefix","internalTestMatrixGenerator","tree","options","preferInstallDependencies","defaults","projectDefaults","directory","ts","name","py","infra","type","stageConfig","iac","tanstackRouter","project","cognitoDomain","allowSignup","tsApis","auth","integrationPattern","framework","api","pyApis","event","tsAgents","protocol","agent","pyAgents","langchainAgents","tsRdbs","engine","rdb","pyRdbs","connections","sourceProject","targetProject","sourceComponent","targetComponent","connection","license","copyrightHolder","migrations","description","kind","migration","languages"],"mappings":"AAAA;;;CAGC,GAED,SAASA,yBAAyB,QAAQ,iCAAiC;AAC3E,SAASC,yBAAyB,QAAQ,iCAAiC;AAC3E,SAEEC,mBAAmB,QACd,0BAA0B;AACjC,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAIEC,gBAAgB,EAChBC,cAAc,EACdC,mBAAmB,EACnBC,yBAAyB,EACzBC,oBAAoB,EACpBC,kBAAkB,EAClBC,cAAc,QACT,kBAAkB;AACzB,SAASC,sBAAsB,QAAQ,sBAAsB;AAC7D,SAASC,yBAAyB,QAAQ,yBAAyB;AACnE,SAKEC,gBAAgB,EAChBC,cAAc,EACdC,oBAAoB,EACpBC,mBAAmB,EACnBC,mBAAmB,EACnBC,gBAAgB,EAChBC,yBAAyB,EACzBC,oBAAoB,EACpBC,sBAAsB,EACtBC,sBAAsB,EACtBC,mBAAmB,EACnBC,kBAAkB,EAClBC,cAAc,EACdC,sBAAsB,EACtBC,kBAAkB,QACb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AAoB+B,MAAM;YAAE,GAAGsC,UAAU;YAAE,GAAGnC,QAAQ;QAAC;IAC/D;IAEA,wDAAwD;IACxD,MAAMjC,iBAAiB8B,MAAM;QAC3BuC,SAAS;QACTC,iBAAiB;QACjB,GAAGrC,QAAQ;IACb;IACA,MAAMb,oBAAoBU,MAAM;QAC9B,GAAGI,eAAe;QAClBG,MAAM;QACNF,WAAW;IACb;IACA,MAAMjB,uBAAuBY,MAAM;QACjCc,SAASR,GAAG;QACZC,MAAM;QACN,GAAGJ,QAAQ;IACb;IAEA,uEAAuE;IACvE,2EAA2E;IAC3E,MAAMsC,aAA8D;QAClE;YACElC,MAAM;YACNmC,aAAa;QACf;QACA;YACEnC,MAAM;YACNmC,aAAa;YACbC,MAAM;QACR;QACA;YACEpC,MAAM;YACNmC,aAAa;YACbC,MAAM;QACR;KACD;IACD,KAAK,MAAMC,aAAaH,WAAY;QAClC,MAAMpD,uBAAuBW,MAAM;YACjC,GAAG4C,SAAS;YACZ9B,SAASR,GAAG;YACZ,GAAGH,QAAQ;QACb;IACF;IAEA,OAAO,IACLR,oBAAoBK,MAAME,2BAA2B;YACnD2C,WAAW;gBAAC;gBAAc;aAAS;QACrC;AACJ,EAAE;AAEF,eAAe9C,4BAA4B"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/internal/test-matrix/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { GeneratorCallback, Tree } from '@nx/devkit';\nimport { agentcoreGatewayGenerator } from '../../sdk/agentcore-gateway.js';\nimport { agentcoreHarnessGenerator } from '../../sdk/agentcore-harness.js';\nimport {\n type ConnectionGeneratorSchema,\n connectionGenerator,\n} from '../../sdk/connection.js';\nimport { licenseGenerator } from '../../sdk/license.js';\nimport {\n type PyAgentGeneratorSchema,\n type PyApiGeneratorSchema,\n type PyRdbGeneratorSchema,\n pyAgentGenerator,\n pyApiGenerator,\n pyDynamoDBGenerator,\n pyLambdaFunctionGenerator,\n pyMcpServerGenerator,\n pyProjectGenerator,\n pyRdbGenerator,\n} from '../../sdk/py.js';\nimport { smithyProjectGenerator } from '../../sdk/smithy.js';\nimport { terraformProjectGenerator } from '../../sdk/terraform.js';\nimport {\n type TsAgentGeneratorSchema,\n type TsApiGeneratorSchema,\n type TsNxMigrationGeneratorSchema,\n type TsRdbGeneratorSchema,\n tsAgentGenerator,\n tsApiGenerator,\n tsAstroDocsGenerator,\n tsDcrProxyGenerator,\n tsDynamoDBGenerator,\n tsInfraGenerator,\n tsLambdaFunctionGenerator,\n tsMcpServerGenerator,\n tsNxGeneratorGenerator,\n tsNxMigrationGenerator,\n tsNxPluginGenerator,\n tsProjectGenerator,\n tsRdbGenerator,\n tsWebsiteAuthGenerator,\n tsWebsiteGenerator,\n} from '../../sdk/ts.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { toSnakeCase } from '../../utils/names.js';\nimport { getNpmScope, getNpmScopePrefix } from '../../utils/npm-scope.js';\nimport type { InternalTestMatrixGeneratorSchema } from './schema';\n\n/**\n * Scaffolds every generator, component and connection permutation the e2e tests\n * cover, by composing the generators in-process on a single tree.\n *\n * This ships with the plugin so each released version carries the matrix of the\n * generators *it* had. A test upgrading an old workspace scaffolds with the\n * released version's own matrix and never has to reason about which generators\n * existed when — driving the CLI from the test repo instead would couple the\n * test to a generator list that only describes today's plugin.\n *\n * Hidden and undocumented: it exists for the e2e suite, not for users.\n *\n * Options are typed against each generator's schema, so adding a required option\n * or changing an enum breaks the build here rather than silently reducing\n * coverage.\n *\n * Projects are generated with `preferInstallDependencies: false` by default and\n * the returned callback installs once. Nothing composed here reads the project\n * graph (only `ts#sync` does, which is not part of the matrix), so no\n * intermediate install is needed.\n */\nexport const internalTestMatrixGenerator = async (\n tree: Tree,\n options: InternalTestMatrixGeneratorSchema = {},\n): Promise<GeneratorCallback> => {\n const preferInstallDependencies = options.preferInstallDependencies ?? false;\n const defaults = { preferInstallDependencies };\n const projectDefaults = { ...defaults, directory: 'packages' };\n // Fully-qualified project names, which differ per language: TypeScript\n // projects are scope-prefixed, Python ones are dotted snake_case. Derived from\n // the workspace rather than hardcoded, so the matrix works in any workspace.\n const ts = (name: string) => `${getNpmScopePrefix(tree)}${name}`;\n const py = (name: string) =>\n `${toSnakeCase(getNpmScope(tree))}.${toSnakeCase(name)}`;\n\n // The infrastructure project every other generator deploys into. Which\n // generator owns it depends on the workspace's IaC provider, so the caller\n // asks for the one matching the workspace it created.\n if (options.infra === 'terraform') {\n await terraformProjectGenerator(tree, {\n name: 'infra',\n type: 'application',\n ...projectDefaults,\n });\n } else {\n await tsInfraGenerator(tree, { name: 'infra', ...projectDefaults });\n // A second CDK app with stage config, which only ts#infra offers.\n await tsInfraGenerator(tree, {\n name: 'infra-with-stages',\n stageConfig: true,\n ...projectDefaults,\n });\n }\n\n // Websites (with and without TanStack Router), a docs site, and auth on each.\n await tsWebsiteGenerator(tree, {\n name: 'website',\n iac: 'inherit',\n ...projectDefaults,\n });\n await tsWebsiteGenerator(tree, {\n name: 'website-no-router',\n tanstackRouter: false,\n iac: 'inherit',\n ...projectDefaults,\n });\n await tsAstroDocsGenerator(tree, { name: 'docs-site', ...defaults });\n await tsWebsiteAuthGenerator(tree, {\n project: ts('website'),\n cognitoDomain: 'test',\n allowSignup: true,\n iac: 'inherit',\n ...defaults,\n });\n await tsWebsiteAuthGenerator(tree, {\n project: ts('website-no-router'),\n cognitoDomain: 'test-no-router',\n allowSignup: true,\n iac: 'inherit',\n ...defaults,\n });\n\n // tRPC APIs — REST + HTTP, with Cognito and custom auth.\n const tsApis: TsApiGeneratorSchema[] = [\n { name: 'my-api', infra: 'rest-lambda', auth: 'iam', iac: 'inherit' },\n { name: 'my-api-http', infra: 'http-lambda', auth: 'iam', iac: 'inherit' },\n // The APIs above take the default `isolated` integration pattern; these\n // cover `shared`.\n {\n name: 'my-api-shared',\n infra: 'rest-lambda',\n auth: 'iam',\n integrationPattern: 'shared',\n iac: 'inherit',\n },\n {\n name: 'my-api-shared-http',\n infra: 'http-lambda',\n auth: 'iam',\n integrationPattern: 'shared',\n iac: 'inherit',\n },\n {\n name: 'my-api-custom',\n infra: 'rest-lambda',\n auth: 'custom',\n iac: 'inherit',\n },\n {\n name: 'my-api-custom-http',\n infra: 'http-lambda',\n auth: 'custom',\n iac: 'inherit',\n },\n {\n name: 'my-smithy-api',\n framework: 'smithy',\n infra: 'rest-lambda',\n auth: 'iam',\n iac: 'inherit',\n },\n ];\n for (const api of tsApis) {\n await tsApiGenerator(tree, { ...api, ...projectDefaults });\n }\n\n // A Smithy shape library; `my-smithy-api` covers consuming one.\n await smithyProjectGenerator(tree, {\n name: 'my-shapes',\n type: 'shapes',\n ...projectDefaults,\n });\n\n // Python FastAPI — REST + HTTP, with Cognito and custom auth.\n const pyApis: PyApiGeneratorSchema[] = [\n { name: 'py-api', infra: 'rest-lambda', auth: 'iam', iac: 'inherit' },\n { name: 'py-api-http', infra: 'http-lambda', auth: 'iam', iac: 'inherit' },\n {\n name: 'py-api-custom',\n infra: 'rest-lambda',\n auth: 'custom',\n iac: 'inherit',\n },\n {\n name: 'py-api-custom-http',\n infra: 'http-lambda',\n auth: 'custom',\n iac: 'inherit',\n },\n ];\n for (const api of pyApis) {\n await pyApiGenerator(tree, { ...api, ...projectDefaults });\n }\n\n // Library projects hosting the components below, each with a lambda function.\n await pyProjectGenerator(tree, {\n name: 'py-project',\n type: 'application',\n ...projectDefaults,\n });\n await tsProjectGenerator(tree, { name: 'ts-project', ...projectDefaults });\n await pyLambdaFunctionGenerator(tree, {\n project: py('py-project'),\n name: 'my-function',\n event: 'Any',\n iac: 'inherit',\n ...defaults,\n });\n await tsLambdaFunctionGenerator(tree, {\n project: 'ts-project',\n name: 'my-function',\n event: 'Any',\n iac: 'inherit',\n ...defaults,\n });\n\n // MCP servers — uninfra'd and hosted on AgentCore.\n await pyMcpServerGenerator(tree, {\n project: 'py_project',\n name: 'my-mcp-server',\n infra: 'agentcore',\n iac: 'inherit',\n ...defaults,\n });\n await tsMcpServerGenerator(tree, {\n project: 'ts-project',\n name: 'my-mcp-server',\n infra: 'none',\n iac: 'inherit',\n ...defaults,\n });\n await tsMcpServerGenerator(tree, {\n project: 'ts-project',\n name: 'hosted-mcp-server',\n infra: 'agentcore',\n iac: 'inherit',\n ...defaults,\n });\n // Container-packaged variants, so both packagings are covered and a workspace\n // mixing them vends one copy of the shared runtime module.\n await tsMcpServerGenerator(tree, {\n project: 'ts-project',\n name: 'ecr-mcp-server',\n infra: 'agentcore-ecr',\n iac: 'inherit',\n ...defaults,\n });\n await pyMcpServerGenerator(tree, {\n project: 'py_project',\n name: 'ecr-mcp-server',\n infra: 'agentcore-ecr',\n iac: 'inherit',\n ...defaults,\n });\n\n // OAuth DCR proxy for Cognito-authenticated MCP servers.\n await tsDcrProxyGenerator(tree, {\n name: 'my-dcr-proxy',\n iac: 'inherit',\n ...projectDefaults,\n });\n\n // TypeScript agents across every protocol and auth permutation. The unnamed\n // one takes the generator's default name, which the connections below use.\n const tsAgents: TsAgentGeneratorSchema[] = [\n {\n project: 'ts-project',\n name: 'my-ts-agent',\n infra: 'none',\n iac: 'inherit',\n },\n { project: 'ts-project', infra: 'agentcore', iac: 'inherit' },\n {\n project: 'ts-project',\n name: 'my-ts-ecr-agent',\n infra: 'agentcore-ecr',\n iac: 'inherit',\n },\n {\n project: 'ts-project',\n name: 'my-ts-a2a-agent',\n protocol: 'a2a',\n infra: 'agentcore',\n iac: 'inherit',\n },\n {\n project: 'ts-project',\n name: 'my-ts-a2a-agent-cognito',\n protocol: 'a2a',\n auth: 'cognito',\n infra: 'agentcore',\n iac: 'inherit',\n },\n {\n project: 'ts-project',\n name: 'my-ts-agui-agent',\n protocol: 'ag-ui',\n infra: 'agentcore',\n iac: 'inherit',\n },\n ];\n for (const agent of tsAgents) {\n await tsAgentGenerator(tree, { ...agent, ...defaults });\n }\n\n // Python agents: Strands across every protocol, plus LangChain in its own\n // project — langchain's dependency closure would push the zip-bundled Lambda\n // in py-project past its unzipped size limit.\n const pyAgents: PyAgentGeneratorSchema[] = [\n {\n project: 'py_project',\n name: 'my-agent',\n infra: 'agentcore',\n iac: 'inherit',\n },\n {\n project: 'py_project',\n name: 'my-py-ecr-agent',\n infra: 'agentcore-ecr',\n iac: 'inherit',\n },\n {\n project: 'py_project',\n name: 'my-py-a2a-agent',\n protocol: 'a2a',\n infra: 'agentcore',\n iac: 'inherit',\n },\n {\n project: 'py_project',\n name: 'my-py-a2a-agent-cognito',\n protocol: 'a2a',\n auth: 'cognito',\n infra: 'agentcore',\n iac: 'inherit',\n },\n {\n project: 'py_project',\n name: 'my-py-agui-agent',\n protocol: 'ag-ui',\n infra: 'agentcore',\n iac: 'inherit',\n },\n ];\n for (const agent of pyAgents) {\n await pyAgentGenerator(tree, { ...agent, ...defaults });\n }\n await pyProjectGenerator(tree, {\n name: 'py-langchain-project',\n type: 'application',\n ...projectDefaults,\n });\n const langchainAgents: PyAgentGeneratorSchema[] = [\n {\n project: 'py_langchain_project',\n name: 'my-py-langchain-agent',\n protocol: 'ag-ui',\n iac: 'inherit',\n },\n {\n project: 'py_langchain_project',\n name: 'my-py-langchain-http-agent',\n protocol: 'http',\n iac: 'inherit',\n },\n {\n project: 'py_langchain_project',\n name: 'my-py-langchain-a2a-agent',\n protocol: 'a2a',\n iac: 'inherit',\n },\n ];\n for (const agent of langchainAgents) {\n await pyAgentGenerator(tree, {\n ...agent,\n framework: 'langchain',\n infra: 'agentcore',\n ...defaults,\n });\n }\n\n // AgentCore gateways, including a parent fronting the first (chained), and\n // an http-protocol gateway fronting agent runtime targets.\n await agentcoreGatewayGenerator(tree, {\n name: 'my-gateway',\n iac: 'inherit',\n ...projectDefaults,\n });\n await agentcoreGatewayGenerator(tree, {\n name: 'parent-gateway',\n iac: 'inherit',\n ...projectDefaults,\n });\n await agentcoreGatewayGenerator(tree, {\n name: 'agent-gateway',\n protocol: 'http',\n iac: 'inherit',\n ...projectDefaults,\n });\n\n // AgentCore Harness — a standalone invocation project.\n await agentcoreHarnessGenerator(tree, {\n name: 'my-harness',\n infra: 'agentcore',\n iac: 'inherit',\n ...projectDefaults,\n });\n\n // Databases — DynamoDB, plus Aurora across both engines and ORMs.\n await tsDynamoDBGenerator(tree, {\n name: 'my-table',\n framework: 'electrodb',\n infra: 'dynamodb',\n iac: 'inherit',\n ...projectDefaults,\n });\n await pyDynamoDBGenerator(tree, {\n name: 'my-py-table',\n framework: 'pynamodb',\n infra: 'dynamodb',\n iac: 'inherit',\n ...projectDefaults,\n });\n const tsRdbs: TsRdbGeneratorSchema[] = [\n {\n name: 'postgres-db',\n infra: 'aurora',\n engine: 'postgres',\n framework: 'prisma',\n iac: 'inherit',\n },\n {\n name: 'my-sql-db',\n infra: 'aurora',\n engine: 'mysql',\n framework: 'prisma',\n iac: 'inherit',\n },\n ];\n for (const rdb of tsRdbs) {\n await tsRdbGenerator(tree, { ...rdb, ...projectDefaults });\n }\n const pyRdbs: PyRdbGeneratorSchema[] = [\n {\n name: 'py-postgres-db',\n infra: 'aurora',\n engine: 'postgres',\n framework: 'sqlmodel',\n iac: 'inherit',\n },\n {\n name: 'py-mysql-db',\n infra: 'aurora',\n engine: 'mysql',\n framework: 'sqlmodel',\n iac: 'inherit',\n },\n ];\n for (const rdb of pyRdbs) {\n await pyRdbGenerator(tree, { ...rdb, ...projectDefaults });\n }\n\n // Every connection edge the matrix covers.\n const connections: ConnectionGeneratorSchema[] = [\n // Website -> API\n { sourceProject: ts('website'), targetProject: ts('my-api') },\n { sourceProject: ts('website-no-router'), targetProject: ts('my-api') },\n { sourceProject: 'website', targetProject: 'py_api' },\n { sourceProject: 'website', targetProject: 'my-smithy-api' },\n // Agent -> MCP server\n {\n sourceProject: 'ts-project',\n sourceComponent: 'agent',\n targetProject: 'ts-project',\n targetComponent: 'hosted-mcp-server',\n },\n {\n sourceProject: 'ts-project',\n sourceComponent: 'my-ts-agui-agent',\n targetProject: 'ts-project',\n targetComponent: 'hosted-mcp-server',\n },\n {\n sourceProject: 'ts-project',\n sourceComponent: 'agent',\n targetProject: 'py_project',\n targetComponent: 'my-mcp-server',\n },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-agent',\n targetProject: 'py_project',\n targetComponent: 'my-mcp-server',\n },\n {\n sourceProject: 'py_langchain_project',\n sourceComponent: 'my-py-langchain-agent',\n targetProject: 'py_project',\n targetComponent: 'my-mcp-server',\n },\n // HTTP agent <-> A2A agent\n {\n sourceProject: 'ts-project',\n sourceComponent: 'agent',\n targetProject: 'ts-project',\n targetComponent: 'my-ts-a2a-agent',\n },\n {\n sourceProject: 'ts-project',\n sourceComponent: 'agent',\n targetProject: 'py_project',\n targetComponent: 'my-py-a2a-agent',\n },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-agent',\n targetProject: 'ts-project',\n targetComponent: 'my-ts-a2a-agent',\n },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-agent',\n targetProject: 'py_project',\n targetComponent: 'my-py-a2a-agent',\n },\n {\n sourceProject: 'py_langchain_project',\n sourceComponent: 'my-py-langchain-agent',\n targetProject: 'py_project',\n targetComponent: 'my-py-a2a-agent',\n },\n // Agent -> gateway, gateway -> MCP server, gateway -> gateway\n {\n sourceProject: 'ts-project',\n sourceComponent: 'agent',\n targetProject: ts('my-gateway'),\n },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-agent',\n targetProject: ts('my-gateway'),\n },\n {\n sourceProject: 'py_langchain_project',\n sourceComponent: 'my-py-langchain-agent',\n targetProject: ts('my-gateway'),\n },\n {\n sourceProject: ts('my-gateway'),\n targetProject: 'ts-project',\n targetComponent: 'hosted-mcp-server',\n },\n {\n sourceProject: ts('my-gateway'),\n targetProject: 'py_project',\n targetComponent: 'my-mcp-server',\n },\n { sourceProject: ts('parent-gateway'), targetProject: ts('my-gateway') },\n // Gateway -> agent (http gateway fronting agent runtime targets: every\n // supported protocol permutation), then website -> gateway.\n {\n sourceProject: ts('agent-gateway'),\n targetProject: 'ts-project',\n targetComponent: 'my-ts-agui-agent',\n },\n {\n sourceProject: ts('agent-gateway'),\n targetProject: 'ts-project',\n targetComponent: 'my-ts-a2a-agent',\n },\n {\n sourceProject: ts('agent-gateway'),\n targetProject: 'py_project',\n targetComponent: 'my-py-agui-agent',\n },\n {\n sourceProject: ts('agent-gateway'),\n targetProject: 'py_project',\n targetComponent: 'my-agent',\n },\n {\n sourceProject: ts('agent-gateway'),\n targetProject: 'py_project',\n targetComponent: 'my-py-a2a-agent',\n },\n {\n sourceProject: ts('website-no-router'),\n targetProject: ts('agent-gateway'),\n },\n // Website -> agent\n {\n sourceProject: ts('website'),\n targetProject: 'ts-project',\n targetComponent: 'agent',\n },\n {\n sourceProject: ts('website'),\n targetProject: 'ts-project',\n targetComponent: 'my-ts-agui-agent',\n },\n {\n sourceProject: ts('website'),\n targetProject: 'py_project',\n targetComponent: 'my-agent',\n },\n {\n sourceProject: ts('website'),\n targetProject: 'py_project',\n targetComponent: 'my-py-agui-agent',\n },\n {\n sourceProject: ts('website'),\n targetProject: 'py_langchain_project',\n targetComponent: 'my-py-langchain-agent',\n },\n {\n sourceProject: ts('website'),\n targetProject: 'py_langchain_project',\n targetComponent: 'my-py-langchain-http-agent',\n },\n // DynamoDB\n { sourceProject: 'my-api', targetProject: ts('my-table') },\n { sourceProject: 'my-smithy-api', targetProject: ts('my-table') },\n {\n sourceProject: 'ts-project',\n sourceComponent: 'my-ts-agent',\n targetProject: ts('my-table'),\n },\n {\n sourceProject: 'ts-project',\n sourceComponent: 'my-mcp-server',\n targetProject: ts('my-table'),\n },\n { sourceProject: 'py_api', targetProject: 'my_py_table' },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-agent',\n targetProject: 'my_py_table',\n },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-mcp-server',\n targetProject: 'my_py_table',\n },\n {\n sourceProject: 'py_langchain_project',\n sourceComponent: 'my-py-langchain-http-agent',\n targetProject: 'my_py_table',\n },\n // Relational databases\n { sourceProject: 'py_api', targetProject: 'py_postgres_db' },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-agent',\n targetProject: 'py_postgres_db',\n },\n {\n sourceProject: 'py_project',\n sourceComponent: 'my-mcp-server',\n targetProject: 'py_postgres_db',\n },\n ];\n for (const connection of connections) {\n await connectionGenerator(tree, { ...connection, ...defaults });\n }\n\n // Licensing, then an Nx plugin with a custom generator.\n await licenseGenerator(tree, {\n license: 'Apache-2.0',\n copyrightHolder: 'Amazon.com, Inc. or its affiliates',\n ...defaults,\n });\n await tsNxPluginGenerator(tree, {\n ...projectDefaults,\n name: 'plugin',\n directory: 'tools',\n });\n await tsNxGeneratorGenerator(tree, {\n project: ts('plugin'),\n name: 'my#generator',\n ...defaults,\n });\n\n // A migration of each kind, so the scaffolded codemods compile and the\n // plugin's migrations.json (created by the first run) registers all three.\n const migrations: Omit<TsNxMigrationGeneratorSchema, 'project'>[] = [\n {\n name: 'rename-foo-target',\n description: 'Rename the foo target to bar',\n },\n {\n name: 'migrate-custom-handlers',\n description: 'Update custom handlers for the new API',\n kind: 'agentic',\n },\n {\n name: 'upgrade-framework',\n description: 'Upgrade the framework and reconcile call sites',\n kind: 'hybrid',\n },\n ];\n for (const migration of migrations) {\n await tsNxMigrationGenerator(tree, {\n ...migration,\n project: ts('plugin'),\n ...defaults,\n });\n }\n\n return () =>\n installDependencies(tree, preferInstallDependencies, {\n languages: ['typescript', 'python'],\n });\n};\n\nexport default internalTestMatrixGenerator;\n"],"names":["agentcoreGatewayGenerator","agentcoreHarnessGenerator","connectionGenerator","licenseGenerator","pyAgentGenerator","pyApiGenerator","pyDynamoDBGenerator","pyLambdaFunctionGenerator","pyMcpServerGenerator","pyProjectGenerator","pyRdbGenerator","smithyProjectGenerator","terraformProjectGenerator","tsAgentGenerator","tsApiGenerator","tsAstroDocsGenerator","tsDcrProxyGenerator","tsDynamoDBGenerator","tsInfraGenerator","tsLambdaFunctionGenerator","tsMcpServerGenerator","tsNxGeneratorGenerator","tsNxMigrationGenerator","tsNxPluginGenerator","tsProjectGenerator","tsRdbGenerator","tsWebsiteAuthGenerator","tsWebsiteGenerator","installDependencies","toSnakeCase","getNpmScope","getNpmScopePrefix","internalTestMatrixGenerator","tree","options","preferInstallDependencies","defaults","projectDefaults","directory","ts","name","py","infra","type","stageConfig","iac","tanstackRouter","project","cognitoDomain","allowSignup","tsApis","auth","integrationPattern","framework","api","pyApis","event","tsAgents","protocol","agent","pyAgents","langchainAgents","tsRdbs","engine","rdb","pyRdbs","connections","sourceProject","targetProject","sourceComponent","targetComponent","connection","license","copyrightHolder","migrations","description","kind","migration","languages"],"mappings":"AAAA;;;CAGC,GAED,SAASA,yBAAyB,QAAQ,iCAAiC;AAC3E,SAASC,yBAAyB,QAAQ,iCAAiC;AAC3E,SAEEC,mBAAmB,QACd,0BAA0B;AACjC,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAIEC,gBAAgB,EAChBC,cAAc,EACdC,mBAAmB,EACnBC,yBAAyB,EACzBC,oBAAoB,EACpBC,kBAAkB,EAClBC,cAAc,QACT,kBAAkB;AACzB,SAASC,sBAAsB,QAAQ,sBAAsB;AAC7D,SAASC,yBAAyB,QAAQ,yBAAyB;AACnE,SAKEC,gBAAgB,EAChBC,cAAc,EACdC,oBAAoB,EACpBC,mBAAmB,EACnBC,mBAAmB,EACnBC,gBAAgB,EAChBC,yBAAyB,EACzBC,oBAAoB,EACpBC,sBAAsB,EACtBC,sBAAsB,EACtBC,mBAAmB,EACnBC,kBAAkB,EAClBC,cAAc,EACdC,sBAAsB,EACtBC,kBAAkB,QACb,kBAAkB;AACzB,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,WAAW,EAAEC,iBAAiB,QAAQ,2BAA2B;AAG1E;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,MAAMC,8BAA8B,OACzCC,MACAC,UAA6C,CAAC,CAAC;IAE/C,MAAMC,4BAA4BD,QAAQC,yBA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ED,eAAe;YACfE,iBAAiB;YACjBD,eAAe;QACjB;KACD;IACD,KAAK,MAAMG,cAAcL,YAAa;QACpC,MAAMhE,oBAAoB+B,MAAM;YAAE,GAAGsC,UAAU;YAAE,GAAGnC,QAAQ;QAAC;IAC/D;IAEA,wDAAwD;IACxD,MAAMjC,iBAAiB8B,MAAM;QAC3BuC,SAAS;QACTC,iBAAiB;QACjB,GAAGrC,QAAQ;IACb;IACA,MAAMb,oBAAoBU,MAAM;QAC9B,GAAGI,eAAe;QAClBG,MAAM;QACNF,WAAW;IACb;IACA,MAAMjB,uBAAuBY,MAAM;QACjCc,SAASR,GAAG;QACZC,MAAM;QACN,GAAGJ,QAAQ;IACb;IAEA,uEAAuE;IACvE,2EAA2E;IAC3E,MAAMsC,aAA8D;QAClE;YACElC,MAAM;YACNmC,aAAa;QACf;QACA;YACEnC,MAAM;YACNmC,aAAa;YACbC,MAAM;QACR;QACA;YACEpC,MAAM;YACNmC,aAAa;YACbC,MAAM;QACR;KACD;IACD,KAAK,MAAMC,aAAaH,WAAY;QAClC,MAAMpD,uBAAuBW,MAAM;YACjC,GAAG4C,SAAS;YACZ9B,SAASR,GAAG;YACZ,GAAGH,QAAQ;QACb;IACF;IAEA,OAAO,IACLR,oBAAoBK,MAAME,2BAA2B;YACnD2C,WAAW;gBAAC;gBAAc;aAAS;QACrC;AACJ,EAAE;AAEF,eAAe9C,4BAA4B"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/ import { getProjects, joinPathFragments, readProjectConfiguration, updateProjectConfiguration } from "@nx/devkit";
|
|
5
|
+
import { REACT_WEBSITE_APP_GENERATOR_INFO } from "../../../ts/react-website/app/generator.js";
|
|
6
|
+
import { COGNITO_AUTH_GENERATOR_INFO } from "../../../ts/react-website/cognito-auth/generator.js";
|
|
7
|
+
import { applyGritQL, matchGritQL } from "../../../utils/ast.js";
|
|
8
|
+
import { formatFilesInSubtree } from "../../../utils/format.js";
|
|
9
|
+
import { addLocalCallbackUrl } from "../../../utils/identity-constructs/identity-constructs.js";
|
|
10
|
+
import { assignPort, getExistingProjectPort } from "../../../utils/port.js";
|
|
11
|
+
/**
|
|
12
|
+
* Set a vite.config.mts `server`/`preview` block's port. Checks whether it
|
|
13
|
+
* already holds the target value first — the rewrite pattern is a no-op
|
|
14
|
+
* `port: N` => `port: N` in that case, which GritQL reports as "no match"
|
|
15
|
+
* indistinguishably from the block not existing at all.
|
|
16
|
+
*/ const patchVitePort = async (tree, viteConfigPath, target, port)=>{
|
|
17
|
+
if (!tree.exists(viteConfigPath)) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const alreadyCorrect = await matchGritQL(tree, viteConfigPath, `\`${target}: { $props }\` where { $props <: contains \`port: ${port}\` }`);
|
|
21
|
+
if (alreadyCorrect) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return applyGritQL(tree, viteConfigPath, `\`${target}: { $props }\` where { $props <: contains \`port: $_\` => \`port: ${port}\` }`);
|
|
25
|
+
};
|
|
26
|
+
export default async function migration(tree) {
|
|
27
|
+
const nextSteps = [];
|
|
28
|
+
// Codepoint order, so re-runs and different machines assign the same ports.
|
|
29
|
+
const websiteNames = [
|
|
30
|
+
...getProjects(tree).entries()
|
|
31
|
+
].filter(([, project])=>project.metadata?.generator === REACT_WEBSITE_APP_GENERATOR_INFO.id).map(([name])=>name).sort((a, b)=>a < b ? -1 : a > b ? 1 : 0);
|
|
32
|
+
for (const name of websiteNames){
|
|
33
|
+
const project = readProjectConfiguration(tree, name);
|
|
34
|
+
if (getExistingProjectPort(project) !== undefined) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const viteConfigPath = joinPathFragments(project.root, 'vite.config.mts');
|
|
38
|
+
const port = assignPort(tree, project, 4200);
|
|
39
|
+
const previewPort = port + 100;
|
|
40
|
+
if (!await patchVitePort(tree, viteConfigPath, 'server', port)) {
|
|
41
|
+
nextSteps.push(`${viteConfigPath}: could not find the expected 'server' block to set its dev-server port to ${port} - set it by hand so it matches the Cognito callback URL this migration is allow-listing for it.`);
|
|
42
|
+
}
|
|
43
|
+
if (!await patchVitePort(tree, viteConfigPath, 'preview', previewPort)) {
|
|
44
|
+
nextSteps.push(`${viteConfigPath}: could not find the expected 'preview' block to set its port to ${previewPort} - set it by hand so it matches the Cognito callback URL this migration is allow-listing for it.`);
|
|
45
|
+
}
|
|
46
|
+
// Persists the port assignPort just recorded on `project.metadata.ports`.
|
|
47
|
+
updateProjectConfiguration(tree, name, project);
|
|
48
|
+
}
|
|
49
|
+
// Allow-list the (possibly just-assigned) ports of every website that has
|
|
50
|
+
// added Cognito auth, on whichever shared identity construct/module it uses.
|
|
51
|
+
// Re-reads each project fresh, since the pass above may have persisted a
|
|
52
|
+
// port this project didn't have when websiteNames was first read.
|
|
53
|
+
for (const name of websiteNames){
|
|
54
|
+
const project = readProjectConfiguration(tree, name);
|
|
55
|
+
const authComponent = (project.metadata?.components ?? []).find((c)=>c.generator === COGNITO_AUTH_GENERATOR_INFO.id);
|
|
56
|
+
if (!authComponent) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
const devPort = getExistingProjectPort(project);
|
|
60
|
+
const iac = authComponent.iac;
|
|
61
|
+
if (devPort === undefined || !iac) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
for (const port of [
|
|
65
|
+
devPort,
|
|
66
|
+
devPort + 100
|
|
67
|
+
]){
|
|
68
|
+
if (!await addLocalCallbackUrl(tree, iac, port)) {
|
|
69
|
+
nextSteps.push(`The shared Cognito user identity ${iac === 'cdk' ? 'construct' : 'module'} has diverged from the generated shape - left untouched. To sign in against ${name}'s local dev server on port ${port}, add 'http://localhost:${port}' to its local callback/logout URLs by hand.`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
await formatFilesInSubtree(tree);
|
|
74
|
+
return {
|
|
75
|
+
nextSteps
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/latest/react-website-unique-dev-ports/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n getProjects,\n joinPathFragments,\n type MigrationReturnObject,\n type ProjectConfiguration,\n readProjectConfiguration,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { REACT_WEBSITE_APP_GENERATOR_INFO } from '../../../ts/react-website/app/generator.js';\nimport { COGNITO_AUTH_GENERATOR_INFO } from '../../../ts/react-website/cognito-auth/generator.js';\nimport { applyGritQL, matchGritQL } from '../../../utils/ast.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\nimport type { Iac } from '../../../utils/iac.js';\nimport { addLocalCallbackUrl } from '../../../utils/identity-constructs/identity-constructs.js';\nimport type { ComponentMetadata } from '../../../utils/nx.js';\nimport { assignPort, getExistingProjectPort } from '../../../utils/port.js';\n\n/**\n * Assign each react-website project its own dev-server and preview port, and allow-list them for any connected Cognito auth\n *\n * Before this migration every react-website project's `vite.config.mts` hardcoded\n * `server.port: 4200` / `preview.port: 4300`. Vite itself already auto-increments\n * past a port already in use, so multiple websites don't actually collide when run\n * concurrently — but which port each one lands on then depends on start order and\n * can't be known ahead of time. Today's generator assigns each website an explicit,\n * deterministic dev-server port (tracked in project metadata, mirroring\n * `assignPort`'s existing use elsewhere) specifically so it - and its preview port,\n * always the dev-server port + 100 - can be allow-listed on the shared Cognito\n * construct/module for any website that has added auth. This migration backfills\n * both for existing workspaces.\n *\n * How to write a migration:\n * - https://nx.dev/docs/kb/migration-generators\n * - What `nextSteps` means: https://nx.dev/docs/reference/devkit/MigrationReturnObject\n *\n * Guardrails:\n * - Transform source with GritQL (`applyGritQL`, `matchGritQL`), not regexes or\n * string replacements: it matches the AST, so it holds up against however the\n * user's copy has been formatted. Use `updateJson` for JSON.\n * - Pattern-match before writing: skip files that have diverged from the shape\n * your generators produce and report them via `nextSteps`, or consider a\n * hybrid migration, rather than clobbering the user's changes.\n * - `nextSteps` is for work left for the user to do by hand, not a log of the\n * edits you made: an edit that applied cleanly needs no entry.\n * - Idempotent: re-running must be a no-op.\n * - Format what you write: finish with `formatFilesInSubtree` so the files your\n * migration wrote are formatted correctly.\n */\n\ninterface WebsiteProjectMetadata {\n readonly generator?: string;\n readonly components?: ComponentMetadata[];\n}\n\n/**\n * Set a vite.config.mts `server`/`preview` block's port. Checks whether it\n * already holds the target value first — the rewrite pattern is a no-op\n * `port: N` => `port: N` in that case, which GritQL reports as \"no match\"\n * indistinguishably from the block not existing at all.\n */\nconst patchVitePort = async (\n tree: Tree,\n viteConfigPath: string,\n target: 'server' | 'preview',\n port: number,\n): Promise<boolean> => {\n if (!tree.exists(viteConfigPath)) {\n return false;\n }\n const alreadyCorrect = await matchGritQL(\n tree,\n viteConfigPath,\n `\\`${target}: { $props }\\` where { $props <: contains \\`port: ${port}\\` }`,\n );\n if (alreadyCorrect) {\n return true;\n }\n return applyGritQL(\n tree,\n viteConfigPath,\n `\\`${target}: { $props }\\` where { $props <: contains \\`port: $_\\` => \\`port: ${port}\\` }`,\n );\n};\n\nexport default async function migration(\n tree: Tree,\n): Promise<MigrationReturnObject> {\n const nextSteps: string[] = [];\n\n // Codepoint order, so re-runs and different machines assign the same ports.\n const websiteNames: string[] = [...getProjects(tree).entries()]\n .filter(\n ([, project]) =>\n (project.metadata as WebsiteProjectMetadata | undefined)?.generator ===\n REACT_WEBSITE_APP_GENERATOR_INFO.id,\n )\n .map(([name]) => name)\n .sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));\n\n for (const name of websiteNames) {\n const project: ProjectConfiguration = readProjectConfiguration(tree, name);\n if (getExistingProjectPort(project) !== undefined) {\n // Already migrated (or generated by a version that already assigns\n // ports) - skip so re-running is a no-op.\n continue;\n }\n\n const viteConfigPath = joinPathFragments(project.root, 'vite.config.mts');\n const port = assignPort(tree, project, 4200);\n const previewPort = port + 100;\n\n if (!(await patchVitePort(tree, viteConfigPath, 'server', port))) {\n nextSteps.push(\n `${viteConfigPath}: could not find the expected 'server' block to set its dev-server port to ${port} - set it by hand so it matches the Cognito callback URL this migration is allow-listing for it.`,\n );\n }\n if (!(await patchVitePort(tree, viteConfigPath, 'preview', previewPort))) {\n nextSteps.push(\n `${viteConfigPath}: could not find the expected 'preview' block to set its port to ${previewPort} - set it by hand so it matches the Cognito callback URL this migration is allow-listing for it.`,\n );\n }\n\n // Persists the port assignPort just recorded on `project.metadata.ports`.\n updateProjectConfiguration(tree, name, project);\n }\n\n // Allow-list the (possibly just-assigned) ports of every website that has\n // added Cognito auth, on whichever shared identity construct/module it uses.\n // Re-reads each project fresh, since the pass above may have persisted a\n // port this project didn't have when websiteNames was first read.\n for (const name of websiteNames) {\n const project = readProjectConfiguration(tree, name);\n const authComponent = (\n (project.metadata as WebsiteProjectMetadata | undefined)?.components ?? []\n ).find((c) => c.generator === COGNITO_AUTH_GENERATOR_INFO.id);\n if (!authComponent) {\n continue;\n }\n\n const devPort = getExistingProjectPort(project);\n const iac = authComponent.iac as Iac | undefined;\n if (devPort === undefined || !iac) {\n // Shouldn't happen: the pass above assigns a port to every website project.\n continue;\n }\n\n for (const port of [devPort, devPort + 100]) {\n if (!(await addLocalCallbackUrl(tree, iac, port))) {\n nextSteps.push(\n `The shared Cognito user identity ${iac === 'cdk' ? 'construct' : 'module'} has diverged from the generated shape - left untouched. To sign in against ${name}'s local dev server on port ${port}, add 'http://localhost:${port}' to its local callback/logout URLs by hand.`,\n );\n }\n }\n }\n\n await formatFilesInSubtree(tree);\n\n return { nextSteps };\n}\n"],"names":["getProjects","joinPathFragments","readProjectConfiguration","updateProjectConfiguration","REACT_WEBSITE_APP_GENERATOR_INFO","COGNITO_AUTH_GENERATOR_INFO","applyGritQL","matchGritQL","formatFilesInSubtree","addLocalCallbackUrl","assignPort","getExistingProjectPort","patchVitePort","tree","viteConfigPath","target","port","exists","alreadyCorrect","migration","nextSteps","websiteNames","entries","filter","project","metadata","generator","id","map","name","sort","a","b","undefined","root","previewPort","push","authComponent","components","find","c","devPort","iac"],"mappings":"AAAA;;;CAGC,GACD,SACEA,WAAW,EACXC,iBAAiB,EAGjBC,wBAAwB,EAExBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,gCAAgC,QAAQ,6CAA6C;AAC9F,SAASC,2BAA2B,QAAQ,sDAAsD;AAClG,SAASC,WAAW,EAAEC,WAAW,QAAQ,wBAAwB;AACjE,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,SAASC,mBAAmB,QAAQ,4DAA4D;AAEhG,SAASC,UAAU,EAAEC,sBAAsB,QAAQ,yBAAyB;AAuC5E;;;;;CAKC,GACD,MAAMC,gBAAgB,OACpBC,MACAC,gBACAC,QACAC;IAEA,IAAI,CAACH,KAAKI,MAAM,CAACH,iBAAiB;QAChC,OAAO;IACT;IACA,MAAMI,iBAAiB,MAAMX,YAC3BM,MACAC,gBACA,CAAC,EAAE,EAAEC,OAAO,kDAAkD,EAAEC,KAAK,IAAI,CAAC;IAE5E,IAAIE,gBAAgB;QAClB,OAAO;IACT;IACA,OAAOZ,YACLO,MACAC,gBACA,CAAC,EAAE,EAAEC,OAAO,kEAAkE,EAAEC,KAAK,IAAI,CAAC;AAE9F;AAEA,eAAe,eAAeG,UAC5BN,IAAU;IAEV,MAAMO,YAAsB,EAAE;IAE9B,4EAA4E;IAC5E,MAAMC,eAAyB;WAAIrB,YAAYa,MAAMS,OAAO;KAAG,CAC5DC,MAAM,CACL,CAAC,GAAGC,QAAQ,GACV,AAACA,QAAQC,QAAQ,EAAyCC,cAC1DtB,iCAAiCuB,EAAE,EAEtCC,GAAG,CAAC,CAAC,CAACC,KAAK,GAAKA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AAK1B,OAAQ;gBACjDI,UAAUgB,IAAI,CACZ,CAAC,iCAAiC,EAAEM,QAAQ,QAAQ,cAAc,SAAS,4EAA4E,EAAEb,KAAK,4BAA4B,EAAEb,KAAK,wBAAwB,EAAEA,KAAK,4CAA4C,CAAC;YAEjR;QACF;IACF;IAEA,MAAMR,qBAAqBK;IAE3B,OAAO;QAAEO;IAAU;AACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/v1.0.0-rc.87/0001-add-destroy-sandbox-target/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n getProjects,\n joinPathFragments,\n type MigrationReturnObject,\n type ProjectConfiguration,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\nimport { INFRA_APP_GENERATOR_INFO } from '../../../infra/app/generator.js';\nimport { captureGritQLVariable } from '../../../utils/ast.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\nimport { normalizeTargetKeyOrder } from '../../../utils/nx.js';\nimport { sortObjectKeys } from '../../../utils/object.js';\nimport {\n PACKAGES_DIR,\n SHARED_SCRIPTS_DIR,\n} from '../../../utils/shared-constructs-constants.js';\n\n/**\n * CDK infrastructure projects gained a `destroy-sandbox` target, mirroring\n * `deploy-sandbox`: it tears down the sandbox stage without the user having to\n * spell out its stage pattern (`nx destroy-sandbox infra` rather than\n * `nx destroy infra \"my-app-infra-sandbox/*\"`).\n *\n * The stage id is read from `main.ts` rather than recomputed from the project\n * name, so a project whose sandbox stage has been renamed gets a target that\n * destroys the stage it actually declares.\n *\n * The destroy targets also drop `--require-approval=never`. `cdk destroy` has no\n * such option, so it only warns that the flag is being ignored. The same fix\n * lands in the vended `buildCdkCommand`, which builds the command for\n * `stageConfig` workspaces.\n *\n * How to write a migration:\n * - https://nx.dev/docs/kb/migration-generators\n * - What `nextSteps` means: https://nx.dev/docs/reference/devkit/MigrationReturnObject\n */\n\nconst TARGET = 'destroy-sandbox';\n\n/** The destroy targets the ignored flag is stripped from. */\nconst DESTROY_TARGETS = ['destroy', 'destroy-ci'] as const;\n\n/** `cdk destroy` has no such option, so it only warns and carries on. */\nconst IGNORED_APPROVAL_FLAG = /\\s*--require-approval(=\\S*)?/;\n\n/**\n * Matches `new ApplicationStage(app, '<id>-sandbox', { ... })`, binding the\n * quoted stage id. The regex spans the quotes because it is matched against the\n * whole string literal node; both quote styles are accepted since the user's\n * formatter may have rewritten them.\n *\n * `main.ts` can declare several stages (beta, prod), so the pattern selects the\n * sandbox one rather than whichever comes first.\n */\nconst SANDBOX_STAGE_PATTERN =\n '`new ApplicationStage($app, $id, $props)` where { $id <: r\"[\\'\\\\\"].*-sandbox[\\'\\\\\"]\" }';\n\n/** The id of the sandbox stage a project's `main.ts` instantiates. */\nconst sandboxStageId = async (\n tree: Tree,\n projectRoot: string,\n): Promise<string | undefined> => {\n const captured = await captureGritQLVariable(\n tree,\n joinPathFragments(projectRoot, 'src', 'main.ts'),\n SANDBOX_STAGE_PATTERN,\n 'id',\n );\n // The binding keeps the quotes from the source.\n return captured?.slice(1, -1);\n};\n\n/**\n * Strip the ignored `--require-approval` from a `cdk destroy` command. Returns\n * undefined when the command isn't the shape the generator produced, or the flag\n * is already gone.\n */\nconst withoutApprovalFlag = (command: unknown): string | undefined => {\n if (typeof command !== 'string' || !command.includes('cdk destroy')) {\n return undefined;\n }\n if (!IGNORED_APPROVAL_FLAG.test(command)) return undefined;\n return command.replace(IGNORED_APPROVAL_FLAG, '');\n};\n\n/** Drops the ignored approval flag from the project's destroy targets. */\nconst migrateDestroyFlags = (project: ProjectConfiguration): boolean => {\n let changed = false;\n for (const name of DESTROY_TARGETS) {\n const target = project.targets?.[name];\n const command = withoutApprovalFlag(target?.options?.command);\n if (command) {\n target.options = { ...target.options, command };\n changed = true;\n }\n }\n return changed;\n};\n\n/** Path the shared scripts package vends the CDK command builder at. */\nconst CDK_COMMAND_PATH = joinPathFragments(\n PACKAGES_DIR,\n SHARED_SCRIPTS_DIR,\n 'src/infra/stage-credentials/cdk-command.ts',\n);\n\n/** The builder as it stands today. The template carries no EJS variables. */\nconst CDK_COMMAND_TEMPLATE = readFileSync(\n join(\n import.meta.dirname,\n '../../../utils/files/common/scripts/src/infra/stage-credentials/cdk-command.ts.template',\n ),\n 'utf-8',\n);\n\n/**\n * Re-vends the CDK command builder, which no longer adds `--require-approval`\n * for the `destroy` action. Only the shape the generator produced is replaced: a\n * customised copy is the user's, so it is reported instead.\n */\nconst migrateCdkCommandBuilder = (tree: Tree, nextSteps: string[]): void => {\n if (!tree.exists(CDK_COMMAND_PATH)) return;\n\n const current = tree.read(CDK_COMMAND_PATH)!.toString();\n // Already migrated, so a re-run is a no-op.\n if (current.includes(\"action === 'destroy'\")) return;\n\n if (!current.includes('hasRequireApproval')) {\n nextSteps.push(\n `${CDK_COMMAND_PATH}: has diverged from the generated shape — left untouched. Have it skip \\`--require-approval\\` for the \\`destroy\\` action, which has no such option.`,\n );\n return;\n }\n\n tree.write(CDK_COMMAND_PATH, CDK_COMMAND_TEMPLATE);\n};\n\n/** Adds the `destroy-sandbox` target, mirroring the project's `destroy`. */\nconst addSandboxTarget = async (\n tree: Tree,\n projectName: string,\n project: ProjectConfiguration,\n nextSteps: string[],\n): Promise<boolean> => {\n // The new target mirrors `destroy`, so it inherits whatever that resolved to\n // when the project was generated: the `tsx` credential-resolving script\n // under `stageConfig`, plain `cdk destroy` otherwise.\n const destroy = project.targets.destroy;\n const command = destroy?.options?.command;\n const mainPath = joinPathFragments(project.root, 'src/main.ts');\n const stageId = await sandboxStageId(tree, project.root);\n\n if (typeof command !== 'string') {\n nextSteps.push(\n `Add a '${TARGET}' target to ${projectName} by hand if necessary — its 'destroy' target no longer matches the shape the generator produced.`,\n );\n return false;\n }\n if (!stageId) {\n nextSteps.push(\n `Add a '${TARGET}' target to ${projectName} by hand if necessary — no sandbox stage was found in ${mainPath}.`,\n );\n return false;\n }\n\n project.targets[TARGET] = normalizeTargetKeyOrder({\n executor: destroy.executor,\n ...(destroy.dependsOn ? { dependsOn: [...destroy.dependsOn] } : {}),\n // Quoted so the shell does not glob the `*`.\n options: { ...destroy.options, command: `${command} \"${stageId}/*\"` },\n });\n return true;\n};\n\nexport default async function migration(\n tree: Tree,\n): Promise<MigrationReturnObject> {\n const nextSteps: string[] = [];\n\n for (const [projectName, project] of getProjects(tree)) {\n const generator = (project.metadata as { generator?: string } | undefined)\n ?.generator;\n // Not a CDK infrastructure project.\n if (generator !== INFRA_APP_GENERATOR_INFO.id) continue;\n\n // Corrected first so the new target inherits the fixed command.\n let changed = migrateDestroyFlags(project);\n\n if (!project.targets?.[TARGET]) {\n changed =\n (await addSandboxTarget(tree, projectName, project, nextSteps)) ||\n changed;\n }\n\n if (changed) {\n updateProjectConfiguration(tree, projectName, {\n ...project,\n targets: sortObjectKeys(project.targets),\n });\n }\n }\n\n migrateCdkCommandBuilder(tree, nextSteps);\n\n await formatFilesInSubtree(tree);\n\n return { nextSteps };\n}\n"],"names":["getProjects","joinPathFragments","updateProjectConfiguration","readFileSync","join","INFRA_APP_GENERATOR_INFO","captureGritQLVariable","formatFilesInSubtree","normalizeTargetKeyOrder","sortObjectKeys","PACKAGES_DIR","SHARED_SCRIPTS_DIR","TARGET","DESTROY_TARGETS","IGNORED_APPROVAL_FLAG","SANDBOX_STAGE_PATTERN","sandboxStageId","tree","projectRoot","captured","slice","withoutApprovalFlag","command","includes","undefined","test","replace","migrateDestroyFlags","project","changed","name","target","targets","options","CDK_COMMAND_PATH","CDK_COMMAND_TEMPLATE","dirname","migrateCdkCommandBuilder","nextSteps","exists","current","read","toString","push","write","addSandboxTarget","projectName","destroy","mainPath","root","stageId","executor","dependsOn","migration","generator","metadata","id"],"mappings":"AAAA;;;CAGC,GACD,SACEA,WAAW,EACXC,iBAAiB,EAIjBC,0BAA0B,QACrB,aAAa;AAC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AW;mBAAIL,QAAQK,SAAS;aAAC;QAAC,IAAI,CAAC,CAAC;QAClE,6CAA6C;QAC7CnB,SAAS;YAAE,GAAGc,QAAQd,OAAO;YAAEX,SAAS,GAAGA,QAAQ,EAAE,EAAE4B,QAAQ,GAAG,CAAC;QAAC;IACtE;IACA,OAAO;AACT;AAEA,eAAe,eAAeG,UAC5BpC,IAAU;IAEV,MAAMqB,YAAsB,EAAE;IAE9B,KAAK,MAAM,CAACQ,aAAalB,QAAQ,IAAI5B,YAAYiB,MAAO;QACtD,MAAMqC,YAAa1B,QAAQ2B,QAAQ,EAC/BD;QACJ,oCAAoC;QACpC,IAAIA,cAAcjD,yBAAyBmD,EAAE,EAAE;QAE/C,gEAAgE;QAChE,IAAI3B,UAAUF,oBAAoBC;QAElC,IAAI,CAACA,QAAQI,OAAO,EAAE,CAACpB,OAAO,EAAE;YAC9BiB,UACE,AAAC,MAAMgB,iBAAiB5B,MAAM6B,aAAalB,SAASU,cACpDT;QACJ;QAEA,IAAIA,SAAS;YACX3B,2BAA2Be,MAAM6B,aAAa;gBAC5C,GAAGlB,OAAO;gBACVI,SAASvB,eAAemB,QAAQI,OAAO;YACzC;QACF;IACF;IAEAK,yBAAyBpB,MAAMqB;IAE/B,MAAM/B,qBAAqBU;IAE3B,OAAO;QAAEqB;IAAU;AACrB"}
|
package/src/migrations/v1.0.0-rc.87/0002-terraform-rdb-proxy-iam-connect-grant/migration.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/v1.0.0-rc.87/0002-terraform-rdb-proxy-iam-connect-grant/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n joinPathFragments,\n type MigrationReturnObject,\n type Tree,\n} from '@nx/devkit';\nimport { applyGritQL, matchGritQL } from '../../../utils/ast.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\nimport {\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n} from '../../../utils/shared-constructs-constants.js';\n\n/**\n * Give the RDS Proxy role in every vended Terraform Aurora app module the\n * `rds-db:connect` grant for the application database user.\n *\n * The proxy is created with `default_auth_scheme = \"IAM_AUTH\"` and no secrets\n * registered, so `rds-db:connect` on the application user is the only\n * permission it needs to reach the cluster. MySQL modules instead granted the\n * role `secretsmanager:GetSecretValue` on the admin credentials secret plus\n * `kms:Decrypt` — credentials the proxy never uses, and a far wider grant than\n * connecting as the application user.\n *\n * These files are generated with `KeepExisting`, so an upgraded MySQL workspace\n * keeps the admin secret grant until this runs. Diverged files are left\n * untouched and reported via `nextSteps`.\n */\n\nconst TERRAFORM_DBS_DIR = `${PACKAGES_DIR}/${SHARED_TERRAFORM_DIR}/src/app/dbs`;\n\nconst hcl = (pattern: string) => `language hcl\\n${pattern}`;\n\nconst CONNECT_STATEMENT_TEXT = [\n '{',\n ' Effect = \"Allow\"',\n ' Action = [\"rds-db:connect\"]',\n ' Resource = [',\n ' \"arn:aws:rds-db:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:dbuser:${module.aurora.cluster_resource_id}/${local.database_runtime_user}\"',\n ' ]',\n ' }',\n].join('\\n');\n\nconst divergedMessage = (filePath: string) =>\n `${filePath}: the aws_iam_role_policy.proxy_db_user_connect policy has diverged from the generated shape - left untouched. The RDS Proxy authenticates to the cluster with IAM, so replace any secretsmanager:GetSecretValue / kms:Decrypt statements on the proxy role with a single rds-db:connect statement for local.database_runtime_user (see the ts#rdb generator's database app template).`;\n\nconst proxyPolicyBlock = (body: string) =>\n hcl(`\\`resource \"aws_iam_role_policy\" \"proxy_db_user_connect\" { ${body} }\\``);\n\nconst migrateModule = async (\n tree: Tree,\n filePath: string,\n nextSteps: string[],\n): Promise<void> => {\n if (!(await matchGritQL(tree, filePath, proxyPolicyBlock('$_')))) {\n return; // No proxy policy in this module - nothing this migration owns.\n }\n\n if (\n await matchGritQL(\n tree,\n filePath,\n proxyPolicyBlock('$props') +\n ' where { $props <: contains `\"rds-db:connect\"` }',\n )\n ) {\n return; // Already granted.\n }\n\n // The whole statement list is replaced, so the policy must still hold exactly\n // the two statements the generator vended and nothing the user has added.\n const secretStatements = hcl(\n [\n '`Statement = [',\n ' {',\n ' Effect = \"Allow\"',\n ' Action = [',\n ' \"secretsmanager:GetSecretValue\"',\n ' ]',\n ' Resource = [module.aurora.secret_arn]',\n ' },',\n ' {',\n ' Effect = \"Allow\"',\n ' Action = [',\n ' \"kms:Decrypt\"',\n ' ]',\n ' Resource = [module.aurora.kms_key_arn]',\n ' }',\n ' ]`',\n ].join('\\n'),\n );\n\n if (!(await matchGritQL(tree, filePath, secretStatements))) {\n nextSteps.push(divergedMessage(filePath));\n return;\n }\n\n await applyGritQL(\n tree,\n filePath,\n `${secretStatements} => \\`Statement = [\\n ${CONNECT_STATEMENT_TEXT}\\n ]\\``,\n );\n};\n\nexport default async function migration(\n tree: Tree,\n): Promise<MigrationReturnObject> {\n const nextSteps: string[] = [];\n\n if (!tree.exists(TERRAFORM_DBS_DIR)) {\n return { nextSteps }; // This workspace has no Terraform database modules.\n }\n\n for (const dirName of tree.children(TERRAFORM_DBS_DIR)) {\n const filePath = joinPathFragments(\n TERRAFORM_DBS_DIR,\n dirName,\n `${dirName}.tf`,\n );\n if (!tree.exists(filePath)) {\n continue; // Not a database app module directory.\n }\n\n await migrateModule(tree, filePath, nextSteps);\n }\n\n await formatFilesInSubtree(tree);\n\n return { nextSteps };\n}\n"],"names":["joinPathFragments","applyGritQL","matchGritQL","formatFilesInSubtree","PACKAGES_DIR","SHARED_TERRAFORM_DIR","TERRAFORM_DBS_DIR","hcl","pattern","CONNECT_STATEMENT_TEXT","join","divergedMessage","filePath","proxyPolicyBlock","body","migrateModule","tree","nextSteps","secretStatements","push","migration","exists","dirName","children"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,QAGZ,aAAa;AACpB,SAASC,WAAW,EAAEC,WAAW,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,KAAKO,QAAQ,CAACjB,mBAAoB;QACtD,MAAMM,WAAWZ,kBACfM,mBACAgB,SACA,GAAGA,QAAQ,GAAG,CAAC;QAEjB,IAAI,CAACN,KAAKK,MAAM,CAACT,WAAW;YAC1B,UAAU,uCAAuC;QACnD;QAEA,MAAMG,cAAcC,MAAMJ,UAAUK;IACtC;IAEA,MAAMd,qBAAqBa;IAE3B,OAAO;QAAEC;IAAU;AACrB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { type MigrationReturnObject, type Tree } from '@nx/devkit';
|
|
6
|
+
export default function migration(tree: Tree): Promise<MigrationReturnObject>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/v1.0.0-rc.88/0001-python-version-drop-exact-patch/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type MigrationReturnObject,\n type Tree,\n visitNotIgnoredFiles,\n} from '@nx/devkit';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\n\n/**\n * A `.python-version` naming an exact CPython patch resolves only where uv has a\n * build of that patch: `3.14.7` installs on Linux but not on macOS, so `uv sync`\n * fails there on a workspace that works elsewhere.\n *\n * uv reads a bare `major.minor` as a request for any patch of that minor, so\n * dropping the patch lets each platform resolve a build it has. Lambda patches the\n * interpreter itself, so the minor is the whole of what a project needs to pin.\n *\n * Only a patch of the minor the releases in question vended is dropped — another\n * minor is the user's choice of interpreter, and the version sync moves the\n * interpreter forward when the runtime's minor itself changes.\n */\n\n/**\n * The Python runtime minor those releases vended, spelled out rather than read\n * from `LAMBDA_RUNTIME_VERSIONS`.\n *\n * A migration describes a fixed point in history: it has to keep rewriting the\n * versions those releases actually wrote, whatever the current pin is. Reading the\n * live constant would silently retarget this at whatever minor the plugin vends by\n * the time a user upgrades, and stop correcting the value it exists for.\n */\nconst VENDED_MINOR = '3.14';\n\nexport default async function migration(\n tree: Tree,\n): Promise<MigrationReturnObject> {\n // uv writes a `.python-version` per project as well as at the root, and one\n // left behind fails `uv sync` for that project alone.\n visitNotIgnoredFiles(tree, '.', (path) => {\n if (path !== '.python-version' && !path.endsWith('/.python-version')) {\n return;\n }\n const declared = (tree.read(path, 'utf-8') ?? '').trim();\n if (/^(\\d+\\.\\d+)\\.\\d+$/.exec(declared)?.[1] === VENDED_MINOR) {\n tree.write(path, `${VENDED_MINOR}\\n`);\n }\n });\n\n await formatFilesInSubtree(tree);\n\n return {};\n}\n"],"names":["visitNotIgnoredFiles","formatFilesInSubtree","VENDED_MINOR","migration","tree","path","endsWith","declared","read","trim","exec","write"],"mappings":"AAAA;;;CAGC,GACD,SAGEA,oBAAoB,QACf,aAAa;AACpB,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE;;;;;;;;;;;;CAYC,GAED;;;;;;;;CAQC,GACD,MAAMC,eAAe;AAErB,eAAe,eAAeC,UAC5BC,IAAU;IAEV,4EAA4E;IAC5E,sDAAsD;IACtDJ,qBAAqBI,MAAM,KAAK,CAACC;QAC/B,IAAIA,SAAS,qBAAqB,CAACA,KAAKC,QAAQ,CAAC,qBAAqB;YACpE;QACF;QACA,MAAMC,WAAW,AAACH,CAAAA,KAAKI,IAAI,CAACH,MAAM,YAAY,EAAC,EAAGI,IAAI;QACtD,IAAI,oBAAoBC,IAAI,CAACH,WAAW,CAAC,EAAE,KAAKL,cAAc;YAC5DE,KAAKO,KAAK,CAACN,MAAM,GAAGH,aAAa,EAAE,CAAC;QACtC;IACF;IAEA,MAAMD,qBAAqBG;IAE3B,OAAO,CAAC;AACV"}
|
package/src/migrations/v1.0.0-rc.88/0002-react-website-nx-react-express-override/migration.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/v1.0.0-rc.88/0002-react-website-nx-react-express-override/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n detectPackageManager,\n type MigrationReturnObject,\n readJson,\n type Tree,\n updateJson,\n} from '@nx/devkit';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { TS_VERSIONS } from '../../../utils/versions';\n\n/**\n * Pin the `express` `@nx/react` resolves to the version generated websites use.\n *\n * `@nx/react` declares an optional `express` peer for its module-federation\n * dev-server, on the major behind the `express` vended here. npm is alone in\n * failing the whole install on an optional peer it cannot satisfy:\n *\n * npm error ERESOLVE could not resolve\n * npm error peerOptional express@\"^4.21.2\" from @nx/react\n * npm error Conflicting peer dependency: express@5.2.1\n *\n * so an npm workspace with a website cannot install once its nx moves onto a\n * version carrying that peer. pnpm, bun and yarn only warn, and get nothing.\n *\n * Scoped to `@nx/react` rather than pinning `express` workspace-wide: nothing\n * here loads it, the peer only has to be satisfiable, and a bare override would\n * reach every other consumer of express too.\n *\n * Guardrails:\n * - npm only, and only for a workspace that has a website — the root `@nx/react`\n * the generator adds. Anything else needs no override.\n * - A user's own `overrides['@nx/react'].express` is left alone: theirs may pin a\n * version deliberately.\n * - Idempotent: writing the same pin twice is a no-op.\n */\nexport default async function migration(\n tree: Tree,\n): Promise<MigrationReturnObject> {\n const nextSteps: string[] = [];\n\n if (detectPackageManager(tree.root) !== 'npm') {\n return { nextSteps };\n }\n\n const packageJson = readJson<{\n devDependencies?: Record<string, string>;\n dependencies?: Record<string, string>;\n overrides?: Record<string, unknown>;\n }>(tree, 'package.json');\n\n const hasNxReact = Boolean(\n packageJson.devDependencies?.['@nx/react'] ??\n packageJson.dependencies?.['@nx/react'],\n );\n if (!hasNxReact) {\n return { nextSteps }; // No website in this workspace.\n }\n\n const scoped = packageJson.overrides?.['@nx/react'] as\n | Record<string, string>\n | string\n | undefined;\n\n // The string form pins `@nx/react` itself, leaving nowhere to nest the peer.\n if (typeof scoped === 'string') {\n nextSteps.push(\n `package.json: overrides['@nx/react'] pins a version as a string, so the express override could not be nested under it - left untouched. npm fails the install on @nx/react's optional express peer, so add { \"@nx/react\": { \".\": \"${scoped}\", \"express\": \"${TS_VERSIONS.express}\" } } to keep it satisfiable.`,\n );\n return { nextSteps };\n }\n\n if (scoped?.express) {\n return { nextSteps }; // Already pinned, by this migration or by the user.\n }\n\n updateJson(tree, 'package.json', (json) => ({\n ...json,\n overrides: {\n ...json.overrides,\n '@nx/react': { ...scoped, express: TS_VERSIONS.express },\n },\n }));\n\n await formatFilesInSubtree(tree);\n\n return { nextSteps };\n}\n"],"names":["detectPackageManager","readJson","updateJson","formatFilesInSubtree","TS_VERSIONS","migration","tree","nextSteps","root","packageJson","hasNxReact","Boolean","devDependencies","dependencies","scoped","overrides","push","express","json"],"mappings":"AAAA;;;CAGC,GACD,SACEA,oBAAoB,EAEpBC,QAAQ,EAERC,UAAU,QACL,aAAa;AACpB,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,WAAW,QAAQ,6BAA0B;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;CAwBC,GACD,eAAe,eAAeC,UAC5BC,IAAU;IAEV,MAAMC,YAAsB,EAAE;IAE9B,IAAIP,qBAAqBM,KAAKE,IAAI,MAAM,OAAO;QAC7C,OAAO;YAAED;QAAU;IACrB;IAEA,MAAME,cAAcR,SAIjBK,MAAM;IAET,MAAMI,aAAaC,QACjBF,YAAYG,eAAe,EAAE,CAAC,YAAY,IACxCH,YAAYI,YAAY,EAAE,CAAC,YAAY;IAE3C,IAAI,CAACH,YAAY;QACf,OAAO;YAAEH;QAAU,GAAG,gCAAgC;IACxD;IAEA,MAAMO,SAASL,YAAYM,SAAS,EAAE,CAAC,YAAY;IAKnD,6EAA6E;IAC7E,IAAI,OAAOD,WAAW,UAAU;QAC9BP,UAAUS,IAAI,CACZ,CAAC,kOAAkO,EAAEF,OAAO,eAAe,EAAEV,YAAYa,OAAO,CAAC,6BAA6B,CAAC;QAEjT,OAAO;YAAEV;QAAU;IACrB;IAEA,IAAIO,QAAQG,SAAS;QACnB,OAAO;YAAEV;QAAU,GAAG,oDAAoD;IAC5E;IAEAL,WAAWI,MAAM,gBAAgB,CAACY,OAAU,CAAA;YAC1C,GAAGA,IAAI;YACPH,WAAW;gBACT,GAAGG,KAAKH,SAAS;gBACjB,aAAa;oBAAE,GAAGD,MAAM;oBAAEG,SAASb,YAAYa,OAAO;gBAAC;YACzD;QACF,CAAA;IAEA,MAAMd,qBAAqBG;IAE3B,OAAO;QAAEC;IAAU;AACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/v1.0.0-rc.89/0001-nx-parallel-default/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type MigrationReturnObject,\n readNxJson,\n type Tree,\n updateNxJson,\n} from '@nx/devkit';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\nimport { DEFAULT_PARALLEL } from '../../../utils/init.js';\n\n/**\n * New workspaces set `parallel` in `nx.json` so a full build uses the available\n * cores rather than Nx's default of 3. Existing workspaces have no value at all,\n * so this backfills it.\n *\n * A workspace that already declares `parallel` has made a deliberate choice —\n * often to bound memory on a smaller machine — so it is left as it is.\n */\nexport default async function migration(\n tree: Tree,\n): Promise<MigrationReturnObject> {\n const nextSteps: string[] = [];\n\n const nxJson = readNxJson(tree);\n if (nxJson && nxJson.parallel === undefined) {\n updateNxJson(tree, { ...nxJson, parallel: DEFAULT_PARALLEL });\n }\n\n await formatFilesInSubtree(tree);\n\n return { nextSteps };\n}\n"],"names":["readNxJson","updateNxJson","formatFilesInSubtree","DEFAULT_PARALLEL","migration","tree","nextSteps","nxJson","parallel","undefined"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,UAAU,EAEVC,YAAY,QACP,aAAa;AACpB,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D;;;;;;;CAOC,GACD,eAAe,eAAeC,UAC5BC,IAAU;IAEV,MAAMC,YAAsB,EAAE;IAE9B,MAAMC,SAASP,WAAWK;IAC1B,IAAIE,UAAUA,OAAOC,QAAQ,KAAKC,WAAW;QAC3CR,aAAaI,MAAM;YAAE,GAAGE,MAAM;YAAEC,UAAUL;QAAiB;IAC7D;IAEA,MAAMD,qBAAqBG;IAE3B,OAAO;QAAEC;IAAU;AACrB"}
|
|
@@ -252,7 +252,7 @@ export default {
|
|
|
252
252
|
|
|
253
253
|
exports[`preset generator > should run successfully > biome.json 1`] = `
|
|
254
254
|
"{
|
|
255
|
-
"$schema": "https://biomejs.dev/schemas/2.5.
|
|
255
|
+
"$schema": "https://biomejs.dev/schemas/2.5.11/schema.json",
|
|
256
256
|
"root": true,
|
|
257
257
|
"formatter": {
|
|
258
258
|
"enabled": true,
|
|
@@ -420,7 +420,7 @@ catalog:
|
|
|
420
420
|
'@nx/js': 23.1.2
|
|
421
421
|
'@nx/workspace': 23.1.2
|
|
422
422
|
typescript: ~6.0.3
|
|
423
|
-
'@biomejs/biome': 2.5.
|
|
423
|
+
'@biomejs/biome': 2.5.11
|
|
424
424
|
'@aws/nx-plugin': ^0.0.0
|
|
425
425
|
'@aws/nx-plugin-mcp': ^0.0.0
|
|
426
426
|
"
|