@aws/nx-plugin 1.0.0-rc.93 → 1.0.0-rc.95
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/migrations.json +36 -1
- package/package.json +1 -1
- package/src/agentcore-harness/generator.d.ts +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/infra/app/generator.d.ts +1 -1
- package/src/infra/app/generator.js +5 -3
- package/src/infra/app/generator.js.map +1 -1
- package/src/init/generator.d.ts +1 -1
- package/src/migrations/latest/agent-connection-pin-strands-peers/metadata.json +3 -0
- package/src/migrations/latest/agent-connection-pin-strands-peers/migration.d.ts +18 -0
- package/src/migrations/latest/agent-connection-pin-strands-peers/migration.js +38 -0
- package/src/migrations/latest/agent-connection-pin-strands-peers/migration.js.map +1 -0
- package/src/migrations/latest/agent-core-vendor-target/metadata.json +3 -0
- package/src/migrations/latest/agent-core-vendor-target/migration.d.ts +6 -0
- package/src/migrations/latest/agent-core-vendor-target/migration.js +98 -0
- package/src/migrations/latest/agent-core-vendor-target/migration.js.map +1 -0
- package/src/migrations/latest/ignore-package-manager-temp-files/metadata.json +3 -0
- package/src/migrations/latest/ignore-package-manager-temp-files/migration.d.ts +12 -0
- package/src/migrations/latest/ignore-package-manager-temp-files/migration.js +25 -0
- package/src/migrations/latest/ignore-package-manager-temp-files/migration.js.map +1 -0
- package/src/migrations/latest/infra-deploy-express-mode/metadata.json +3 -0
- package/src/migrations/latest/infra-deploy-express-mode/migration.d.ts +6 -0
- package/src/migrations/latest/infra-deploy-express-mode/migration.js +83 -0
- package/src/migrations/latest/infra-deploy-express-mode/migration.js.map +1 -0
- package/src/migrations/latest/rolldown-config-bundle-transient/metadata.json +3 -0
- package/src/migrations/latest/rolldown-config-bundle-transient/migration.d.ts +6 -0
- package/src/migrations/latest/rolldown-config-bundle-transient/migration.js +80 -0
- package/src/migrations/latest/rolldown-config-bundle-transient/migration.js.map +1 -0
- package/src/migrations/latest/shadcn-package-imports-exports/metadata.json +3 -0
- package/src/migrations/latest/shadcn-package-imports-exports/migration.d.ts +6 -0
- package/src/migrations/latest/shadcn-package-imports-exports/migration.js +184 -0
- package/src/migrations/latest/shadcn-package-imports-exports/migration.js.map +1 -0
- package/src/migrations/latest/shx-fs-commands/metadata.json +3 -0
- package/src/migrations/latest/shx-fs-commands/migration.d.ts +6 -0
- package/src/migrations/latest/shx-fs-commands/migration.js +216 -0
- package/src/migrations/latest/shx-fs-commands/migration.js.map +1 -0
- package/src/open-api/ts-client/__snapshots__/generator.complex-types.spec.ts.snap +18 -12
- package/src/open-api/ts-client/__snapshots__/generator.edge-cases.spec.ts.snap +5 -2
- package/src/open-api/utils/codegen-data/types.d.ts +6 -0
- package/src/open-api/utils/codegen-data/types.js.map +1 -1
- package/src/open-api/utils/codegen-data.js +32 -7
- package/src/open-api/utils/codegen-data.js.map +1 -1
- package/src/open-api/utils/normalise.js +39 -14
- package/src/open-api/utils/normalise.js.map +1 -1
- package/src/open-api/utils/parser.js +51 -5
- package/src/open-api/utils/parser.js.map +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +5 -1
- package/src/preset/generator.d.ts +1 -1
- package/src/py/agent/a2a-connection/generator.d.ts +1 -1
- package/src/py/agent/gateway-connection/generator.d.ts +1 -1
- package/src/py/agent/generator.d.ts +2 -26
- package/src/py/agent/generator.js +2 -2
- package/src/py/agent/generator.js.map +1 -1
- package/src/py/agent/mcp-connection/generator.d.ts +1 -1
- package/src/py/agent/react-connection/generator.d.ts +1 -1
- package/src/py/fast-api/generator.d.ts +1 -13
- package/src/py/fast-api/generator.js +1 -1
- package/src/py/fast-api/generator.js.map +1 -1
- package/src/py/fast-api/react/generator.d.ts +1 -1
- package/src/py/mcp-server/generator.d.ts +2 -26
- package/src/py/mcp-server/generator.js +2 -2
- package/src/py/mcp-server/generator.js.map +1 -1
- package/src/py/rdb/generator.d.ts +2 -26
- package/src/py/rdb/generator.js +6 -6
- package/src/py/rdb/generator.js.map +1 -1
- package/src/smithy/project/__snapshots__/generator.spec.ts.snap +24 -20
- package/src/smithy/project/generator.d.ts +2 -14
- package/src/smithy/project/generator.js +2 -1
- package/src/smithy/project/generator.js.map +1 -1
- package/src/smithy/react-connection/generator.d.ts +1 -1
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +12 -8
- package/src/smithy/ts/api/generator.d.ts +1 -13
- package/src/smithy/ts/api/generator.js +1 -1
- package/src/smithy/ts/api/generator.js.map +1 -1
- package/src/terraform/project/generator.d.ts +2 -2
- package/src/terraform/project/generator.js +4 -4
- package/src/terraform/project/generator.js.map +1 -1
- package/src/trpc/react/generator.d.ts +1 -1
- package/src/ts/agent/a2a-connection/generator.d.ts +5 -1
- package/src/ts/agent/gateway-connection/generator.d.ts +5 -1
- package/src/ts/agent/generator.d.ts +5 -37
- package/src/ts/agent/generator.js +1 -1
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/generator.d.ts +5 -1
- package/src/ts/agent/react-connection/generator.d.ts +1 -1
- package/src/ts/astro-docs/generator.d.ts +1 -1
- package/src/ts/dcr-proxy/generator.d.ts +1 -1
- package/src/ts/dynamodb/generator.d.ts +1 -1
- package/src/ts/lambda-function/generator.d.ts +1 -1
- package/src/ts/lib/generator.d.ts +1 -1
- package/src/ts/mcp-server/generator.d.ts +3 -39
- package/src/ts/mcp-server/generator.js +1 -1
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/nx-generator/generator.d.ts +1 -1
- package/src/ts/nx-migration/generator.d.ts +1 -1
- package/src/ts/nx-plugin/generator.d.ts +1 -1
- package/src/ts/rdb/generator.d.ts +3 -27
- package/src/ts/rdb/generator.js +3 -3
- package/src/ts/rdb/generator.js.map +1 -1
- package/src/ts/react-website/agui/generator.d.ts +1 -1
- package/src/ts/react-website/agui/generator.js +2 -1
- package/src/ts/react-website/agui/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +2 -0
- package/src/ts/react-website/app/generator.js +2 -1
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/utils/agent-connection/agent-connection.d.ts +2 -0
- package/src/utils/agent-connection/agent-connection.js +11 -4
- package/src/utils/agent-connection/agent-connection.js.map +1 -1
- package/src/utils/agent-core-packaging.d.ts +25 -12
- package/src/utils/agent-core-packaging.js +47 -11
- package/src/utils/agent-core-packaging.js.map +1 -1
- package/src/utils/bundle/bundle.js +10 -0
- package/src/utils/bundle/bundle.js.map +1 -1
- package/src/utils/docker.d.ts +1 -7
- package/src/utils/docker.js +1 -1
- package/src/utils/docker.js.map +1 -1
- package/src/utils/files/common/shadcn/src/components/ui/alert.tsx.template +1 -1
- package/src/utils/files/common/shadcn/src/components/ui/avatar.tsx.template +1 -1
- package/src/utils/files/common/shadcn/src/components/ui/breadcrumb.tsx.template +1 -1
- package/src/utils/files/common/shadcn/src/components/ui/button.tsx.template +1 -1
- package/src/utils/files/common/shadcn/src/components/ui/card.tsx.template +1 -1
- package/src/utils/files/common/shadcn/src/components/ui/input.tsx.template +1 -1
- package/src/utils/files/common/shadcn/src/components/ui/separator.tsx.template +1 -1
- package/src/utils/files/common/shadcn/src/components/ui/sheet.tsx.template +1 -1
- package/src/utils/files/common/shadcn/src/components/ui/sidebar.tsx.template +8 -8
- package/src/utils/files/common/shadcn/src/components/ui/skeleton.tsx.template +1 -1
- package/src/utils/files/common/shadcn/src/components/ui/spinner.tsx.template +1 -1
- package/src/utils/files/common/shadcn/src/components/ui/textarea.tsx.template +1 -1
- package/src/utils/files/common/shadcn/src/components/ui/tooltip.tsx.template +1 -1
- package/src/utils/files/shadcn/components.json.template +5 -5
- package/src/utils/format.d.ts +21 -0
- package/src/utils/format.js +20 -0
- package/src/utils/format.js.map +1 -1
- package/src/utils/fs.d.ts +21 -11
- package/src/utils/fs.js +30 -22
- package/src/utils/fs.js.map +1 -1
- package/src/utils/init.js +11 -4
- package/src/utils/init.js.map +1 -1
- package/src/utils/pnpm-workspace.d.ts +5 -5
- package/src/utils/pnpm-workspace.js +5 -5
- package/src/utils/pnpm-workspace.js.map +1 -1
- package/src/utils/shared-shadcn.d.ts +9 -0
- package/src/utils/shared-shadcn.js +36 -26
- package/src/utils/shared-shadcn.js.map +1 -1
- package/src/utils/version-lockstep/lockstep.d.ts +27 -0
- package/src/utils/version-lockstep/lockstep.js +46 -0
- package/src/utils/version-lockstep/lockstep.js.map +1 -0
- package/src/utils/versions.d.ts +9 -4
- package/src/utils/versions.js +24 -4
- package/src/utils/versions.js.map +1 -1
package/migrations.json
CHANGED
|
@@ -52,6 +52,41 @@
|
|
|
52
52
|
"description": "Assign each react-website project its own dev-server and preview port, and allow-list them for any connected Cognito auth",
|
|
53
53
|
"implementation": "./src/migrations/latest/react-website-unique-dev-ports/migration"
|
|
54
54
|
},
|
|
55
|
+
"latest-infra-deploy-express-mode": {
|
|
56
|
+
"version": "1.0.0-rc.94",
|
|
57
|
+
"description": "Deploy using CloudFormation express mode from the deploy and deploy-sandbox targets of ts#infra projects",
|
|
58
|
+
"implementation": "./src/migrations/latest/infra-deploy-express-mode/migration"
|
|
59
|
+
},
|
|
60
|
+
"latest-shx-fs-commands": {
|
|
61
|
+
"version": "1.0.0-rc.94",
|
|
62
|
+
"description": "Replace the ncp, rimraf, make-dir-cli and cpy-cli filesystem CLIs with shx",
|
|
63
|
+
"implementation": "./src/migrations/latest/shx-fs-commands/migration"
|
|
64
|
+
},
|
|
65
|
+
"latest-agent-core-vendor-target": {
|
|
66
|
+
"version": "1.0.0-rc.94",
|
|
67
|
+
"description": "Cache the AgentCore ADOT install in its own target so editing an agent no longer re-runs it",
|
|
68
|
+
"implementation": "./src/migrations/latest/agent-core-vendor-target/migration"
|
|
69
|
+
},
|
|
70
|
+
"latest-rolldown-config-bundle-transient": {
|
|
71
|
+
"version": "1.0.0-rc.95",
|
|
72
|
+
"description": "Exclude the transient bundle rolldown writes while loading a TypeScript config from Biome and from git, so a concurrent format or lint target cannot fail on it",
|
|
73
|
+
"implementation": "./src/migrations/latest/rolldown-config-bundle-transient/migration"
|
|
74
|
+
},
|
|
75
|
+
"latest-agent-connection-pin-strands-peers": {
|
|
76
|
+
"version": "1.0.0-rc.95",
|
|
77
|
+
"description": "Declare @aws-sdk/client-s3 in the shared agent-connection project so @strands-agents/sdk resolves to a single peer-suffixed instance",
|
|
78
|
+
"implementation": "./src/migrations/latest/agent-connection-pin-strands-peers/migration"
|
|
79
|
+
},
|
|
80
|
+
"latest-ignore-package-manager-temp-files": {
|
|
81
|
+
"version": "1.0.0-rc.95",
|
|
82
|
+
"description": "Ignore the temporary files pnpm writes at the workspace root while materialising packages, which otherwise invalidate the Nx project graph",
|
|
83
|
+
"implementation": "./src/migrations/latest/ignore-package-manager-temp-files/migration"
|
|
84
|
+
},
|
|
85
|
+
"latest-shadcn-package-imports-exports": {
|
|
86
|
+
"version": "1.0.0-rc.95",
|
|
87
|
+
"description": "Move the shared shadcn package from a tsconfig paths alias to package.json imports/exports, matching the shadcn CLI's own monorepo resolution",
|
|
88
|
+
"implementation": "./src/migrations/latest/shadcn-package-imports-exports/migration"
|
|
89
|
+
},
|
|
55
90
|
"v1.0.0-rc.50-0001-modernize-function-props-cast": {
|
|
56
91
|
"version": "1.0.0-rc.50",
|
|
57
92
|
"description": "Replace the legacy angle-bracket FunctionProps type assertion with the modern as syntax in generated API constructs",
|
|
@@ -293,7 +328,7 @@
|
|
|
293
328
|
"implementation": "./src/migrations/v1.0.0-rc.89/0001-nx-parallel-default/migration"
|
|
294
329
|
},
|
|
295
330
|
"sync-vended-versions": {
|
|
296
|
-
"version": "1.0.0-rc.
|
|
331
|
+
"version": "1.0.0-rc.95",
|
|
297
332
|
"description": "Sync vended dependency versions and the tracked plugin version to those vended by this release",
|
|
298
333
|
"implementation": "./src/utils/version-upgrade-migration/migration"
|
|
299
334
|
}
|
package/package.json
CHANGED
|
@@ -40,7 +40,7 @@ export declare const DEPENDENCIES: import("../utils/declared-dependencies.js").D
|
|
|
40
40
|
readonly name: "@types/node";
|
|
41
41
|
} & {
|
|
42
42
|
versionOnly: true;
|
|
43
|
-
}], readonly import("../utils/declared-dependencies.js").DeclaredPyDependency<"a2a-sdk" | "ag-ui-langgraph" | "ag-ui-protocol" | "ag-ui-strands" | "aiosqlite" | "aws-lambda-powertools" | "aws-lambda-powertools[tracer]" | "aws-lambda-powertools[parser]" | "aws-opentelemetry-distro" | "bedrock-agentcore" | "boto3" | "checkov" | "fastapi" | "fastapi[standard]" | "httpx" | "langchain" | "langchain-aws" | "langchain-mcp-adapters" | "langgraph" | "langgraph-checkpoint-aws" | "langgraph-checkpoint-sqlite" | "mcp" | "pip-check-updates" | "pip-licenses" | "
|
|
43
|
+
}], readonly import("../utils/declared-dependencies.js").DeclaredPyDependency<"ruff" | "a2a-sdk" | "ag-ui-langgraph" | "ag-ui-protocol" | "ag-ui-strands" | "aiosqlite" | "aws-lambda-powertools" | "aws-lambda-powertools[tracer]" | "aws-lambda-powertools[parser]" | "aws-opentelemetry-distro" | "bedrock-agentcore" | "boto3" | "checkov" | "fastapi" | "fastapi[standard]" | "httpx" | "langchain" | "langchain-aws" | "langchain-mcp-adapters" | "langgraph" | "langgraph-checkpoint-aws" | "langgraph-checkpoint-sqlite" | "mcp" | "pip-check-updates" | "pip-licenses" | "strands-agents" | "strands-agents[a2a]" | "strands-agents-tools" | "ty" | "pynamodb" | "uvicorn" | "sqlmodel" | "alembic" | "aiomysql" | "asyncpg" | "greenlet", AgentCoreHarnessMetadata>[]>;
|
|
44
44
|
export declare const AGENTCORE_HARNESS_GENERATOR_INFO: NxGeneratorInfo;
|
|
45
45
|
export declare const agentcoreHarnessGenerator: (tree: Tree, options: AgentcoreHarnessGeneratorSchema) => Promise<GeneratorCallback>;
|
|
46
46
|
/**
|
|
@@ -84,7 +84,7 @@ exports[`infra generator > should configure project.json with correct targets >
|
|
|
84
84
|
],
|
|
85
85
|
"executor": "nx:run-commands",
|
|
86
86
|
"options": {
|
|
87
|
-
"command": "cdk deploy --require-approval=never",
|
|
87
|
+
"command": "cdk deploy --require-approval=never --express",
|
|
88
88
|
"cwd": "{projectRoot}",
|
|
89
89
|
},
|
|
90
90
|
}
|
|
@@ -179,7 +179,7 @@ exports[`infra generator > should configure project.json with correct targets >
|
|
|
179
179
|
],
|
|
180
180
|
"executor": "nx:run-commands",
|
|
181
181
|
"options": {
|
|
182
|
-
"command": "cdk deploy --require-approval=never",
|
|
182
|
+
"command": "cdk deploy --require-approval=never --express",
|
|
183
183
|
"cwd": "{projectRoot}",
|
|
184
184
|
},
|
|
185
185
|
},
|
|
@@ -197,7 +197,7 @@ exports[`infra generator > should configure project.json with correct targets >
|
|
|
197
197
|
],
|
|
198
198
|
"executor": "nx:run-commands",
|
|
199
199
|
"options": {
|
|
200
|
-
"command": "cdk deploy --require-approval=never "proj-test-sandbox/*"",
|
|
200
|
+
"command": "cdk deploy --require-approval=never "proj-test-sandbox/*" --express",
|
|
201
201
|
"cwd": "{projectRoot}",
|
|
202
202
|
},
|
|
203
203
|
},
|
|
@@ -791,7 +791,7 @@ exports[`infra generator > should handle custom project names correctly > custom
|
|
|
791
791
|
],
|
|
792
792
|
"executor": "nx:run-commands",
|
|
793
793
|
"options": {
|
|
794
|
-
"command": "cdk deploy --require-approval=never",
|
|
794
|
+
"command": "cdk deploy --require-approval=never --express",
|
|
795
795
|
"cwd": "{projectRoot}",
|
|
796
796
|
},
|
|
797
797
|
},
|
|
@@ -809,7 +809,7 @@ exports[`infra generator > should handle custom project names correctly > custom
|
|
|
809
809
|
],
|
|
810
810
|
"executor": "nx:run-commands",
|
|
811
811
|
"options": {
|
|
812
|
-
"command": "cdk deploy --require-approval=never "proj-custom-infra-sandbox/*"",
|
|
812
|
+
"command": "cdk deploy --require-approval=never "proj-custom-infra-sandbox/*" --express",
|
|
813
813
|
"cwd": "{projectRoot}",
|
|
814
814
|
},
|
|
815
815
|
},
|
|
@@ -47,7 +47,7 @@ export declare const DEPENDENCIES: import("../../utils/declared-dependencies.js"
|
|
|
47
47
|
readonly when: (m: import("../../utils/shared-constructs-constants.js").IacMetadata) => boolean;
|
|
48
48
|
} & {
|
|
49
49
|
versionOnly: true;
|
|
50
|
-
}], readonly import("../../utils/declared-dependencies.js").DeclaredPyDependency<"a2a-sdk" | "ag-ui-langgraph" | "ag-ui-protocol" | "ag-ui-strands" | "aiosqlite" | "aws-lambda-powertools" | "aws-lambda-powertools[tracer]" | "aws-lambda-powertools[parser]" | "aws-opentelemetry-distro" | "bedrock-agentcore" | "boto3" | "checkov" | "fastapi" | "fastapi[standard]" | "httpx" | "langchain" | "langchain-aws" | "langchain-mcp-adapters" | "langgraph" | "langgraph-checkpoint-aws" | "langgraph-checkpoint-sqlite" | "mcp" | "pip-check-updates" | "pip-licenses" | "
|
|
50
|
+
}], readonly import("../../utils/declared-dependencies.js").DeclaredPyDependency<"ruff" | "a2a-sdk" | "ag-ui-langgraph" | "ag-ui-protocol" | "ag-ui-strands" | "aiosqlite" | "aws-lambda-powertools" | "aws-lambda-powertools[tracer]" | "aws-lambda-powertools[parser]" | "aws-opentelemetry-distro" | "bedrock-agentcore" | "boto3" | "checkov" | "fastapi" | "fastapi[standard]" | "httpx" | "langchain" | "langchain-aws" | "langchain-mcp-adapters" | "langgraph" | "langgraph-checkpoint-aws" | "langgraph-checkpoint-sqlite" | "mcp" | "pip-check-updates" | "pip-licenses" | "strands-agents" | "strands-agents[a2a]" | "strands-agents-tools" | "ty" | "pynamodb" | "uvicorn" | "sqlmodel" | "alembic" | "aiomysql" | "asyncpg" | "greenlet", Record<string, never>>[]>;
|
|
51
51
|
export declare const INFRA_APP_GENERATOR_INFO: NxGeneratorInfo;
|
|
52
52
|
export declare function tsInfraGenerator(tree: Tree, schema: TsInfraGeneratorSchema): Promise<GeneratorCallback>;
|
|
53
53
|
export default tsInfraGenerator;
|
|
@@ -171,11 +171,13 @@ export async function tsInfraGenerator(tree, schema) {
|
|
|
171
171
|
'^assemble',
|
|
172
172
|
'compile'
|
|
173
173
|
],
|
|
174
|
+
// No --express here when stages are configured: this target deploys
|
|
175
|
+
// whichever stage is named, including beta and prod.
|
|
174
176
|
options: stageConfig ? withCdkEnv({
|
|
175
177
|
command: `tsx packages/common/scripts/src/infra/infra-deploy.ts ${libraryRoot}`
|
|
176
178
|
}) : withCdkEnv({
|
|
177
179
|
cwd: '{projectRoot}',
|
|
178
|
-
command: 'cdk deploy --require-approval=never'
|
|
180
|
+
command: 'cdk deploy --require-approval=never --express'
|
|
179
181
|
})
|
|
180
182
|
};
|
|
181
183
|
config.targets['deploy-sandbox'] = {
|
|
@@ -185,10 +187,10 @@ export async function tsInfraGenerator(tree, schema) {
|
|
|
185
187
|
'compile'
|
|
186
188
|
],
|
|
187
189
|
options: stageConfig ? withCdkEnv({
|
|
188
|
-
command: `tsx packages/common/scripts/src/infra/infra-deploy.ts ${libraryRoot} ${sandboxStagePattern}`
|
|
190
|
+
command: `tsx packages/common/scripts/src/infra/infra-deploy.ts ${libraryRoot} ${sandboxStagePattern} --express`
|
|
189
191
|
}) : withCdkEnv({
|
|
190
192
|
cwd: '{projectRoot}',
|
|
191
|
-
command: `cdk deploy --require-approval=never ${sandboxStagePattern}`
|
|
193
|
+
command: `cdk deploy --require-approval=never ${sandboxStagePattern} --express`
|
|
192
194
|
})
|
|
193
195
|
};
|
|
194
196
|
config.targets['deploy-ci'] = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/infra/app/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type ProjectConfiguration,\n readProjectConfiguration,\n type Tree,\n updateJson,\n} from '@nx/devkit';\nimport path from 'path';\nimport tsProjectGenerator, { getTsLibDetails } from '../../ts/lib/generator.js';\nimport { mergeTsReferences } from '../../ts/lib/ts-project-utils.js';\nimport { addTsDependencies } from '../../utils/add-dependencies.js';\nimport { resolveContainers } from '../../utils/containers.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { esmVars } from '../../utils/module-format.js';\nimport { kebabCase } from '../../utils/names.js';\nimport { getNpmScopePrefix } from '../../utils/npm-scope.js';\nimport {\n addArtifactDependencyToTargets,\n addDependencyToTargetIfNotPresent,\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { getPackageManagerDisplayCommands } from '../../utils/pkg-manager.js';\nimport { uvxCommand } from '../../utils/py.js';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n sharedConstructsGenerator,\n} from '../../utils/shared-constructs.js';\nimport {\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_INFRA_CONFIG_DIR,\n} from '../../utils/shared-constructs-constants.js';\nimport { sharedInfraConfigGenerator } from '../../utils/shared-infra-config.js';\nimport {\n SHARED_INFRA_SCRIPTS_DEPENDENCIES,\n sharedInfraScriptsGenerator,\n} from '../../utils/shared-infra-scripts.js';\nimport type { TsInfraGeneratorSchema } from './schema';\n\n// This generator records no metadata, so nothing a predicate could read: the\n// CDK app always needs the app libraries, and the CLI, bundler and tsx are\n// shared tooling.\nexport const DEPENDENCIES = declareDependencies()({\n ts: [\n { name: 'aws-cdk-lib' },\n { name: 'constructs' },\n { name: 'source-map-support' },\n // The `aws-cdk` CLI, esbuild (CDK bundling) and tsx are shared tooling.\n { name: 'aws-cdk', dev: true, root: true },\n { name: 'esbuild', dev: true, root: true },\n { name: 'tsx', dev: true, root: true },\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ...ownedElsewhere(SHARED_INFRA_SCRIPTS_DEPENDENCIES),\n ],\n});\n\nexport const INFRA_APP_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport async function tsInfraGenerator(\n tree: Tree,\n schema: TsInfraGeneratorSchema,\n): Promise<GeneratorCallback> {\n const lib = getTsLibDetails(tree, schema);\n\n if (!projectExists(tree, lib.fullyQualifiedName)) {\n await tsProjectGenerator(tree, {\n ...schema,\n preferInstallDependencies: false,\n });\n }\n\n // CDK shells out to a container engine to build image assets. Default\n // (docker) needs no env override; finch is set via CDK_DOCKER per\n // https://docs.aws.amazon.com/cdk/v2/guide/build-containers.html#build-container-replace.\n const containers = await resolveContainers(tree, 'inherit');\n const cdkEnv: Record<string, string> | undefined =\n containers === 'docker' ? undefined : { CDK_DOCKER: containers };\n const withCdkEnv = <T extends Record<string, unknown>>(opts: T): T => {\n if (!cdkEnv) return opts;\n const existingEnv = (opts.env as Record<string, string> | undefined) ?? {};\n return { ...opts, env: { ...existingEnv, ...cdkEnv } } as T;\n };\n\n // This generator IS the CDK infrastructure project, so the provider is fixed.\n addGeneratorMetadata(tree, lib.fullyQualifiedName, INFRA_APP_GENERATOR_INFO, {\n iac: 'cdk',\n });\n\n // Shared constructs always in CDK for typescript infra generator\n await sharedConstructsGenerator(\n tree,\n {\n iac: 'cdk',\n },\n DEPENDENCIES,\n );\n\n // Shared infra-config and infra-scripts packages (lazy creation, only when enabled)\n const stageConfig = schema.stageConfig ?? false;\n if (stageConfig) {\n await sharedInfraConfigGenerator(tree);\n await sharedInfraScriptsGenerator(tree, DEPENDENCIES);\n }\n\n const synthDirFromRoot = `/dist/${lib.dir}/cdk.out`;\n const synthDirFromProject =\n lib.dir\n .split('/')\n .map(() => '..')\n .join('/') + `/dist/${lib.dir}/cdk.out`;\n const distDirFromProjectRoot =\n lib.dir\n .split('/')\n .map(() => '..')\n .join('/') + '/dist/{projectRoot}/cdk.out';\n const projectConfig = readProjectConfiguration(tree, lib.fullyQualifiedName);\n const libraryRoot = projectConfig.root;\n const npmScopePrefix = getNpmScopePrefix(tree);\n const scopeAlias = npmScopePrefix;\n const fullyQualifiedName = `${npmScopePrefix}${schema.name}`;\n const namespace = kebabCase(fullyQualifiedName);\n // The stage instantiated in main.ts. Quoted so the shell does not glob `*`.\n const sandboxStagePattern = `\"${namespace}-sandbox/*\"`;\n tree.delete(joinPathFragments(libraryRoot, 'src'));\n\n generateFiles(\n tree, // the virtual file system\n joinPathFragments(import.meta.dirname, './files/app'), // path to the file templates\n libraryRoot, // destination path of the files\n {\n synthDir: synthDirFromProject,\n scopeAlias: scopeAlias,\n namespace,\n fullyQualifiedName,\n pkgMgrCmd: getPackageManagerDisplayCommands().exec,\n dir: lib.dir,\n stageConfig,\n ...schema,\n ...esmVars(tree),\n },\n {\n overwriteStrategy: OverwriteStrategy.Overwrite,\n },\n );\n\n updateJson(\n tree,\n `${libraryRoot}/project.json`,\n (config: ProjectConfiguration) => {\n config.projectType = 'application';\n // `synth` is the CDK artifact, so it belongs on `assemble` too; `checkov`\n // is a quality gate, so it stays on `build` alone.\n addArtifactDependencyToTargets(config, 'synth');\n addDependencyToTargetIfNotPresent(config, 'build', 'checkov');\n config.targets.compile.outputs = [\n '{workspaceRoot}/dist/{projectRoot}/tsc',\n ];\n config.targets.synth = {\n cache: true,\n executor: 'nx:run-commands',\n inputs: ['default'],\n outputs: ['{workspaceRoot}/dist/{projectRoot}/cdk.out'],\n dependsOn: ['^assemble', 'compile'], // compile clobbers dist directory, so ensure synth runs afterwards\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk synth',\n }),\n };\n config.targets.checkov = {\n cache: true,\n executor: 'nx:run-commands',\n inputs: ['{workspaceRoot}/dist/{projectRoot}/cdk.out'],\n outputs: ['{workspaceRoot}/dist/{projectRoot}/checkov'],\n dependsOn: ['synth'],\n options: {\n command: uvxCommand(\n 'checkov',\n '--config-file {projectRoot}/checkov.yml --directory dist/{projectRoot}/cdk.out --framework cloudformation',\n ),\n },\n };\n config.targets.deploy = {\n executor: 'nx:run-commands',\n dependsOn: ['^assemble', 'compile'],\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-deploy.ts ${libraryRoot}`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk deploy --require-approval=never',\n }),\n };\n config.targets['deploy-sandbox'] = {\n executor: 'nx:run-commands',\n dependsOn: ['^assemble', 'compile'],\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-deploy.ts ${libraryRoot} ${sandboxStagePattern}`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk deploy --require-approval=never ${sandboxStagePattern}`,\n }),\n };\n config.targets['deploy-ci'] = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk deploy --require-approval=never --app ${distDirFromProjectRoot}`,\n }),\n };\n config.targets.destroy = {\n executor: 'nx:run-commands',\n dependsOn: ['^assemble', 'compile'],\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-destroy.ts ${libraryRoot}`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk destroy',\n }),\n };\n config.targets['destroy-sandbox'] = {\n executor: 'nx:run-commands',\n dependsOn: ['^assemble', 'compile'],\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-destroy.ts ${libraryRoot} ${sandboxStagePattern}`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk destroy ${sandboxStagePattern}`,\n }),\n };\n config.targets['destroy-ci'] = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk destroy --app ${distDirFromProjectRoot}`,\n }),\n };\n config.targets.cdk = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk',\n }),\n };\n config.targets.bootstrap = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk bootstrap',\n }),\n };\n config.targets = sortObjectKeys(config.targets);\n return config;\n },\n );\n\n addTsDependencies(tree, DEPENDENCIES, { projectRoot: libraryRoot });\n\n updateJson(tree, `${libraryRoot}/tsconfig.lib.json`, (tsConfig) => ({\n ...tsConfig,\n references: mergeTsReferences(tsConfig.references, [\n {\n path: `${path.relative(\n libraryRoot,\n `${tree.root}/${PACKAGES_DIR}`,\n )}/${SHARED_CONSTRUCTS_DIR}/tsconfig.lib.json`,\n },\n ...(stageConfig\n ? [\n {\n path: `${path.relative(\n libraryRoot,\n `${tree.root}/${PACKAGES_DIR}`,\n )}/${SHARED_INFRA_CONFIG_DIR}/tsconfig.json`,\n },\n ]\n : []),\n ]),\n }));\n\n await addGeneratorMetricsIfApplicable(tree, [INFRA_APP_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript'],\n });\n}\nexport default tsInfraGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readProjectConfiguration","updateJson","path","tsProjectGenerator","getTsLibDetails","mergeTsReferences","addTsDependencies","resolveContainers","declareDependencies","ownedElsewhere","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","esmVars","kebabCase","getNpmScopePrefix","addArtifactDependencyToTargets","addDependencyToTargetIfNotPresent","addGeneratorMetadata","getGeneratorInfo","projectExists","sortObjectKeys","getPackageManagerDisplayCommands","uvxCommand","SHARED_CONSTRUCTS_DEPENDENCIES","sharedConstructsGenerator","PACKAGES_DIR","SHARED_CONSTRUCTS_DIR","SHARED_INFRA_CONFIG_DIR","sharedInfraConfigGenerator","SHARED_INFRA_SCRIPTS_DEPENDENCIES","sharedInfraScriptsGenerator","DEPENDENCIES","ts","name","dev","root","INFRA_APP_GENERATOR_INFO","filename","tsInfraGenerator","tree","schema","lib","fullyQualifiedName","preferInstallDependencies","containers","cdkEnv","undefined","CDK_DOCKER","withCdkEnv","opts","existingEnv","env","iac","stageConfig","synthDirFromRoot","dir","synthDirFromProject","split","map","join","distDirFromProjectRoot","projectConfig","libraryRoot","npmScopePrefix","scopeAlias","namespace","sandboxStagePattern","delete","dirname","synthDir","pkgMgrCmd","exec","overwriteStrategy","Overwrite","config","projectType","targets","compile","outputs","synth","cache","executor","inputs","dependsOn","options","cwd","command","checkov","deploy","destroy","cdk","bootstrap","projectRoot","tsConfig","references","relative","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAEjBC,wBAAwB,EAExBC,UAAU,QACL,aAAa;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,sBAAsBC,eAAe,QAAQ,4BAA4B;AAChF,SAASC,iBAAiB,QAAQ,mCAAmC;AACrE,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SACEC,mBAAmB,EACnBC,cAAc,QACT,uCAAuC;AAC9C,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,OAAO,QAAQ,+BAA+B;AACvD,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,iBAAiB,QAAQ,2BAA2B;AAC7D,SACEC,8BAA8B,EAC9BC,iCAAiC,EACjCC,oBAAoB,EACpBC,gBAAgB,EAEhBC,aAAa,QACR,oBAAoB;AAC3B,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,gCAAgC,QAAQ,6BAA6B;AAC9E,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SACEC,8BAA8B,EAC9BC,yBAAyB,QACpB,mCAAmC;AAC1C,SACEC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,6CAA6C;AACpD,SAASC,0BAA0B,QAAQ,qCAAqC;AAChF,SACEC,iCAAiC,EACjCC,2BAA2B,QACtB,sCAAsC;AAG7C,6EAA6E;AAC7E,2EAA2E;AAC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AAc,CAAC;oBAC9C;iBACD,GACD,EAAE;aACP;QACH,CAAA;IAEA,MAAMhB,gCAAgC4B,MAAM;QAACH;KAAyB;IAEtE,MAAM3B,qBAAqB8B;IAC3B,OAAO,IACL7B,oBAAoB6B,MAAMC,OAAOG,yBAAyB,EAAE;YAC1DqD,WAAW;gBAAC;aAAa;QAC3B;AACJ;AACA,eAAe1D,iBAAiB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/infra/app/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type ProjectConfiguration,\n readProjectConfiguration,\n type Tree,\n updateJson,\n} from '@nx/devkit';\nimport path from 'path';\nimport tsProjectGenerator, { getTsLibDetails } from '../../ts/lib/generator.js';\nimport { mergeTsReferences } from '../../ts/lib/ts-project-utils.js';\nimport { addTsDependencies } from '../../utils/add-dependencies.js';\nimport { resolveContainers } from '../../utils/containers.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { esmVars } from '../../utils/module-format.js';\nimport { kebabCase } from '../../utils/names.js';\nimport { getNpmScopePrefix } from '../../utils/npm-scope.js';\nimport {\n addArtifactDependencyToTargets,\n addDependencyToTargetIfNotPresent,\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { getPackageManagerDisplayCommands } from '../../utils/pkg-manager.js';\nimport { uvxCommand } from '../../utils/py.js';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n sharedConstructsGenerator,\n} from '../../utils/shared-constructs.js';\nimport {\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_INFRA_CONFIG_DIR,\n} from '../../utils/shared-constructs-constants.js';\nimport { sharedInfraConfigGenerator } from '../../utils/shared-infra-config.js';\nimport {\n SHARED_INFRA_SCRIPTS_DEPENDENCIES,\n sharedInfraScriptsGenerator,\n} from '../../utils/shared-infra-scripts.js';\nimport type { TsInfraGeneratorSchema } from './schema';\n\n// This generator records no metadata, so nothing a predicate could read: the\n// CDK app always needs the app libraries, and the CLI, bundler and tsx are\n// shared tooling.\nexport const DEPENDENCIES = declareDependencies()({\n ts: [\n { name: 'aws-cdk-lib' },\n { name: 'constructs' },\n { name: 'source-map-support' },\n // The `aws-cdk` CLI, esbuild (CDK bundling) and tsx are shared tooling.\n { name: 'aws-cdk', dev: true, root: true },\n { name: 'esbuild', dev: true, root: true },\n { name: 'tsx', dev: true, root: true },\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ...ownedElsewhere(SHARED_INFRA_SCRIPTS_DEPENDENCIES),\n ],\n});\n\nexport const INFRA_APP_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport async function tsInfraGenerator(\n tree: Tree,\n schema: TsInfraGeneratorSchema,\n): Promise<GeneratorCallback> {\n const lib = getTsLibDetails(tree, schema);\n\n if (!projectExists(tree, lib.fullyQualifiedName)) {\n await tsProjectGenerator(tree, {\n ...schema,\n preferInstallDependencies: false,\n });\n }\n\n // CDK shells out to a container engine to build image assets. Default\n // (docker) needs no env override; finch is set via CDK_DOCKER per\n // https://docs.aws.amazon.com/cdk/v2/guide/build-containers.html#build-container-replace.\n const containers = await resolveContainers(tree, 'inherit');\n const cdkEnv: Record<string, string> | undefined =\n containers === 'docker' ? undefined : { CDK_DOCKER: containers };\n const withCdkEnv = <T extends Record<string, unknown>>(opts: T): T => {\n if (!cdkEnv) return opts;\n const existingEnv = (opts.env as Record<string, string> | undefined) ?? {};\n return { ...opts, env: { ...existingEnv, ...cdkEnv } } as T;\n };\n\n // This generator IS the CDK infrastructure project, so the provider is fixed.\n addGeneratorMetadata(tree, lib.fullyQualifiedName, INFRA_APP_GENERATOR_INFO, {\n iac: 'cdk',\n });\n\n // Shared constructs always in CDK for typescript infra generator\n await sharedConstructsGenerator(\n tree,\n {\n iac: 'cdk',\n },\n DEPENDENCIES,\n );\n\n // Shared infra-config and infra-scripts packages (lazy creation, only when enabled)\n const stageConfig = schema.stageConfig ?? false;\n if (stageConfig) {\n await sharedInfraConfigGenerator(tree);\n await sharedInfraScriptsGenerator(tree, DEPENDENCIES);\n }\n\n const synthDirFromRoot = `/dist/${lib.dir}/cdk.out`;\n const synthDirFromProject =\n lib.dir\n .split('/')\n .map(() => '..')\n .join('/') + `/dist/${lib.dir}/cdk.out`;\n const distDirFromProjectRoot =\n lib.dir\n .split('/')\n .map(() => '..')\n .join('/') + '/dist/{projectRoot}/cdk.out';\n const projectConfig = readProjectConfiguration(tree, lib.fullyQualifiedName);\n const libraryRoot = projectConfig.root;\n const npmScopePrefix = getNpmScopePrefix(tree);\n const scopeAlias = npmScopePrefix;\n const fullyQualifiedName = `${npmScopePrefix}${schema.name}`;\n const namespace = kebabCase(fullyQualifiedName);\n // The stage instantiated in main.ts. Quoted so the shell does not glob `*`.\n const sandboxStagePattern = `\"${namespace}-sandbox/*\"`;\n tree.delete(joinPathFragments(libraryRoot, 'src'));\n\n generateFiles(\n tree, // the virtual file system\n joinPathFragments(import.meta.dirname, './files/app'), // path to the file templates\n libraryRoot, // destination path of the files\n {\n synthDir: synthDirFromProject,\n scopeAlias: scopeAlias,\n namespace,\n fullyQualifiedName,\n pkgMgrCmd: getPackageManagerDisplayCommands().exec,\n dir: lib.dir,\n stageConfig,\n ...schema,\n ...esmVars(tree),\n },\n {\n overwriteStrategy: OverwriteStrategy.Overwrite,\n },\n );\n\n updateJson(\n tree,\n `${libraryRoot}/project.json`,\n (config: ProjectConfiguration) => {\n config.projectType = 'application';\n // `synth` is the CDK artifact, so it belongs on `assemble` too; `checkov`\n // is a quality gate, so it stays on `build` alone.\n addArtifactDependencyToTargets(config, 'synth');\n addDependencyToTargetIfNotPresent(config, 'build', 'checkov');\n config.targets.compile.outputs = [\n '{workspaceRoot}/dist/{projectRoot}/tsc',\n ];\n config.targets.synth = {\n cache: true,\n executor: 'nx:run-commands',\n inputs: ['default'],\n outputs: ['{workspaceRoot}/dist/{projectRoot}/cdk.out'],\n dependsOn: ['^assemble', 'compile'], // compile clobbers dist directory, so ensure synth runs afterwards\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk synth',\n }),\n };\n config.targets.checkov = {\n cache: true,\n executor: 'nx:run-commands',\n inputs: ['{workspaceRoot}/dist/{projectRoot}/cdk.out'],\n outputs: ['{workspaceRoot}/dist/{projectRoot}/checkov'],\n dependsOn: ['synth'],\n options: {\n command: uvxCommand(\n 'checkov',\n '--config-file {projectRoot}/checkov.yml --directory dist/{projectRoot}/cdk.out --framework cloudformation',\n ),\n },\n };\n config.targets.deploy = {\n executor: 'nx:run-commands',\n dependsOn: ['^assemble', 'compile'],\n // No --express here when stages are configured: this target deploys\n // whichever stage is named, including beta and prod.\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-deploy.ts ${libraryRoot}`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk deploy --require-approval=never --express',\n }),\n };\n config.targets['deploy-sandbox'] = {\n executor: 'nx:run-commands',\n dependsOn: ['^assemble', 'compile'],\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-deploy.ts ${libraryRoot} ${sandboxStagePattern} --express`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk deploy --require-approval=never ${sandboxStagePattern} --express`,\n }),\n };\n config.targets['deploy-ci'] = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk deploy --require-approval=never --app ${distDirFromProjectRoot}`,\n }),\n };\n config.targets.destroy = {\n executor: 'nx:run-commands',\n dependsOn: ['^assemble', 'compile'],\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-destroy.ts ${libraryRoot}`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk destroy',\n }),\n };\n config.targets['destroy-sandbox'] = {\n executor: 'nx:run-commands',\n dependsOn: ['^assemble', 'compile'],\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-destroy.ts ${libraryRoot} ${sandboxStagePattern}`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk destroy ${sandboxStagePattern}`,\n }),\n };\n config.targets['destroy-ci'] = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk destroy --app ${distDirFromProjectRoot}`,\n }),\n };\n config.targets.cdk = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk',\n }),\n };\n config.targets.bootstrap = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk bootstrap',\n }),\n };\n config.targets = sortObjectKeys(config.targets);\n return config;\n },\n );\n\n addTsDependencies(tree, DEPENDENCIES, { projectRoot: libraryRoot });\n\n updateJson(tree, `${libraryRoot}/tsconfig.lib.json`, (tsConfig) => ({\n ...tsConfig,\n references: mergeTsReferences(tsConfig.references, [\n {\n path: `${path.relative(\n libraryRoot,\n `${tree.root}/${PACKAGES_DIR}`,\n )}/${SHARED_CONSTRUCTS_DIR}/tsconfig.lib.json`,\n },\n ...(stageConfig\n ? [\n {\n path: `${path.relative(\n libraryRoot,\n `${tree.root}/${PACKAGES_DIR}`,\n )}/${SHARED_INFRA_CONFIG_DIR}/tsconfig.json`,\n },\n ]\n : []),\n ]),\n }));\n\n await addGeneratorMetricsIfApplicable(tree, [INFRA_APP_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript'],\n });\n}\nexport default tsInfraGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readProjectConfiguration","updateJson","path","tsProjectGenerator","getTsLibDetails","mergeTsReferences","addTsDependencies","resolveContainers","declareDependencies","ownedElsewhere","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","esmVars","kebabCase","getNpmScopePrefix","addArtifactDependencyToTargets","addDependencyToTargetIfNotPresent","addGeneratorMetadata","getGeneratorInfo","projectExists","sortObjectKeys","getPackageManagerDisplayCommands","uvxCommand","SHARED_CONSTRUCTS_DEPENDENCIES","sharedConstructsGenerator","PACKAGES_DIR","SHARED_CONSTRUCTS_DIR","SHARED_INFRA_CONFIG_DIR","sharedInfraConfigGenerator","SHARED_INFRA_SCRIPTS_DEPENDENCIES","sharedInfraScriptsGenerator","DEPENDENCIES","ts","name","dev","root","INFRA_APP_GENERATOR_INFO","filename","tsInfraGenerator","tree","schema","lib","fullyQualifiedName","preferInstallDependencies","containers","cdkEnv","undefined","CDK_DOCKER","withCdkEnv","opts","existingEnv","env","iac","stageConfig","synthDirFromRoot","dir","synthDirFromProject","split","map","join","distDirFromProjectRoot","projectConfig","libraryRoot","npmScopePrefix","scopeAlias","namespace","sandboxStagePattern","delete","dirname","synthDir","pkgMgrCmd","exec","overwriteStrategy","Overwrite","config","projectType","targets","compile","outputs","synth","cache","executor","inputs","dependsOn","options","cwd","command","checkov","deploy","destroy","cdk","bootstrap","projectRoot","tsConfig","references","relative","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAEjBC,wBAAwB,EAExBC,UAAU,QACL,aAAa;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,sBAAsBC,eAAe,QAAQ,4BAA4B;AAChF,SAASC,iBAAiB,QAAQ,mCAAmC;AACrE,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,SAASC,iBAAiB,QAAQ,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ACc,GAAG,GAAG;YACnBT,UAAU;YACVG,SAASpC,WAAW;gBAClBqC,KAAK;gBACLC,SAAS;YACX;QACF;QACAZ,OAAOE,OAAO,CAACe,SAAS,GAAG;YACzBV,UAAU;YACVG,SAASpC,WAAW;gBAClBqC,KAAK;gBACLC,SAAS;YACX;QACF;QACAZ,OAAOE,OAAO,GAAGxD,eAAesD,OAAOE,OAAO;QAC9C,OAAOF;IACT;IAGFrE,kBAAkBkC,MAAMR,cAAc;QAAE6D,aAAa9B;IAAY;IAEjE9D,WAAWuC,MAAM,GAAGuB,YAAY,kBAAkB,CAAC,EAAE,CAAC+B,WAAc,CAAA;YAClE,GAAGA,QAAQ;YACXC,YAAY1F,kBAAkByF,SAASC,UAAU,EAAE;gBACjD;oBACE7F,MAAM,GAAGA,KAAK8F,QAAQ,CACpBjC,aACA,GAAGvB,KAAKJ,IAAI,CAAC,CAAC,EAAEV,cAAc,EAC9B,CAAC,EAAEC,sBAAsB,kBAAkB,CAAC;gBAChD;mBACI2B,cACA;oBACE;wBACEpD,MAAM,GAAGA,KAAK8F,QAAQ,CACpBjC,aACA,GAAGvB,KAAKJ,IAAI,CAAC,CAAC,EAAEV,cAAc,EAC9B,CAAC,EAAEE,wBAAwB,cAAc,CAAC;oBAC9C;iBACD,GACD,EAAE;aACP;QACH,CAAA;IAEA,MAAMhB,gCAAgC4B,MAAM;QAACH;KAAyB;IAEtE,MAAM3B,qBAAqB8B;IAC3B,OAAO,IACL7B,oBAAoB6B,MAAMC,OAAOG,yBAAyB,EAAE;YAC1DqD,WAAW;gBAAC;aAAa;QAC3B;AACJ;AACA,eAAe1D,iBAAiB"}
|
package/src/init/generator.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare const DEPENDENCIES: import("../utils/declared-dependencies.js").D
|
|
|
17
17
|
readonly name: "typescript";
|
|
18
18
|
}, {
|
|
19
19
|
readonly name: "@biomejs/biome";
|
|
20
|
-
}], readonly import("../utils/declared-dependencies.js").DeclaredPyDependency<"a2a-sdk" | "ag-ui-langgraph" | "ag-ui-protocol" | "ag-ui-strands" | "aiosqlite" | "aws-lambda-powertools" | "aws-lambda-powertools[tracer]" | "aws-lambda-powertools[parser]" | "aws-opentelemetry-distro" | "bedrock-agentcore" | "boto3" | "checkov" | "fastapi" | "fastapi[standard]" | "httpx" | "langchain" | "langchain-aws" | "langchain-mcp-adapters" | "langgraph" | "langgraph-checkpoint-aws" | "langgraph-checkpoint-sqlite" | "mcp" | "pip-check-updates" | "pip-licenses" | "
|
|
20
|
+
}], readonly import("../utils/declared-dependencies.js").DeclaredPyDependency<"ruff" | "a2a-sdk" | "ag-ui-langgraph" | "ag-ui-protocol" | "ag-ui-strands" | "aiosqlite" | "aws-lambda-powertools" | "aws-lambda-powertools[tracer]" | "aws-lambda-powertools[parser]" | "aws-opentelemetry-distro" | "bedrock-agentcore" | "boto3" | "checkov" | "fastapi" | "fastapi[standard]" | "httpx" | "langchain" | "langchain-aws" | "langchain-mcp-adapters" | "langgraph" | "langgraph-checkpoint-aws" | "langgraph-checkpoint-sqlite" | "mcp" | "pip-check-updates" | "pip-licenses" | "strands-agents" | "strands-agents[a2a]" | "strands-agents-tools" | "ty" | "pynamodb" | "uvicorn" | "sqlmodel" | "alembic" | "aiomysql" | "asyncpg" | "greenlet", Record<string, never>>[]>;
|
|
21
21
|
export declare const INIT_GENERATOR_INFO: NxGeneratorInfo;
|
|
22
22
|
/**
|
|
23
23
|
* Configure an existing Nx workspace to use the @aws/nx-plugin.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { type Tree } from '@nx/devkit';
|
|
6
|
+
/**
|
|
7
|
+
* `@aws-sdk/client-s3` is an optional peer of `@strands-agents/sdk` that the
|
|
8
|
+
* shared agent-connection project never imports, so it went undeclared. pnpm
|
|
9
|
+
* then auto-installs its own copy there while a project that does declare it
|
|
10
|
+
* gets the catalog's, and those two resolutions give `@strands-agents/sdk` two
|
|
11
|
+
* peer-suffixed instances of the same version.
|
|
12
|
+
*
|
|
13
|
+
* Anything importing both projects then sees two nominal identities of every SDK
|
|
14
|
+
* type — `Agent`, `McpClient`, `Plugin` — and fails to compile with "Types have
|
|
15
|
+
* separate declarations of a private property". Declaring it keeps the version
|
|
16
|
+
* on the catalog, collapsing both to one instance.
|
|
17
|
+
*/
|
|
18
|
+
export default function migration(tree: Tree): Promise<void>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/ import { joinPathFragments } from "@nx/devkit";
|
|
5
|
+
import { AGENT_CONNECTION_PROJECT_DIR } from "../../../utils/agent-connection/agent-connection.js";
|
|
6
|
+
import { addDependenciesToPackageJson } from "../../../utils/dependencies.js";
|
|
7
|
+
import { formatFilesInSubtree } from "../../../utils/format.js";
|
|
8
|
+
import { TS_VERSIONS } from "../../../utils/versions.js";
|
|
9
|
+
const CLIENT_S3 = '@aws-sdk/client-s3';
|
|
10
|
+
const STRANDS_SDK = '@strands-agents/sdk';
|
|
11
|
+
/**
|
|
12
|
+
* `@aws-sdk/client-s3` is an optional peer of `@strands-agents/sdk` that the
|
|
13
|
+
* shared agent-connection project never imports, so it went undeclared. pnpm
|
|
14
|
+
* then auto-installs its own copy there while a project that does declare it
|
|
15
|
+
* gets the catalog's, and those two resolutions give `@strands-agents/sdk` two
|
|
16
|
+
* peer-suffixed instances of the same version.
|
|
17
|
+
*
|
|
18
|
+
* Anything importing both projects then sees two nominal identities of every SDK
|
|
19
|
+
* type — `Agent`, `McpClient`, `Plugin` — and fails to compile with "Types have
|
|
20
|
+
* separate declarations of a private property". Declaring it keeps the version
|
|
21
|
+
* on the catalog, collapsing both to one instance.
|
|
22
|
+
*/ export default async function migration(tree) {
|
|
23
|
+
const packageJsonPath = joinPathFragments(AGENT_CONNECTION_PROJECT_DIR, 'package.json');
|
|
24
|
+
if (!tree.exists(packageJsonPath)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
// Only where a strands client is actually present — that is what pulls the peer.
|
|
28
|
+
const packageJson = JSON.parse(tree.read(packageJsonPath, 'utf-8') ?? '{}');
|
|
29
|
+
if (!packageJson.dependencies?.[STRANDS_SDK]) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
addDependenciesToPackageJson(tree, {
|
|
33
|
+
[CLIENT_S3]: TS_VERSIONS[CLIENT_S3]
|
|
34
|
+
}, {}, packageJsonPath);
|
|
35
|
+
await formatFilesInSubtree(tree);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/latest/agent-connection-pin-strands-peers/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { joinPathFragments, type Tree } from '@nx/devkit';\nimport { AGENT_CONNECTION_PROJECT_DIR } from '../../../utils/agent-connection/agent-connection.js';\nimport { addDependenciesToPackageJson } from '../../../utils/dependencies.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\nimport { TS_VERSIONS } from '../../../utils/versions.js';\n\nconst CLIENT_S3 = '@aws-sdk/client-s3';\nconst STRANDS_SDK = '@strands-agents/sdk';\n\n/**\n * `@aws-sdk/client-s3` is an optional peer of `@strands-agents/sdk` that the\n * shared agent-connection project never imports, so it went undeclared. pnpm\n * then auto-installs its own copy there while a project that does declare it\n * gets the catalog's, and those two resolutions give `@strands-agents/sdk` two\n * peer-suffixed instances of the same version.\n *\n * Anything importing both projects then sees two nominal identities of every SDK\n * type — `Agent`, `McpClient`, `Plugin` — and fails to compile with \"Types have\n * separate declarations of a private property\". Declaring it keeps the version\n * on the catalog, collapsing both to one instance.\n */\nexport default async function migration(tree: Tree): Promise<void> {\n const packageJsonPath = joinPathFragments(\n AGENT_CONNECTION_PROJECT_DIR,\n 'package.json',\n );\n if (!tree.exists(packageJsonPath)) {\n return;\n }\n\n // Only where a strands client is actually present — that is what pulls the peer.\n const packageJson = JSON.parse(tree.read(packageJsonPath, 'utf-8') ?? '{}');\n if (!packageJson.dependencies?.[STRANDS_SDK]) {\n return;\n }\n\n addDependenciesToPackageJson(\n tree,\n { [CLIENT_S3]: TS_VERSIONS[CLIENT_S3] },\n {},\n packageJsonPath,\n );\n\n await formatFilesInSubtree(tree);\n}\n"],"names":["joinPathFragments","AGENT_CONNECTION_PROJECT_DIR","addDependenciesToPackageJson","formatFilesInSubtree","TS_VERSIONS","CLIENT_S3","STRANDS_SDK","migration","tree","packageJsonPath","exists","packageJson","JSON","parse","read","dependencies"],"mappings":"AAAA;;;CAGC,GACD,SAASA,iBAAiB,QAAmB,aAAa;AAC1D,SAASC,4BAA4B,QAAQ,sDAAsD;AACnG,SAASC,4BAA4B,QAAQ,iCAAiC;AAC9E,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,WAAW,QAAQ,6BAA6B;AAEzD,MAAMC,YAAY;AAClB,MAAMC,cAAc;AAEpB;;;;;;;;;;;CAWC,GACD,eAAe,eAAeC,UAAUC,IAAU;IAChD,MAAMC,kBAAkBT,kBACtBC,8BACA;IAEF,IAAI,CAACO,KAAKE,MAAM,CAACD,kBAAkB;QACjC;IACF;IAEA,iFAAiF;IACjF,MAAME,cAAcC,KAAKC,KAAK,CAACL,KAAKM,IAAI,CAACL,iBAAiB,YAAY;IACtE,IAAI,CAACE,YAAYI,YAAY,EAAE,CAACT,YAAY,EAAE;QAC5C;IACF;IAEAJ,6BACEM,MACA;QAAE,CAACH,UAAU,EAAED,WAAW,CAACC,UAAU;IAAC,GACtC,CAAC,GACDI;IAGF,MAAMN,qBAAqBK;AAC7B"}
|
|
@@ -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,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/ import { getProjects, joinPathFragments, updateProjectConfiguration } from "@nx/devkit";
|
|
5
|
+
import { ADOT_VENDOR_TARGET_NAME, adotVendorDir } from "../../../utils/agent-core-packaging.js";
|
|
6
|
+
import { formatFilesInSubtree } from "../../../utils/format.js";
|
|
7
|
+
/**
|
|
8
|
+
* A TypeScript AgentCore code package installed the AWS Distro for OpenTelemetry
|
|
9
|
+
* into the package directory as its last packaging step. That target's `inputs`
|
|
10
|
+
* are the project's source, so editing an agent re-ran the install — several
|
|
11
|
+
* seconds of npm work whose result depends only on the pinned ADOT version.
|
|
12
|
+
*
|
|
13
|
+
* The install moves to its own target Nx caches independently. It declares no
|
|
14
|
+
* `inputs`, since the version it pins is part of the command and Nx hashes a
|
|
15
|
+
* target's configuration, so a version bump still invalidates it while a source
|
|
16
|
+
* edit no longer does. Packaging copies the vendored tree instead.
|
|
17
|
+
*
|
|
18
|
+
* The vendor directory is a sibling of the package directory, not a path inside
|
|
19
|
+
* it: Nx replaces a cached target's whole declared output directory on restore,
|
|
20
|
+
* so nesting one target's output inside another's makes each wipe the other's
|
|
21
|
+
* work on a cache hit.
|
|
22
|
+
*
|
|
23
|
+
* A packaging target that no longer matches the shape the generator vended has
|
|
24
|
+
* been reworked by the user, so it is left untouched and reported.
|
|
25
|
+
*
|
|
26
|
+
* The filesystem commands are spelled with `shx`: the migration that replaced the
|
|
27
|
+
* single purpose CLIs was committed first, and `latest` migrations run in the
|
|
28
|
+
* order their folders were committed, so it has already run by the time this one
|
|
29
|
+
* does.
|
|
30
|
+
*/ /** The ADOT install as the packaging target ran it, capturing its `--prefix`. */ const ADOT_INSTALL = /^npm install --prefix (\S+) .*@aws\/aws-distro-opentelemetry-node-autoinstrumentation@(\S+)\s*$/;
|
|
31
|
+
const divergedStep = (projectName, targetName)=>`${projectName}:${targetName}: installs the OpenTelemetry distro but no longer matches the shape the generator produced - left untouched. To stop the install re-running whenever the project's source changes, move it to its own target with no \`inputs\` and an \`outputs\` directory outside this target's, and copy that directory in here instead.`;
|
|
32
|
+
/** Commands a target runs, as plain strings. */ const commandsOf = (target)=>{
|
|
33
|
+
const { commands } = target.options ?? {};
|
|
34
|
+
return Array.isArray(commands) ? commands.filter((c)=>typeof c === 'string') : [];
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Copy the vendored `node_modules` into the package. `-R` and the trailing `/.`
|
|
38
|
+
* merge the directory's contents rather than nesting it inside the destination.
|
|
39
|
+
*/ const copyCommand = (vendorDir, packageDir)=>`shx cp -R ${joinPathFragments(vendorDir, 'node_modules')}/. ${joinPathFragments(packageDir, 'node_modules')}`;
|
|
40
|
+
export default async function migration(tree) {
|
|
41
|
+
const nextSteps = [];
|
|
42
|
+
for (const [projectName, project] of getProjects(tree)){
|
|
43
|
+
let changed = false;
|
|
44
|
+
const vendorDir = adotVendorDir(project.root);
|
|
45
|
+
for (const [targetName, target] of Object.entries(project.targets ?? {})){
|
|
46
|
+
if (targetName === ADOT_VENDOR_TARGET_NAME) continue;
|
|
47
|
+
const commands = commandsOf(target);
|
|
48
|
+
const installIndex = commands.findIndex((c)=>ADOT_INSTALL.test(c));
|
|
49
|
+
if (installIndex < 0) continue;
|
|
50
|
+
const install = commands[installIndex];
|
|
51
|
+
const [, prefix] = ADOT_INSTALL.exec(install);
|
|
52
|
+
// The install targets the directory this target packages into, and it
|
|
53
|
+
// copies the bundle in with shx. Anything else has been reworked.
|
|
54
|
+
const packageDir = prefix;
|
|
55
|
+
const copiesBundle = commands.some((c)=>c !== install && c.startsWith('shx cp '));
|
|
56
|
+
const declaresPackageOutput = (target.outputs ?? []).some((o)=>o.endsWith(packageDir));
|
|
57
|
+
if (!copiesBundle || !declaresPackageOutput) {
|
|
58
|
+
nextSteps.push(divergedStep(projectName, targetName));
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
project.targets[ADOT_VENDOR_TARGET_NAME] ??= {
|
|
62
|
+
cache: true,
|
|
63
|
+
inputs: [],
|
|
64
|
+
outputs: [
|
|
65
|
+
`{workspaceRoot}/${vendorDir}`
|
|
66
|
+
],
|
|
67
|
+
executor: 'nx:run-commands',
|
|
68
|
+
options: {
|
|
69
|
+
commands: [
|
|
70
|
+
`shx rm -rf ${vendorDir}`,
|
|
71
|
+
`shx mkdir -p ${vendorDir}`,
|
|
72
|
+
install.replace(prefix, vendorDir)
|
|
73
|
+
],
|
|
74
|
+
parallel: false
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const updated = [
|
|
78
|
+
...commands
|
|
79
|
+
];
|
|
80
|
+
updated[installIndex] = copyCommand(vendorDir, packageDir);
|
|
81
|
+
target.options.commands = updated;
|
|
82
|
+
target.dependsOn = [
|
|
83
|
+
...target.dependsOn ?? [],
|
|
84
|
+
ADOT_VENDOR_TARGET_NAME
|
|
85
|
+
].filter((d, i, all)=>all.indexOf(d) === i);
|
|
86
|
+
changed = true;
|
|
87
|
+
}
|
|
88
|
+
if (changed) {
|
|
89
|
+
updateProjectConfiguration(tree, projectName, project);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
await formatFilesInSubtree(tree);
|
|
93
|
+
return {
|
|
94
|
+
nextSteps
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
//# sourceMappingURL=migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/latest/agent-core-vendor-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 TargetConfiguration,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport {\n ADOT_VENDOR_TARGET_NAME,\n adotVendorDir,\n} from '../../../utils/agent-core-packaging.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\n\n/**\n * A TypeScript AgentCore code package installed the AWS Distro for OpenTelemetry\n * into the package directory as its last packaging step. That target's `inputs`\n * are the project's source, so editing an agent re-ran the install — several\n * seconds of npm work whose result depends only on the pinned ADOT version.\n *\n * The install moves to its own target Nx caches independently. It declares no\n * `inputs`, since the version it pins is part of the command and Nx hashes a\n * target's configuration, so a version bump still invalidates it while a source\n * edit no longer does. Packaging copies the vendored tree instead.\n *\n * The vendor directory is a sibling of the package directory, not a path inside\n * it: Nx replaces a cached target's whole declared output directory on restore,\n * so nesting one target's output inside another's makes each wipe the other's\n * work on a cache hit.\n *\n * A packaging target that no longer matches the shape the generator vended has\n * been reworked by the user, so it is left untouched and reported.\n *\n * The filesystem commands are spelled with `shx`: the migration that replaced the\n * single purpose CLIs was committed first, and `latest` migrations run in the\n * order their folders were committed, so it has already run by the time this one\n * does.\n */\n\n/** The ADOT install as the packaging target ran it, capturing its `--prefix`. */\nconst ADOT_INSTALL =\n /^npm install --prefix (\\S+) .*@aws\\/aws-distro-opentelemetry-node-autoinstrumentation@(\\S+)\\s*$/;\n\nconst divergedStep = (projectName: string, targetName: string) =>\n `${projectName}:${targetName}: installs the OpenTelemetry distro but no longer matches the shape the generator produced - left untouched. To stop the install re-running whenever the project's source changes, move it to its own target with no \\`inputs\\` and an \\`outputs\\` directory outside this target's, and copy that directory in here instead.`;\n\n/** Commands a target runs, as plain strings. */\nconst commandsOf = (target: TargetConfiguration): string[] => {\n const { commands } = (target.options ?? {}) as { commands?: unknown };\n return Array.isArray(commands)\n ? commands.filter((c): c is string => typeof c === 'string')\n : [];\n};\n\n/**\n * Copy the vendored `node_modules` into the package. `-R` and the trailing `/.`\n * merge the directory's contents rather than nesting it inside the destination.\n */\nconst copyCommand = (vendorDir: string, packageDir: string): string =>\n `shx cp -R ${joinPathFragments(vendorDir, 'node_modules')}/. ${joinPathFragments(packageDir, 'node_modules')}`;\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 let changed = false;\n const vendorDir = adotVendorDir(project.root);\n\n for (const [targetName, target] of Object.entries(project.targets ?? {})) {\n if (targetName === ADOT_VENDOR_TARGET_NAME) continue;\n\n const commands = commandsOf(target);\n const installIndex = commands.findIndex((c) => ADOT_INSTALL.test(c));\n if (installIndex < 0) continue;\n\n const install = commands[installIndex];\n const [, prefix] = ADOT_INSTALL.exec(install)!;\n\n // The install targets the directory this target packages into, and it\n // copies the bundle in with shx. Anything else has been reworked.\n const packageDir = prefix;\n const copiesBundle = commands.some(\n (c) => c !== install && c.startsWith('shx cp '),\n );\n const declaresPackageOutput = (target.outputs ?? []).some((o) =>\n o.endsWith(packageDir),\n );\n if (!copiesBundle || !declaresPackageOutput) {\n nextSteps.push(divergedStep(projectName, targetName));\n continue;\n }\n\n project.targets![ADOT_VENDOR_TARGET_NAME] ??= {\n cache: true,\n inputs: [],\n outputs: [`{workspaceRoot}/${vendorDir}`],\n executor: 'nx:run-commands',\n options: {\n commands: [\n `shx rm -rf ${vendorDir}`,\n `shx mkdir -p ${vendorDir}`,\n install.replace(prefix, vendorDir),\n ],\n parallel: false,\n },\n };\n\n const updated = [...commands];\n updated[installIndex] = copyCommand(vendorDir, packageDir);\n target.options!.commands = updated;\n target.dependsOn = [\n ...(target.dependsOn ?? []),\n ADOT_VENDOR_TARGET_NAME,\n ].filter((d, i, all) => all.indexOf(d) === i);\n\n changed = true;\n }\n\n if (changed) {\n updateProjectConfiguration(\n tree,\n projectName,\n project as ProjectConfiguration,\n );\n }\n }\n\n await formatFilesInSubtree(tree);\n\n return { nextSteps };\n}\n"],"names":["getProjects","joinPathFragments","updateProjectConfiguration","ADOT_VENDOR_TARGET_NAME","adotVendorDir","formatFilesInSubtree","ADOT_INSTALL","divergedStep","projectName","targetName","commandsOf","target","commands","options","Array","isArray","filter","c","copyCommand","vendorDir","packageDir","migration","tree","nextSteps","project","changed","root","Object","entries","targets","installIndex","findIndex","test","install","prefix","exec","copiesBundle","some","startsWith","declaresPackageOutput","outputs","o","endsWith","push","cache","inputs","executor","replace","parallel","updated","dependsOn","d","i","all","indexOf"],"mappings":"AAAA;;;CAGC,GACD,SACEA,WAAW,EACXC,iBAAiB,EAKjBC,0BAA0B,QACrB,aAAa;AACpB,SACEC,uBAAuB,EACvBC,aAAa,QACR,yCAAyC;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GAED,+EAA+E,GAC/E,MAAMC,eACJ;AAEF,MAAMC,eAAe,CAACC,aAAqBC,aACzC,GAAGD,YAAY,CAAC,EAAEC,WAAW,4TAA4T,CAAC;AAE5V,8CAA8C,GAC9C,MAAMC,aAAa,CAACC;IAClB,MAAM,EAAEC,QAAQ,EAAE,GAAID,OAAOE,OAAO,IAAI,CAAC;IACzC,OAAOC,MAAMC,OAAO,CAACH,YACjBA,SAASI,MAAM,CAAC,CAACC,IAAmB,OAAOA,MAAM,YACjD,EAAE;AACR;AAEA;;;CAGC,GACD,MAAMC,cAAc,CAACC,WAAmBC,aACtC,CAAC,UAAU,EAAEnB,kBAAkBkB,WAAW,gBAAgB,GAAG,EAAElB,kBAAkBmB,YAAY,iBAAiB;AAEhH,eAAe,eAAeC,UAC5BC,IAAU;IAEV,MAAMC,YAAsB,EAAE;IAE9B,KAAK,MAAM,CAACf,aAAagB,QAAQ,IAAIxB,YAAYsB,MAAO;QAC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C3BtC,OAAOuC,SAAS,GAAG;mBACbvC,OAAOuC,SAAS,IAAI,EAAE;gBAC1B/C;aACD,CAACa,MAAM,CAAC,CAACmC,GAAGC,GAAGC,MAAQA,IAAIC,OAAO,CAACH,OAAOC;YAE3C3B,UAAU;QACZ;QAEA,IAAIA,SAAS;YACXvB,2BACEoB,MACAd,aACAgB;QAEJ;IACF;IAEA,MAAMnB,qBAAqBiB;IAE3B,OAAO;QAAEC;IAAU;AACrB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import type { Tree } from '@nx/devkit';
|
|
6
|
+
/**
|
|
7
|
+
* pnpm creates `_tmp_<pid>_<hash>` files at the workspace root while it
|
|
8
|
+
* materialises packages. Left unignored, Nx's watcher invalidates the project
|
|
9
|
+
* graph on every install, so a watch-mode `dev` target running at the time
|
|
10
|
+
* rebuilds the graph continuously and never starts the command it wraps.
|
|
11
|
+
*/
|
|
12
|
+
export default function migration(tree: Tree): Promise<void>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/ import { formatFilesInSubtree } from "../../../utils/format.js";
|
|
5
|
+
import { updateGitIgnore } from "../../../utils/git.js";
|
|
6
|
+
/** The temporary files pnpm writes while materialising packages. */ const TEMP_FILE_PATTERN = '_tmp_*';
|
|
7
|
+
/**
|
|
8
|
+
* pnpm creates `_tmp_<pid>_<hash>` files at the workspace root while it
|
|
9
|
+
* materialises packages. Left unignored, Nx's watcher invalidates the project
|
|
10
|
+
* graph on every install, so a watch-mode `dev` target running at the time
|
|
11
|
+
* rebuilds the graph continuously and never starts the command it wraps.
|
|
12
|
+
*/ export default async function migration(tree) {
|
|
13
|
+
// Only pnpm writes these, so key off its lockfile rather than the workspace
|
|
14
|
+
// file — a workspace on another package manager may still carry one.
|
|
15
|
+
if (!tree.exists('pnpm-lock.yaml')) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
updateGitIgnore(tree, '.', (patterns)=>patterns.includes(TEMP_FILE_PATTERN) ? patterns : [
|
|
19
|
+
...patterns,
|
|
20
|
+
TEMP_FILE_PATTERN
|
|
21
|
+
]);
|
|
22
|
+
await formatFilesInSubtree(tree);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/latest/ignore-package-manager-temp-files/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { Tree } from '@nx/devkit';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\nimport { updateGitIgnore } from '../../../utils/git.js';\n\n/** The temporary files pnpm writes while materialising packages. */\nconst TEMP_FILE_PATTERN = '_tmp_*';\n\n/**\n * pnpm creates `_tmp_<pid>_<hash>` files at the workspace root while it\n * materialises packages. Left unignored, Nx's watcher invalidates the project\n * graph on every install, so a watch-mode `dev` target running at the time\n * rebuilds the graph continuously and never starts the command it wraps.\n */\nexport default async function migration(tree: Tree): Promise<void> {\n // Only pnpm writes these, so key off its lockfile rather than the workspace\n // file — a workspace on another package manager may still carry one.\n if (!tree.exists('pnpm-lock.yaml')) {\n return;\n }\n\n updateGitIgnore(tree, '.', (patterns) =>\n patterns.includes(TEMP_FILE_PATTERN)\n ? patterns\n : [...patterns, TEMP_FILE_PATTERN],\n );\n\n await formatFilesInSubtree(tree);\n}\n"],"names":["formatFilesInSubtree","updateGitIgnore","TEMP_FILE_PATTERN","migration","tree","exists","patterns","includes"],"mappings":"AAAA;;;CAGC,GAED,SAASA,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,eAAe,QAAQ,wBAAwB;AAExD,kEAAkE,GAClE,MAAMC,oBAAoB;AAE1B;;;;;CAKC,GACD,eAAe,eAAeC,UAAUC,IAAU;IAChD,4EAA4E;IAC5E,qEAAqE;IACrE,IAAI,CAACA,KAAKC,MAAM,CAAC,mBAAmB;QAClC;IACF;IAEAJ,gBAAgBG,MAAM,KAAK,CAACE,WAC1BA,SAASC,QAAQ,CAACL,qBACdI,WACA;eAAIA;YAAUJ;SAAkB;IAGtC,MAAMF,qBAAqBI;AAC7B"}
|
|
@@ -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>;
|