@aws/nx-plugin 1.0.0-rc.96 → 1.0.0-rc.98
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 +9 -9
- package/migrations.json +124 -84
- package/package.json +3 -3
- package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/agentcore-gateway/generator.js +6 -0
- package/src/agentcore-gateway/generator.js.map +1 -1
- package/src/agentcore-gateway/react-connection/__snapshots__/generator.spec.ts.snap +4 -1
- package/src/agentcore-harness/__snapshots__/generator.spec.ts.snap +68 -4
- package/src/agentcore-harness/generator.js +6 -0
- package/src/agentcore-harness/generator.js.map +1 -1
- package/src/connection/gateway-runtime-config.js +1 -1
- package/src/connection/gateway-runtime-config.js.map +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +10 -10
- package/src/infra/app/generator.js +39 -9
- package/src/infra/app/generator.js.map +1 -1
- package/src/init/generator.d.ts +1 -1
- package/src/init/generator.js +8 -6
- package/src/init/generator.js.map +1 -1
- package/src/init/schema.d.js.map +1 -1
- package/src/init/schema.d.ts +1 -0
- package/src/init/schema.json +5 -0
- package/src/internal/test-matrix/generator.js +2 -2
- package/src/internal/test-matrix/generator.js.map +1 -1
- package/src/license/sync/generator.d.ts +10 -0
- package/src/license/sync/generator.js +1 -1
- package/src/license/sync/generator.js.map +1 -1
- package/src/mcp-server/server.js +2 -0
- package/src/mcp-server/server.js.map +1 -1
- package/src/mcp-server/tools/best-practices.d.ts +28 -0
- package/src/mcp-server/tools/best-practices.js +43 -0
- package/src/mcp-server/tools/best-practices.js.map +1 -0
- package/src/mcp-server/tools/general-guidance.d.ts +1 -1
- package/src/mcp-server/tools/general-guidance.js +13 -4
- package/src/mcp-server/tools/general-guidance.js.map +1 -1
- package/src/migrations/latest/sandbox-pattern-nested-stacks/metadata.json +3 -0
- package/src/migrations/latest/sandbox-pattern-nested-stacks/migration.js +68 -0
- package/src/migrations/latest/sandbox-pattern-nested-stacks/migration.js.map +1 -0
- package/src/migrations/latest/shadcn-cn-package/metadata.json +3 -0
- package/src/migrations/latest/shadcn-cn-package/migration.js +114 -0
- package/src/migrations/latest/shadcn-cn-package/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.90/0001-dev-target-depends-on-pull-image/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.90/0002-open-api-codegen-executor/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.90/0003-terraform-provider-plugin-cache/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.90/0004-python-test-input-scoping/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.90/0005-vitest-coverage-output-dir/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.90/0006-add-assemble-target/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.90/0007-docker-target-cache-soundness/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.90/0008-declare-cacheable-target-inputs/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.90/0009-terraform-fmt-check/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.92/0001-react-website-unique-dev-ports/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.94/0001-infra-deploy-express-mode/metadata.json +3 -0
- package/src/migrations/{latest/infra-deploy-express-mode → v1.0.0-rc.94/0001-infra-deploy-express-mode}/migration.js +26 -28
- package/src/migrations/v1.0.0-rc.94/0001-infra-deploy-express-mode/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.94/0002-shx-fs-commands/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.94/0003-agent-core-vendor-target/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.95/0001-rolldown-config-bundle-transient/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.95/0001-rolldown-config-bundle-transient/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.95/0002-agent-connection-pin-strands-peers/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.95/0003-ignore-package-manager-temp-files/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.95/0004-shadcn-package-imports-exports/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.95/0004-shadcn-package-imports-exports/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/__snapshots__/migration.spec.ts.snap +84 -0
- package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/migration.js +94 -0
- package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.97/0002-checkov-scan-cache-inputs/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.97/0002-checkov-scan-cache-inputs/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.97/0002-checkov-scan-cache-inputs/migration.js +58 -0
- package/src/migrations/v1.0.0-rc.97/0002-checkov-scan-cache-inputs/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.97/0003-terraform-validate-without-backend/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.97/0003-terraform-validate-without-backend/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.97/0003-terraform-validate-without-backend/migration.js +84 -0
- package/src/migrations/v1.0.0-rc.97/0003-terraform-validate-without-backend/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/migration.js +58 -0
- package/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/__snapshots__/migration.spec.ts.snap +25 -0
- package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/migration.d.ts +28 -0
- package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/migration.js +75 -0
- package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/migration.js +53 -0
- package/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/migration.js.map +1 -0
- package/src/preset/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/preset/generator.js +4 -25
- package/src/preset/generator.js.map +1 -1
- package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +2 -2
- package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +4 -4
- package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +4 -4
- 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/mcp-connection/generator.d.ts +1 -1
- package/src/py/agent/react-connection/__snapshots__/generator.spec.ts.snap +4 -1
- package/src/py/agent/react-connection/generator.d.ts +1 -7
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +10 -12
- package/src/py/dynamodb/generator.js +34 -7
- package/src/py/dynamodb/generator.js.map +1 -1
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +4 -3
- package/src/py/lambda-function/files/handler/__lambdaFunctionSnakeCase__.py.template +2 -1
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/py/project/schema.json +3 -1
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +31 -15
- package/src/py/rdb/files/Dockerfile.create-db-user.template +7 -3
- package/src/py/rdb/files/Dockerfile.migration.template +7 -3
- package/src/py/rdb/generator.js +29 -28
- package/src/py/rdb/generator.js.map +1 -1
- package/src/smithy/project/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/smithy/react-connection/files/model/extensions.smithy.template +3 -3
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +8 -8
- package/src/smithy/ts/api/generator.js +7 -2
- package/src/smithy/ts/api/generator.js.map +1 -1
- package/src/terraform/project/generator.js +34 -10
- package/src/terraform/project/generator.js.map +1 -1
- package/src/terraform/project/schema.d.js +0 -3
- package/src/terraform/project/schema.d.js.map +1 -1
- package/src/terraform/project/schema.d.ts +0 -4
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
- package/src/trpc/backend/generator.js +7 -1
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/trpc/react/generator.js +6 -0
- package/src/trpc/react/generator.js.map +1 -1
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/ts/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/agent/generator.js +3 -3
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/agent/react-connection/generator.d.ts +1 -9
- package/src/ts/astro-docs/files/translation/scripts/translate.ts.template +47 -2
- package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +6 -4
- package/src/ts/dynamodb/generator.js +30 -6
- package/src/ts/dynamodb/generator.js.map +1 -1
- package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/lib/biome.d.ts +15 -1
- package/src/ts/lib/biome.js +79 -63
- package/src/ts/lib/biome.js.map +1 -1
- package/src/ts/lib/generator.js +11 -7
- package/src/ts/lib/generator.js.map +1 -1
- package/src/ts/lib/ts-project-utils.d.ts +14 -0
- package/src/ts/lib/ts-project-utils.js +24 -0
- package/src/ts/lib/ts-project-utils.js.map +1 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/ts/mcp-server/files/app/http.ts.template +1 -1
- package/src/ts/mcp-server/generator.js +3 -3
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/nx-generator/files/local/generator.spec.ts.template +2 -2
- package/src/ts/nx-migration/generator.js +3 -1
- package/src/ts/nx-migration/generator.js.map +1 -1
- package/src/ts/nx-plugin/__snapshots__/generator.spec.ts.snap +1 -25
- package/src/ts/nx-plugin/generator.js +19 -17
- package/src/ts/nx-plugin/generator.js.map +1 -1
- package/src/ts/nx-plugin/utils.d.ts +21 -0
- package/src/ts/nx-plugin/utils.js +41 -1
- package/src/ts/nx-plugin/utils.js.map +1 -1
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +13 -8
- package/src/ts/rdb/files/Dockerfile.template +5 -0
- package/src/ts/rdb/generator.d.ts +8 -0
- package/src/ts/rdb/generator.js +28 -24
- package/src/ts/rdb/generator.js.map +1 -1
- package/src/ts/rdb/trpc-connection/__snapshots__/generator.spec.ts.snap +39 -0
- package/src/ts/rdb/trpc-connection/generator.js +13 -0
- package/src/ts/rdb/trpc-connection/generator.js.map +1 -1
- package/src/ts/react-website/agui/files/common/src/components/__agentNameKebabCase__-chat.tsx.template +9 -0
- package/src/ts/react-website/agui/files/common/src/hooks/useAgui__agentNameClassName__.tsx.template +4 -1
- package/src/ts/react-website/agui/generator.d.ts +1 -5
- package/src/ts/react-website/agui/generator.js +6 -2
- package/src/ts/react-website/agui/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +26 -26
- package/src/ts/react-website/app/generator.d.ts +1 -5
- package/src/ts/react-website/app/generator.js +3 -8
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
- package/src/utils/agent-connection/agent-connection.d.ts +2 -1
- package/src/utils/agent-connection/agent-connection.js +6 -1
- package/src/utils/agent-connection/agent-connection.js.map +1 -1
- package/src/utils/agent-core-constructs/files/cdk/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.ts.template +11 -7
- package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/agentcore-gateway.ts.template +14 -6
- package/src/utils/agent-core-packaging.js +5 -5
- package/src/utils/agent-core-packaging.js.map +1 -1
- package/src/utils/api-constructs/api-constructs.d.ts +5 -0
- package/src/utils/api-constructs/api-constructs.js +8 -0
- package/src/utils/api-constructs/api-constructs.js.map +1 -1
- package/src/utils/api-constructs/files/cdk/app/apis/http/__apiNameKebabCase__.ts.template +4 -2
- package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +4 -2
- package/src/utils/ast.d.ts +10 -0
- package/src/utils/ast.js +87 -15
- package/src/utils/ast.js.map +1 -1
- package/src/utils/dependencies.d.ts +10 -0
- package/src/utils/dependencies.js +93 -1
- package/src/utils/dependencies.js.map +1 -1
- package/src/utils/docker.d.ts +11 -0
- package/src/utils/docker.js +16 -3
- package/src/utils/docker.js.map +1 -1
- package/src/utils/dynamodb-config.d.ts +48 -0
- package/src/utils/dynamodb-config.js +44 -0
- package/src/utils/dynamodb-config.js.map +1 -0
- package/src/utils/dynamodb-constructs/files/cdk/app/dynamodb/__nameKebabCase__.ts.template +8 -4
- package/src/utils/files/common/shadcn/src/components/ui/alert.tsx.template +1 -2
- package/src/utils/files/common/shadcn/src/components/ui/avatar.tsx.template +1 -2
- package/src/utils/files/common/shadcn/src/components/ui/breadcrumb.tsx.template +1 -2
- package/src/utils/files/common/shadcn/src/components/ui/button.tsx.template +1 -2
- package/src/utils/files/common/shadcn/src/components/ui/card.tsx.template +1 -2
- package/src/utils/files/common/shadcn/src/components/ui/input.tsx.template +1 -2
- package/src/utils/files/common/shadcn/src/components/ui/separator.tsx.template +1 -2
- package/src/utils/files/common/shadcn/src/components/ui/sheet.tsx.template +1 -2
- package/src/utils/files/common/shadcn/src/components/ui/sidebar.tsx.template +1 -1
- 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 -2
- package/src/utils/files/common/shadcn/src/components/ui/textarea.tsx.template +1 -2
- package/src/utils/files/common/shadcn/src/components/ui/tooltip.tsx.template +1 -2
- package/src/utils/files/common/shadcn/src/lib/utils.ts.template +1 -6
- package/src/utils/git-secrets.d.ts +28 -0
- package/src/utils/git-secrets.js +66 -0
- package/src/utils/git-secrets.js.map +1 -0
- package/src/utils/init.js +7 -6
- package/src/utils/init.js.map +1 -1
- package/src/utils/local-project-dependency.d.ts +28 -0
- package/src/utils/local-project-dependency.js +40 -0
- package/src/utils/local-project-dependency.js.map +1 -0
- package/src/utils/nx.d.ts +14 -0
- package/src/utils/nx.js +30 -0
- package/src/utils/nx.js.map +1 -1
- package/src/utils/rdb-constructs/files/cdk/app/dbs/__nameKebabCase__.ts.template +11 -6
- package/src/utils/script-project-targets.d.ts +26 -0
- package/src/utils/script-project-targets.js +75 -0
- package/src/utils/script-project-targets.js.map +1 -0
- package/src/utils/shared-shadcn.d.ts +1 -3
- package/src/utils/shared-shadcn.js +1 -4
- package/src/utils/shared-shadcn.js.map +1 -1
- package/src/utils/versions.d.ts +52 -50
- package/src/utils/versions.js +55 -49
- package/src/utils/versions.js.map +1 -1
- package/src/utils/website-constructs/files/cdk/app/static-websites/__websiteNameKebabCase__.ts.template +8 -4
- package/src/migrations/latest/add-assemble-target/migration.js.map +0 -1
- package/src/migrations/latest/agent-connection-pin-strands-peers/migration.js.map +0 -1
- package/src/migrations/latest/agent-core-vendor-target/migration.js.map +0 -1
- package/src/migrations/latest/declare-cacheable-target-inputs/migration.js.map +0 -1
- package/src/migrations/latest/dev-target-depends-on-pull-image/migration.js.map +0 -1
- package/src/migrations/latest/docker-target-cache-soundness/migration.js.map +0 -1
- package/src/migrations/latest/ignore-package-manager-temp-files/migration.js.map +0 -1
- package/src/migrations/latest/infra-deploy-express-mode/metadata.json +0 -3
- package/src/migrations/latest/infra-deploy-express-mode/migration.js.map +0 -1
- package/src/migrations/latest/open-api-codegen-executor/migration.js.map +0 -1
- package/src/migrations/latest/python-test-input-scoping/migration.js.map +0 -1
- package/src/migrations/latest/react-website-unique-dev-ports/migration.js.map +0 -1
- package/src/migrations/latest/rolldown-config-bundle-transient/migration.js.map +0 -1
- package/src/migrations/latest/shadcn-package-imports-exports/migration.js.map +0 -1
- package/src/migrations/latest/shx-fs-commands/migration.js.map +0 -1
- package/src/migrations/latest/terraform-fmt-check/migration.js.map +0 -1
- package/src/migrations/latest/terraform-provider-plugin-cache/migration.js.map +0 -1
- package/src/migrations/latest/vitest-coverage-output-dir/migration.js.map +0 -1
- package/src/py/dynamodb/files/__name__/__init__.py.template +0 -6
- package/src/py/dynamodb/files/__name__/entities/__init__.py.template +0 -4
- package/src/py/dynamodb/files/config.json.template +0 -24
- package/src/ts/dynamodb/files/config.json.template +0 -24
- package/src/ts/dynamodb/files/src/entities/index.ts.template +0 -1
- package/src/ts/dynamodb/files/src/index.ts.template +0 -2
- /package/src/migrations/latest/{add-assemble-target → sandbox-pattern-nested-stacks}/migration.d.ts +0 -0
- /package/src/migrations/latest/{agent-core-vendor-target → shadcn-cn-package}/migration.d.ts +0 -0
- /package/src/migrations/{latest/dev-target-depends-on-pull-image → v1.0.0-rc.90/0001-dev-target-depends-on-pull-image}/metadata.json +0 -0
- /package/src/migrations/{latest/declare-cacheable-target-inputs → v1.0.0-rc.90/0001-dev-target-depends-on-pull-image}/migration.d.ts +0 -0
- /package/src/migrations/{latest/dev-target-depends-on-pull-image → v1.0.0-rc.90/0001-dev-target-depends-on-pull-image}/migration.js +0 -0
- /package/src/migrations/{latest/open-api-codegen-executor → v1.0.0-rc.90/0002-open-api-codegen-executor}/metadata.json +0 -0
- /package/src/migrations/{latest/dev-target-depends-on-pull-image → v1.0.0-rc.90/0002-open-api-codegen-executor}/migration.d.ts +0 -0
- /package/src/migrations/{latest/open-api-codegen-executor → v1.0.0-rc.90/0002-open-api-codegen-executor}/migration.js +0 -0
- /package/src/migrations/{latest/terraform-provider-plugin-cache → v1.0.0-rc.90/0003-terraform-provider-plugin-cache}/metadata.json +0 -0
- /package/src/migrations/{latest/docker-target-cache-soundness → v1.0.0-rc.90/0003-terraform-provider-plugin-cache}/migration.d.ts +0 -0
- /package/src/migrations/{latest/terraform-provider-plugin-cache → v1.0.0-rc.90/0003-terraform-provider-plugin-cache}/migration.js +0 -0
- /package/src/migrations/{latest/python-test-input-scoping → v1.0.0-rc.90/0004-python-test-input-scoping}/metadata.json +0 -0
- /package/src/migrations/{latest/infra-deploy-express-mode → v1.0.0-rc.90/0004-python-test-input-scoping}/migration.d.ts +0 -0
- /package/src/migrations/{latest/python-test-input-scoping → v1.0.0-rc.90/0004-python-test-input-scoping}/migration.js +0 -0
- /package/src/migrations/{latest/vitest-coverage-output-dir → v1.0.0-rc.90/0005-vitest-coverage-output-dir}/metadata.json +0 -0
- /package/src/migrations/{latest/open-api-codegen-executor → v1.0.0-rc.90/0005-vitest-coverage-output-dir}/migration.d.ts +0 -0
- /package/src/migrations/{latest/vitest-coverage-output-dir → v1.0.0-rc.90/0005-vitest-coverage-output-dir}/migration.js +0 -0
- /package/src/migrations/{latest/add-assemble-target → v1.0.0-rc.90/0006-add-assemble-target}/metadata.json +0 -0
- /package/src/migrations/{latest/python-test-input-scoping → v1.0.0-rc.90/0006-add-assemble-target}/migration.d.ts +0 -0
- /package/src/migrations/{latest/add-assemble-target → v1.0.0-rc.90/0006-add-assemble-target}/migration.js +0 -0
- /package/src/migrations/{latest/docker-target-cache-soundness → v1.0.0-rc.90/0007-docker-target-cache-soundness}/metadata.json +0 -0
- /package/src/migrations/{latest/react-website-unique-dev-ports → v1.0.0-rc.90/0007-docker-target-cache-soundness}/migration.d.ts +0 -0
- /package/src/migrations/{latest/docker-target-cache-soundness → v1.0.0-rc.90/0007-docker-target-cache-soundness}/migration.js +0 -0
- /package/src/migrations/{latest/declare-cacheable-target-inputs → v1.0.0-rc.90/0008-declare-cacheable-target-inputs}/metadata.json +0 -0
- /package/src/migrations/{latest/rolldown-config-bundle-transient → v1.0.0-rc.90/0008-declare-cacheable-target-inputs}/migration.d.ts +0 -0
- /package/src/migrations/{latest/declare-cacheable-target-inputs → v1.0.0-rc.90/0008-declare-cacheable-target-inputs}/migration.js +0 -0
- /package/src/migrations/{latest/terraform-fmt-check → v1.0.0-rc.90/0009-terraform-fmt-check}/metadata.json +0 -0
- /package/src/migrations/{latest/shadcn-package-imports-exports → v1.0.0-rc.90/0009-terraform-fmt-check}/migration.d.ts +0 -0
- /package/src/migrations/{latest/terraform-fmt-check → v1.0.0-rc.90/0009-terraform-fmt-check}/migration.js +0 -0
- /package/src/migrations/{latest/react-website-unique-dev-ports → v1.0.0-rc.92/0001-react-website-unique-dev-ports}/metadata.json +0 -0
- /package/src/migrations/{latest/shx-fs-commands → v1.0.0-rc.92/0001-react-website-unique-dev-ports}/migration.d.ts +0 -0
- /package/src/migrations/{latest/react-website-unique-dev-ports → v1.0.0-rc.92/0001-react-website-unique-dev-ports}/migration.js +0 -0
- /package/src/migrations/{latest/terraform-fmt-check → v1.0.0-rc.94/0001-infra-deploy-express-mode}/migration.d.ts +0 -0
- /package/src/migrations/{latest/shx-fs-commands → v1.0.0-rc.94/0002-shx-fs-commands}/metadata.json +0 -0
- /package/src/migrations/{latest/terraform-provider-plugin-cache → v1.0.0-rc.94/0002-shx-fs-commands}/migration.d.ts +0 -0
- /package/src/migrations/{latest/shx-fs-commands → v1.0.0-rc.94/0002-shx-fs-commands}/migration.js +0 -0
- /package/src/migrations/{latest/agent-core-vendor-target → v1.0.0-rc.94/0003-agent-core-vendor-target}/metadata.json +0 -0
- /package/src/migrations/{latest/vitest-coverage-output-dir → v1.0.0-rc.94/0003-agent-core-vendor-target}/migration.d.ts +0 -0
- /package/src/migrations/{latest/agent-core-vendor-target → v1.0.0-rc.94/0003-agent-core-vendor-target}/migration.js +0 -0
- /package/src/migrations/{latest/rolldown-config-bundle-transient → v1.0.0-rc.95/0001-rolldown-config-bundle-transient}/metadata.json +0 -0
- /package/src/migrations/{latest/rolldown-config-bundle-transient → v1.0.0-rc.95/0001-rolldown-config-bundle-transient}/migration.js +0 -0
- /package/src/migrations/{latest/agent-connection-pin-strands-peers → v1.0.0-rc.95/0002-agent-connection-pin-strands-peers}/metadata.json +0 -0
- /package/src/migrations/{latest/agent-connection-pin-strands-peers → v1.0.0-rc.95/0002-agent-connection-pin-strands-peers}/migration.d.ts +0 -0
- /package/src/migrations/{latest/agent-connection-pin-strands-peers → v1.0.0-rc.95/0002-agent-connection-pin-strands-peers}/migration.js +0 -0
- /package/src/migrations/{latest/ignore-package-manager-temp-files → v1.0.0-rc.95/0003-ignore-package-manager-temp-files}/metadata.json +0 -0
- /package/src/migrations/{latest/ignore-package-manager-temp-files → v1.0.0-rc.95/0003-ignore-package-manager-temp-files}/migration.d.ts +0 -0
- /package/src/migrations/{latest/ignore-package-manager-temp-files → v1.0.0-rc.95/0003-ignore-package-manager-temp-files}/migration.js +0 -0
- /package/src/migrations/{latest/shadcn-package-imports-exports → v1.0.0-rc.95/0004-shadcn-package-imports-exports}/metadata.json +0 -0
- /package/src/migrations/{latest/shadcn-package-imports-exports → v1.0.0-rc.95/0004-shadcn-package-imports-exports}/migration.js +0 -0
package/src/ts/lib/biome.js
CHANGED
|
@@ -4,75 +4,77 @@
|
|
|
4
4
|
*/ import { readNxJson, updateNxJson, updateProjectConfiguration } from "@nx/devkit";
|
|
5
5
|
import { readProjectConfigurationUnqualified } from "../../utils/nx.js";
|
|
6
6
|
import { sortObjectKeys } from "../../utils/object.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
command: 'biome lint {projectRoot}'
|
|
20
|
-
},
|
|
21
|
-
configurations: {
|
|
22
|
-
fix: {
|
|
23
|
-
command: 'biome check --write {projectRoot}'
|
|
7
|
+
/**
|
|
8
|
+
* The `format` and `lint` targets every Biome-linted project gets, so a project
|
|
9
|
+
* that isn't scaffolded by `ts#project` (e.g. an AgentCore Gateway hosting only
|
|
10
|
+
* `local-dev.ts`) is linted identically rather than by its own copy.
|
|
11
|
+
*
|
|
12
|
+
* When there's no root Biome configuration (eg the user removed it), the targets
|
|
13
|
+
* are no-ops rather than failing on a missing config.
|
|
14
|
+
*/ export const biomeTargets = (tree)=>{
|
|
15
|
+
if (!tree.exists('biome.json')) {
|
|
16
|
+
return {
|
|
17
|
+
format: {
|
|
18
|
+
executor: 'nx:noop'
|
|
24
19
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
command: 'node -e ""'
|
|
20
|
+
lint: {
|
|
21
|
+
executor: 'nx:noop'
|
|
28
22
|
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
cache: true,
|
|
45
|
-
inputs: [
|
|
46
|
-
'biome'
|
|
47
|
-
],
|
|
48
|
-
options: {
|
|
49
|
-
command: 'biome format {projectRoot}'
|
|
50
|
-
},
|
|
51
|
-
configurations: {
|
|
52
|
-
fix: {
|
|
53
|
-
command: 'biome format --write {projectRoot}'
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
// The base format target checks formatting (failing when files aren't
|
|
27
|
+
// formatted); the `fix` configuration writes the changes. `skip-lint` is a
|
|
28
|
+
// no-op so `nx lint --configuration=skip-lint` propagates cleanly through
|
|
29
|
+
// the lint -> format dependency edge.
|
|
30
|
+
format: {
|
|
31
|
+
executor: 'nx:run-commands',
|
|
32
|
+
cache: true,
|
|
33
|
+
inputs: [
|
|
34
|
+
'biome'
|
|
35
|
+
],
|
|
36
|
+
options: {
|
|
37
|
+
command: 'biome format {projectRoot}'
|
|
54
38
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
39
|
+
configurations: {
|
|
40
|
+
fix: {
|
|
41
|
+
command: 'biome format --write {projectRoot}'
|
|
42
|
+
},
|
|
43
|
+
'skip-lint': {
|
|
44
|
+
// Cross-platform no-op (`true` is not available on Windows cmd).
|
|
45
|
+
command: 'node -e ""'
|
|
46
|
+
}
|
|
58
47
|
}
|
|
48
|
+
},
|
|
49
|
+
lint: {
|
|
50
|
+
executor: 'nx:run-commands',
|
|
51
|
+
cache: true,
|
|
52
|
+
inputs: [
|
|
53
|
+
'biome'
|
|
54
|
+
],
|
|
55
|
+
options: {
|
|
56
|
+
command: 'biome lint {projectRoot}'
|
|
57
|
+
},
|
|
58
|
+
configurations: {
|
|
59
|
+
fix: {
|
|
60
|
+
command: 'biome check --write {projectRoot}'
|
|
61
|
+
},
|
|
62
|
+
'skip-lint': {
|
|
63
|
+
command: 'node -e ""'
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
// Format before linting so any fixable formatting issues (eg line too
|
|
67
|
+
// long) are resolved first, mirroring the Python project generator.
|
|
68
|
+
dependsOn: [
|
|
69
|
+
'format'
|
|
70
|
+
]
|
|
59
71
|
}
|
|
60
|
-
} : {
|
|
61
|
-
executor: 'nx:noop'
|
|
62
72
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
targets: sortObjectKeys({
|
|
69
|
-
...projectJson?.targets,
|
|
70
|
-
format: formatTarget,
|
|
71
|
-
lint: lintTarget
|
|
72
|
-
})
|
|
73
|
-
});
|
|
74
|
-
// Register the `biome` named input so lint targets are cache-invalidated when
|
|
75
|
-
// the root biome.json changes.
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Register the `biome` named input so lint targets are cache-invalidated when
|
|
76
|
+
* the root biome.json changes.
|
|
77
|
+
*/ export const registerBiomeNamedInput = (tree)=>{
|
|
76
78
|
const nxJson = readNxJson(tree);
|
|
77
79
|
if (!nxJson.namedInputs?.biome || !nxJson.namedInputs.biome.includes('{workspaceRoot}/biome.json')) {
|
|
78
80
|
updateNxJson(tree, {
|
|
@@ -87,5 +89,19 @@ export const configureBiomeLint = async (tree, options)=>{
|
|
|
87
89
|
});
|
|
88
90
|
}
|
|
89
91
|
};
|
|
92
|
+
export const configureBiomeLint = async (tree, options)=>{
|
|
93
|
+
const projectJson = readProjectConfigurationUnqualified(tree, options.fullyQualifiedName);
|
|
94
|
+
updateProjectConfiguration(tree, options.fullyQualifiedName, {
|
|
95
|
+
...projectJson,
|
|
96
|
+
// Sort targets so the lint and format targets land in deterministic
|
|
97
|
+
// positions regardless of whether they already existed (keeps re-runs
|
|
98
|
+
// stable)
|
|
99
|
+
targets: sortObjectKeys({
|
|
100
|
+
...projectJson?.targets,
|
|
101
|
+
...biomeTargets(tree)
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
registerBiomeNamedInput(tree);
|
|
105
|
+
};
|
|
90
106
|
|
|
91
107
|
//# sourceMappingURL=biome.js.map
|
package/src/ts/lib/biome.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/biome.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n readNxJson,\n type Tree,\n updateNxJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { readProjectConfigurationUnqualified } from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport type { ConfigureProjectOptions } from './types.js';\n\
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/biome.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n readNxJson,\n type TargetConfiguration,\n type Tree,\n updateNxJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { readProjectConfigurationUnqualified } from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport type { ConfigureProjectOptions } from './types.js';\n\n/**\n * The `format` and `lint` targets every Biome-linted project gets, so a project\n * that isn't scaffolded by `ts#project` (e.g. an AgentCore Gateway hosting only\n * `local-dev.ts`) is linted identically rather than by its own copy.\n *\n * When there's no root Biome configuration (eg the user removed it), the targets\n * are no-ops rather than failing on a missing config.\n */\nexport const biomeTargets = (\n tree: Tree,\n): Record<'format' | 'lint', TargetConfiguration> => {\n if (!tree.exists('biome.json')) {\n return { format: { executor: 'nx:noop' }, lint: { executor: 'nx:noop' } };\n }\n return {\n // The base format target checks formatting (failing when files aren't\n // formatted); the `fix` configuration writes the changes. `skip-lint` is a\n // no-op so `nx lint --configuration=skip-lint` propagates cleanly through\n // the lint -> format dependency edge.\n format: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['biome'],\n options: {\n command: 'biome format {projectRoot}',\n },\n configurations: {\n fix: {\n command: 'biome format --write {projectRoot}',\n },\n 'skip-lint': {\n // Cross-platform no-op (`true` is not available on Windows cmd).\n command: 'node -e \"\"',\n },\n },\n },\n lint: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['biome'],\n options: {\n command: 'biome lint {projectRoot}',\n },\n configurations: {\n fix: {\n command: 'biome check --write {projectRoot}',\n },\n 'skip-lint': {\n command: 'node -e \"\"',\n },\n },\n // Format before linting so any fixable formatting issues (eg line too\n // long) are resolved first, mirroring the Python project generator.\n dependsOn: ['format'],\n },\n };\n};\n\n/**\n * Register the `biome` named input so lint targets are cache-invalidated when\n * the root biome.json changes.\n */\nexport const registerBiomeNamedInput = (tree: Tree): void => {\n const nxJson = readNxJson(tree);\n if (\n !nxJson.namedInputs?.biome ||\n !nxJson.namedInputs.biome.includes('{workspaceRoot}/biome.json')\n ) {\n updateNxJson(tree, {\n ...nxJson,\n namedInputs: {\n ...nxJson.namedInputs,\n biome: ['default', '{workspaceRoot}/biome.json'],\n },\n });\n }\n};\n\nexport const configureBiomeLint = async (\n tree: Tree,\n options: ConfigureProjectOptions,\n) => {\n const projectJson = readProjectConfigurationUnqualified(\n tree,\n options.fullyQualifiedName,\n );\n\n updateProjectConfiguration(tree, options.fullyQualifiedName, {\n ...projectJson,\n // Sort targets so the lint and format targets land in deterministic\n // positions regardless of whether they already existed (keeps re-runs\n // stable)\n targets: sortObjectKeys({\n ...projectJson?.targets,\n ...biomeTargets(tree),\n }),\n });\n\n registerBiomeNamedInput(tree);\n};\n"],"names":["readNxJson","updateNxJson","updateProjectConfiguration","readProjectConfigurationUnqualified","sortObjectKeys","biomeTargets","tree","exists","format","executor","lint","cache","inputs","options","command","configurations","fix","dependsOn","registerBiomeNamedInput","nxJson","namedInputs","biome","includes","configureBiomeLint","projectJson","fullyQualifiedName","targets"],"mappings":"AAAA;;;CAGC,GACD,SACEA,UAAU,EAGVC,YAAY,EACZC,0BAA0B,QACrB,aAAa;AACpB,SAASC,mCAAmC,QAAQ,oBAAoB;AACxE,SAASC,cAAc,QAAQ,wBAAwB;AAGvD;;;;;;;CAOC,GACD,OAAO,MAAMC,eAAe,CAC1BC;IAEA,IAAI,CAACA,KAAKC,MAAM,CAAC,eAAe;QAC9B,OAAO;YAAEC,QAAQ;gBAAEC,UAAU;YAAU;YAAGC,MAAM;gBAAED,UAAU;YAAU;QAAE;IAC1E;IACA,OAAO;QACL,sEAAsE;QACtE,2EAA2E;QAC3E,0EAA0E;QAC1E,sCAAsC;QACtCD,QAAQ;YACNC,UAAU;YACVE,OAAO;YACPC,QAAQ;gBAAC;aAAQ;YACjBC,SAAS;gBACPC,SAAS;YACX;YACAC,gBAAgB;gBACdC,KAAK;oBACHF,SAAS;gBACX;gBACA,aAAa;oBACX,iEAAiE;oBACjEA,SAAS;gBACX;YACF;QACF;QACAJ,MAAM;YACJD,UAAU;YACVE,OAAO;YACPC,QAAQ;gBAAC;aAAQ;YACjBC,SAAS;gBACPC,SAAS;YACX;YACAC,gBAAgB;gBACdC,KAAK;oBACHF,SAAS;gBACX;gBACA,aAAa;oBACXA,SAAS;gBACX;YACF;YACA,sEAAsE;YACtE,oEAAoE;YACpEG,WAAW;gBAAC;aAAS;QACvB;IACF;AACF,EAAE;AAEF;;;CAGC,GACD,OAAO,MAAMC,0BAA0B,CAACZ;IACtC,MAAMa,SAASnB,WAAWM;IAC1B,IACE,CAACa,OAAOC,WAAW,EAAEC,SACrB,CAACF,OAAOC,WAAW,CAACC,KAAK,CAACC,QAAQ,CAAC,+BACnC;QACArB,aAAaK,MAAM;YACjB,GAAGa,MAAM;YACTC,aAAa;gBACX,GAAGD,OAAOC,WAAW;gBACrBC,OAAO;oBAAC;oBAAW;iBAA6B;YAClD;QACF;IACF;AACF,EAAE;AAEF,OAAO,MAAME,qBAAqB,OAChCjB,MACAO;IAEA,MAAMW,cAAcrB,oCAClBG,MACAO,QAAQY,kBAAkB;IAG5BvB,2BAA2BI,MAAMO,QAAQY,kBAAkB,EAAE;QAC3D,GAAGD,WAAW;QACd,oEAAoE;QACpE,sEAAsE;QACtE,UAAU;QACVE,SAAStB,eAAe;YACtB,GAAGoB,aAAaE,OAAO;YACvB,GAAGrB,aAAaC,KAAK;QACvB;IACF;IAEAY,wBAAwBZ;AAC1B,EAAE"}
|
package/src/ts/lib/generator.js
CHANGED
|
@@ -10,7 +10,7 @@ import { addGeneratorMetricsIfApplicable } from "../../utils/metrics.js";
|
|
|
10
10
|
import { isEsmWorkspace } from "../../utils/module-format.js";
|
|
11
11
|
import { toKebabCase } from "../../utils/names.js";
|
|
12
12
|
import { getNpmScopePrefix } from "../../utils/npm-scope.js";
|
|
13
|
-
import { addGeneratorMetadata, getGeneratorInfo, mergeTargetDefault, projectExists } from "../../utils/nx.js";
|
|
13
|
+
import { addGeneratorMetadata, getGeneratorInfo, mergeTarget, mergeTargetDefault, projectExists } from "../../utils/nx.js";
|
|
14
14
|
import { sortObjectKeys } from "../../utils/object.js";
|
|
15
15
|
import { getPackageManagerDisplayCommands } from "../../utils/pkg-manager.js";
|
|
16
16
|
import { configureTsProject, TS_PROJECT_DEPENDENCIES } from "./ts-project-utils.js";
|
|
@@ -97,7 +97,11 @@ const VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS = [
|
|
|
97
97
|
}, DEPENDENCIES);
|
|
98
98
|
const projectConfiguration = readProjectConfiguration(tree, fullyQualifiedName);
|
|
99
99
|
const targets = projectConfiguration.targets;
|
|
100
|
-
|
|
100
|
+
// Merged rather than assigned so a re-run converges this generator's own
|
|
101
|
+
// configuration without discarding what other generators contributed to the
|
|
102
|
+
// same targets — the `bundle` that ts#lambda-function adds to build and
|
|
103
|
+
// assemble, say, which those targets must keep depending on.
|
|
104
|
+
targets['compile'] = mergeTarget(targets['compile'], {
|
|
101
105
|
executor: 'nx:run-commands',
|
|
102
106
|
outputs: [
|
|
103
107
|
'{workspaceRoot}/dist/{projectRoot}/tsc'
|
|
@@ -106,20 +110,20 @@ const VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS = [
|
|
|
106
110
|
command: 'tsc --build tsconfig.lib.json',
|
|
107
111
|
cwd: '{projectRoot}'
|
|
108
112
|
}
|
|
109
|
-
};
|
|
110
|
-
targets['build'] = {
|
|
113
|
+
});
|
|
114
|
+
targets['build'] = mergeTarget(targets['build'], {
|
|
111
115
|
dependsOn: [
|
|
112
116
|
'lint',
|
|
113
117
|
'compile',
|
|
114
118
|
'test'
|
|
115
119
|
]
|
|
116
|
-
};
|
|
120
|
+
});
|
|
117
121
|
// The artifact-only sibling of build, which the deploy targets depend on.
|
|
118
|
-
targets['assemble'] = {
|
|
122
|
+
targets['assemble'] = mergeTarget(targets['assemble'], {
|
|
119
123
|
dependsOn: [
|
|
120
124
|
'compile'
|
|
121
125
|
]
|
|
122
|
-
};
|
|
126
|
+
});
|
|
123
127
|
projectConfiguration.targets = sortObjectKeys(targets);
|
|
124
128
|
updateProjectConfiguration(tree, fullyQualifiedName, projectConfiguration);
|
|
125
129
|
addGeneratorMetadata(tree, fullyQualifiedName, TS_LIB_GENERATOR_INFO);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/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 type NxJsonConfiguration,\n OverwriteStrategy,\n readProjectConfiguration,\n type TargetConfiguration,\n type Tree,\n updateJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { libraryGenerator } from '@nx/js';\nimport { declareDependencies } from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { isEsmWorkspace } from '../../utils/module-format.js';\nimport { toKebabCase } from '../../utils/names.js';\nimport { getNpmScopePrefix } from '../../utils/npm-scope.js';\nimport {\n addGeneratorMetadata,\n getGeneratorInfo,\n mergeTargetDefault,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { getPackageManagerDisplayCommands } from '../../utils/pkg-manager.js';\nimport type { TsProjectGeneratorSchema } from './schema';\nimport {\n configureTsProject,\n TS_PROJECT_DEPENDENCIES,\n} from './ts-project-utils.js';\nimport { VITEST_DEPENDENCIES } from './vitest.js';\n\nexport const DEPENDENCIES = declareDependencies()({\n ts: [...VITEST_DEPENDENCIES, ...TS_PROJECT_DEPENDENCIES],\n});\n\nexport const TS_LIB_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\n/**\n * Consumes build artifacts produced by a project's dependencies, so a task\n * re-runs when the output it actually reads changes.\n *\n * Test reports are excluded rather than build artifacts included: several\n * generators emit generated sources outside `dist` (an OpenAPI client under a\n * website's `src/generated`, a Smithy SSDK, the Prisma client) and add them to\n * `.gitignore`, which keeps them out of the project's own fileset — so this\n * input is the only thing that hashes them. `reports/` and `coverage/` hold\n * pytest's JUnit and coverage XML, which carry a wall-clock timestamp and so\n * mint a fresh hash on every test run that would cascade through the graph.\n */\nexport const DEPENDENT_TASKS_OUTPUT_FILES_INPUT = {\n dependentTasksOutputFiles: '!{reports,coverage}/**',\n transitive: true,\n};\n\n// Globs this generator has vended for the dependent-task-output input. Any of\n// them is replaced in place, so the entry is neither duplicated nor left at a\n// different scope when a generator re-runs.\nconst VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS = [\n '**/*',\n 'dist/**',\n DEPENDENT_TASKS_OUTPUT_FILES_INPUT.dependentTasksOutputFiles,\n];\n\nexport interface TsLibDetails {\n /**\n * Full package name including scope (eg @foo/bar)\n */\n readonly fullyQualifiedName: string;\n /**\n * Directory of the library relative to the root\n */\n readonly dir: string;\n}\n\n/**\n * Returns details about the TS library to be created\n */\nexport const getTsLibDetails = (\n tree: Tree,\n schema: TsProjectGeneratorSchema,\n): TsLibDetails => {\n const scope = getNpmScopePrefix(tree);\n const normalizedName = toKebabCase(schema.name);\n const fullyQualifiedName = `${scope}${normalizedName}`;\n // NB: interactive nx generator cli can pass empty string\n const dir = joinPathFragments(\n schema.directory || '.',\n schema.subDirectory || normalizedName,\n );\n return { dir, fullyQualifiedName };\n};\n\n/**\n * Generates a typescript project\n */\nexport const tsProjectGenerator = async (\n tree: Tree,\n schema: TsProjectGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const { fullyQualifiedName, dir } = getTsLibDetails(tree, schema);\n // The module format is workspace-wide, established by the preset when the\n // workspace is created, so vending generators always infer it from the tree.\n const esm = isEsmWorkspace(tree);\n\n // Only scaffold the project on first run; on re-run skip creation so user\n // edits are preserved, but continue to (re)apply the configuration below.\n if (!projectExists(tree, fullyQualifiedName)) {\n await libraryGenerator(tree, {\n ...schema,\n name: fullyQualifiedName,\n directory: dir,\n skipPackageJson: true,\n bundler: 'tsc', // TODO: consider supporting others\n linter: 'none',\n unitTestRunner: 'vitest',\n // Register the @nx/vitest plugin so the test target is inferred rather\n // than emitting the deprecated @nx/vitest:test executor target.\n addPlugin: true,\n });\n\n // Replace with simpler sample source code\n tree.delete(joinPathFragments(dir, 'src'));\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n joinPathFragments(dir),\n {\n fullyQualifiedName,\n esm,\n pkgMgrCmd: getPackageManagerDisplayCommands().exec,\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n }\n await configureTsProject(\n tree,\n {\n dir,\n fullyQualifiedName,\n esm,\n },\n DEPENDENCIES,\n );\n\n const projectConfiguration = readProjectConfiguration(\n tree,\n fullyQualifiedName,\n );\n const targets = projectConfiguration.targets;\n\n targets['compile'] = {\n executor: 'nx:run-commands',\n outputs: ['{workspaceRoot}/dist/{projectRoot}/tsc'],\n options: {\n command: 'tsc --build tsconfig.lib.json',\n cwd: '{projectRoot}',\n },\n };\n targets['build'] = {\n dependsOn: ['lint', 'compile', 'test'],\n };\n // The artifact-only sibling of build, which the deploy targets depend on.\n targets['assemble'] = {\n dependsOn: ['compile'],\n };\n projectConfiguration.targets = sortObjectKeys(targets);\n\n updateProjectConfiguration(tree, fullyQualifiedName, projectConfiguration);\n\n addGeneratorMetadata(tree, fullyQualifiedName, TS_LIB_GENERATOR_INFO);\n\n updateJson(tree, 'nx.json', (nxJson: NxJsonConfiguration) => {\n nxJson.namedInputs = {\n ...nxJson.namedInputs,\n default: [\n ...(nxJson.namedInputs?.default ?? []).filter(\n (input) =>\n typeof input !== 'object' ||\n !('dependentTasksOutputFiles' in input) ||\n !(\n VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS.includes(\n input.dependentTasksOutputFiles as string,\n ) && input.transitive\n ),\n ),\n DEPENDENT_TASKS_OUTPUT_FILES_INPUT,\n ],\n };\n\n const withDefaultInput = (base: Partial<TargetConfiguration>) => ({\n ...base,\n inputs: [\n ...(base.inputs ?? []).filter((i) => i !== 'default'),\n 'default',\n ],\n });\n\n nxJson.targetDefaults = {\n ...nxJson.targetDefaults,\n compile: mergeTargetDefault(nxJson.targetDefaults?.compile, (base) => ({\n cache: true,\n ...withDefaultInput(base),\n })),\n build: mergeTargetDefault(nxJson.targetDefaults?.build, (base) => ({\n cache: true,\n ...withDefaultInput(base),\n })),\n test: mergeTargetDefault(nxJson.targetDefaults?.test, withDefaultInput),\n };\n\n // Ensure we only declare a single typescript plugin with the correct settings\n nxJson.plugins = [\n {\n plugin: '@nx/js/typescript',\n options: {\n typecheck: {\n targetName: 'typecheck',\n },\n build: {\n targetName: 'compile',\n configName: 'tsconfig.lib.json',\n buildDepsName: 'build-deps',\n watchDepsName: 'watch-deps',\n },\n },\n },\n ...(nxJson.plugins ?? []).filter(\n (p) => typeof p === 'string' || p.plugin !== '@nx/js/typescript',\n ),\n ];\n\n return nxJson;\n });\n\n await addGeneratorMetricsIfApplicable(tree, [TS_LIB_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n\n // `installDependencies` ensures vitest resolves for the `typescript` language (the\n // generated vitest.config.mts imports it and Nx loads that config when\n // computing the project graph), so a deferred install still runs when needed.\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\nexport default tsProjectGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readProjectConfiguration","updateJson","updateProjectConfiguration","libraryGenerator","declareDependencies","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","isEsmWorkspace","toKebabCase","getNpmScopePrefix","addGeneratorMetadata","getGeneratorInfo","mergeTargetDefault","projectExists","sortObjectKeys","getPackageManagerDisplayCommands","configureTsProject","TS_PROJECT_DEPENDENCIES","VITEST_DEPENDENCIES","DEPENDENCIES","ts","TS_LIB_GENERATOR_INFO","filename","DEPENDENT_TASKS_OUTPUT_FILES_INPUT","dependentTasksOutputFiles","transitive","VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS","getTsLibDetails","tree","schema","scope","normalizedName","name","fullyQualifiedName","dir","directory","subDirectory","tsProjectGenerator","esm","skipPackageJson","bundler","linter","unitTestRunner","addPlugin","delete","dirname","pkgMgrCmd","exec","overwriteStrategy","KeepExisting","projectConfiguration","targets","executor","outputs","options","command","cwd","dependsOn","nxJson","namedInputs","default","filter","input","includes","withDefaultInput","base","inputs","i","targetDefaults","compile","cache","build","test","plugins","plugin","typecheck","targetName","configName","buildDepsName","watchDepsName","p","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EAEjBC,iBAAiB,EACjBC,wBAAwB,EAGxBC,UAAU,EACVC,0BAA0B,QACrB,aAAa;AACpB,SAASC,gBAAgB,QAAQ,SAAS;AAC1C,SAASC,mBAAmB,QAAQ,uCAAuC;AAC3E,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,iBAAiB,QAAQ,2BAA2B;AAC7D,SACEC,oBAAoB,EACpBC,gBAAgB,EAChBC,kBAAkB,EAElBC,aAAa,QACR,oBAAoB;AAC3B,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,gCAAgC,QAAQ,6BAA6B;AAE9E,SACEC,kBAAkB,EAClBC,uBAAuB,QAClB,wBAAwB;AAC/B,SAASC,mBAAmB,QAAQ,cAAc;AAElD,OAAO,MAAMC,eAAehB,sBAAsB;IAChDiB,IAAI;WAAIF;WAAw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U,CAAA;oBACrEK,OAAO;oBACP,GAAGN,iBAAiBC,KAAK;gBAC3B,CAAA;YACAM,OAAO3D,mBAAmB8C,OAAOU,cAAc,EAAEG,OAAO,CAACN,OAAU,CAAA;oBACjEK,OAAO;oBACP,GAAGN,iBAAiBC,KAAK;gBAC3B,CAAA;YACAO,MAAM5D,mBAAmB8C,OAAOU,cAAc,EAAEI,MAAMR;QACxD;QAEA,8EAA8E;QAC9EN,OAAOe,OAAO,GAAG;YACf;gBACEC,QAAQ;gBACRpB,SAAS;oBACPqB,WAAW;wBACTC,YAAY;oBACd;oBACAL,OAAO;wBACLK,YAAY;wBACZC,YAAY;wBACZC,eAAe;wBACfC,eAAe;oBACjB;gBACF;YACF;eACG,AAACrB,CAAAA,OAAOe,OAAO,IAAI,EAAE,AAAD,EAAGZ,MAAM,CAC9B,CAACmB,IAAM,OAAOA,MAAM,YAAYA,EAAEN,MAAM,KAAK;SAEhD;QAED,OAAOhB;IACT;IAEA,MAAMpD,gCAAgCsB,MAAM;QAACP;KAAsB;IAEnE,MAAMjB,qBAAqBwB;IAE3B,mFAAmF;IACnF,uEAAuE;IACvE,8EAA8E;IAC9E,OAAO,IACLvB,oBAAoBuB,MAAMC,OAAOoD,yBAAyB,EAAE;YAC1DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AACF,eAAe7C,mBAAmB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/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 type NxJsonConfiguration,\n OverwriteStrategy,\n readProjectConfiguration,\n type TargetConfiguration,\n type Tree,\n updateJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { libraryGenerator } from '@nx/js';\nimport { declareDependencies } from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { isEsmWorkspace } from '../../utils/module-format.js';\nimport { toKebabCase } from '../../utils/names.js';\nimport { getNpmScopePrefix } from '../../utils/npm-scope.js';\nimport {\n addGeneratorMetadata,\n getGeneratorInfo,\n mergeTarget,\n mergeTargetDefault,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { getPackageManagerDisplayCommands } from '../../utils/pkg-manager.js';\nimport type { TsProjectGeneratorSchema } from './schema';\nimport {\n configureTsProject,\n TS_PROJECT_DEPENDENCIES,\n} from './ts-project-utils.js';\nimport { VITEST_DEPENDENCIES } from './vitest.js';\n\nexport const DEPENDENCIES = declareDependencies()({\n ts: [...VITEST_DEPENDENCIES, ...TS_PROJECT_DEPENDENCIES],\n});\n\nexport const TS_LIB_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\n/**\n * Consumes build artifacts produced by a project's dependencies, so a task\n * re-runs when the output it actually reads changes.\n *\n * Test reports are excluded rather than build artifacts included: several\n * generators emit generated sources outside `dist` (an OpenAPI client under a\n * website's `src/generated`, a Smithy SSDK, the Prisma client) and add them to\n * `.gitignore`, which keeps them out of the project's own fileset — so this\n * input is the only thing that hashes them. `reports/` and `coverage/` hold\n * pytest's JUnit and coverage XML, which carry a wall-clock timestamp and so\n * mint a fresh hash on every test run that would cascade through the graph.\n */\nexport const DEPENDENT_TASKS_OUTPUT_FILES_INPUT = {\n dependentTasksOutputFiles: '!{reports,coverage}/**',\n transitive: true,\n};\n\n// Globs this generator has vended for the dependent-task-output input. Any of\n// them is replaced in place, so the entry is neither duplicated nor left at a\n// different scope when a generator re-runs.\nconst VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS = [\n '**/*',\n 'dist/**',\n DEPENDENT_TASKS_OUTPUT_FILES_INPUT.dependentTasksOutputFiles,\n];\n\nexport interface TsLibDetails {\n /**\n * Full package name including scope (eg @foo/bar)\n */\n readonly fullyQualifiedName: string;\n /**\n * Directory of the library relative to the root\n */\n readonly dir: string;\n}\n\n/**\n * Returns details about the TS library to be created\n */\nexport const getTsLibDetails = (\n tree: Tree,\n schema: TsProjectGeneratorSchema,\n): TsLibDetails => {\n const scope = getNpmScopePrefix(tree);\n const normalizedName = toKebabCase(schema.name);\n const fullyQualifiedName = `${scope}${normalizedName}`;\n // NB: interactive nx generator cli can pass empty string\n const dir = joinPathFragments(\n schema.directory || '.',\n schema.subDirectory || normalizedName,\n );\n return { dir, fullyQualifiedName };\n};\n\n/**\n * Generates a typescript project\n */\nexport const tsProjectGenerator = async (\n tree: Tree,\n schema: TsProjectGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const { fullyQualifiedName, dir } = getTsLibDetails(tree, schema);\n // The module format is workspace-wide, established by the preset when the\n // workspace is created, so vending generators always infer it from the tree.\n const esm = isEsmWorkspace(tree);\n\n // Only scaffold the project on first run; on re-run skip creation so user\n // edits are preserved, but continue to (re)apply the configuration below.\n if (!projectExists(tree, fullyQualifiedName)) {\n await libraryGenerator(tree, {\n ...schema,\n name: fullyQualifiedName,\n directory: dir,\n skipPackageJson: true,\n bundler: 'tsc', // TODO: consider supporting others\n linter: 'none',\n unitTestRunner: 'vitest',\n // Register the @nx/vitest plugin so the test target is inferred rather\n // than emitting the deprecated @nx/vitest:test executor target.\n addPlugin: true,\n });\n\n // Replace with simpler sample source code\n tree.delete(joinPathFragments(dir, 'src'));\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n joinPathFragments(dir),\n {\n fullyQualifiedName,\n esm,\n pkgMgrCmd: getPackageManagerDisplayCommands().exec,\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n }\n await configureTsProject(\n tree,\n {\n dir,\n fullyQualifiedName,\n esm,\n },\n DEPENDENCIES,\n );\n\n const projectConfiguration = readProjectConfiguration(\n tree,\n fullyQualifiedName,\n );\n const targets = projectConfiguration.targets;\n\n // Merged rather than assigned so a re-run converges this generator's own\n // configuration without discarding what other generators contributed to the\n // same targets — the `bundle` that ts#lambda-function adds to build and\n // assemble, say, which those targets must keep depending on.\n targets['compile'] = mergeTarget(targets['compile'], {\n executor: 'nx:run-commands',\n outputs: ['{workspaceRoot}/dist/{projectRoot}/tsc'],\n options: {\n command: 'tsc --build tsconfig.lib.json',\n cwd: '{projectRoot}',\n },\n });\n targets['build'] = mergeTarget(targets['build'], {\n dependsOn: ['lint', 'compile', 'test'],\n });\n // The artifact-only sibling of build, which the deploy targets depend on.\n targets['assemble'] = mergeTarget(targets['assemble'], {\n dependsOn: ['compile'],\n });\n projectConfiguration.targets = sortObjectKeys(targets);\n\n updateProjectConfiguration(tree, fullyQualifiedName, projectConfiguration);\n\n addGeneratorMetadata(tree, fullyQualifiedName, TS_LIB_GENERATOR_INFO);\n\n updateJson(tree, 'nx.json', (nxJson: NxJsonConfiguration) => {\n nxJson.namedInputs = {\n ...nxJson.namedInputs,\n default: [\n ...(nxJson.namedInputs?.default ?? []).filter(\n (input) =>\n typeof input !== 'object' ||\n !('dependentTasksOutputFiles' in input) ||\n !(\n VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS.includes(\n input.dependentTasksOutputFiles as string,\n ) && input.transitive\n ),\n ),\n DEPENDENT_TASKS_OUTPUT_FILES_INPUT,\n ],\n };\n\n const withDefaultInput = (base: Partial<TargetConfiguration>) => ({\n ...base,\n inputs: [\n ...(base.inputs ?? []).filter((i) => i !== 'default'),\n 'default',\n ],\n });\n\n nxJson.targetDefaults = {\n ...nxJson.targetDefaults,\n compile: mergeTargetDefault(nxJson.targetDefaults?.compile, (base) => ({\n cache: true,\n ...withDefaultInput(base),\n })),\n build: mergeTargetDefault(nxJson.targetDefaults?.build, (base) => ({\n cache: true,\n ...withDefaultInput(base),\n })),\n test: mergeTargetDefault(nxJson.targetDefaults?.test, withDefaultInput),\n };\n\n // Ensure we only declare a single typescript plugin with the correct settings\n nxJson.plugins = [\n {\n plugin: '@nx/js/typescript',\n options: {\n typecheck: {\n targetName: 'typecheck',\n },\n build: {\n targetName: 'compile',\n configName: 'tsconfig.lib.json',\n buildDepsName: 'build-deps',\n watchDepsName: 'watch-deps',\n },\n },\n },\n ...(nxJson.plugins ?? []).filter(\n (p) => typeof p === 'string' || p.plugin !== '@nx/js/typescript',\n ),\n ];\n\n return nxJson;\n });\n\n await addGeneratorMetricsIfApplicable(tree, [TS_LIB_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n\n // `installDependencies` ensures vitest resolves for the `typescript` language (the\n // generated vitest.config.mts imports it and Nx loads that config when\n // computing the project graph), so a deferred install still runs when needed.\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\nexport default tsProjectGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readProjectConfiguration","updateJson","updateProjectConfiguration","libraryGenerator","declareDependencies","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","isEsmWorkspace","toKebabCase","getNpmScopePrefix","addGeneratorMetadata","getGeneratorInfo","mergeTarget","mergeTargetDefault","projectExists","sortObjectKeys","getPackageManagerDisplayCommands","configureTsProject","TS_PROJECT_DEPENDENCIES","VITEST_DEPENDENCIES","DEPENDENCIES","ts","TS_LIB_GENERATOR_INFO","filename","DEPENDENT_TASKS_OUTPUT_FILES_INPUT","dependentTasksOutputFiles","transitive","VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS","getTsLibDetails","tree","schema","scope","normalizedName","name","fullyQualifiedName","dir","directory","subDirectory","tsProjectGenerator","esm","skipPackageJson","bundler","linter","unitTestRunner","addPlugin","delete","dirname","pkgMgrCmd","exec","overwriteStrategy","KeepExisting","projectConfiguration","targets","executor","outputs","options","command","cwd","dependsOn","nxJson","namedInputs","default","filter","input","includes","withDefaultInput","base","inputs","i","targetDefaults","compile","cache","build","test","plugins","plugin","typecheck","targetName","configName","buildDepsName","watchDepsName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,SAAS;oBACPqB,WAAW;wBACTC,YAAY;oBACd;oBACAL,OAAO;wBACLK,YAAY;wBACZC,YAAY;wBACZC,eAAe;wBACfC,eAAe;oBACjB;gBACF;YACF;eACG,AAACrB,CAAAA,OAAOe,OAAO,IAAI,EAAE,AAAD,EAAGZ,MAAM,CAC9B,CAACmB,IAAM,OAAOA,MAAM,YAAYA,EAAEN,MAAM,KAAK;SAEhD;QAED,OAAOhB;IACT;IAEA,MAAMrD,gCAAgCuB,MAAM;QAACP;KAAsB;IAEnE,MAAMlB,qBAAqByB;IAE3B,mFAAmF;IACnF,uEAAuE;IACvE,8EAA8E;IAC9E,OAAO,IACLxB,oBAAoBwB,MAAMC,OAAOoD,yBAAyB,EAAE;YAC1DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AACF,eAAe7C,mBAAmB"}
|
|
@@ -31,6 +31,20 @@ export declare const TS_PROJECT_DEPENDENCIES: readonly [{
|
|
|
31
31
|
* generator neither duplicates nor reorders references.
|
|
32
32
|
*/
|
|
33
33
|
export declare const mergeTsReferences: (existing: TsConfigReference[] | undefined, toAdd: TsConfigReference[]) => TsConfigReference[];
|
|
34
|
+
/**
|
|
35
|
+
* Merges a reference to another project's directory into existing TypeScript
|
|
36
|
+
* project references, treating any reference that resolves inside that
|
|
37
|
+
* directory as the same reference.
|
|
38
|
+
*
|
|
39
|
+
* `nx sync` rewrites a reference to a project's `tsconfig.json` into the
|
|
40
|
+
* specific `tsconfig.lib.json` it resolves to, so matching on the exact path
|
|
41
|
+
* alone would append a second reference to the same project on every re-run —
|
|
42
|
+
* which leaves the workspace out of sync and fails the next `build`.
|
|
43
|
+
*
|
|
44
|
+
* `projectDirRef` is the referenced project's directory, relative to the
|
|
45
|
+
* tsconfig being updated (eg `../common/shadcn`).
|
|
46
|
+
*/
|
|
47
|
+
export declare const mergeTsProjectDirReference: (existing: TsConfigReference[] | undefined, projectDirRef: string) => TsConfigReference[];
|
|
34
48
|
/**
|
|
35
49
|
* Updates typescript projects
|
|
36
50
|
*/
|
|
@@ -46,6 +46,30 @@ import { configureVitest } from "./vitest.js";
|
|
|
46
46
|
}
|
|
47
47
|
return references;
|
|
48
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Merges a reference to another project's directory into existing TypeScript
|
|
51
|
+
* project references, treating any reference that resolves inside that
|
|
52
|
+
* directory as the same reference.
|
|
53
|
+
*
|
|
54
|
+
* `nx sync` rewrites a reference to a project's `tsconfig.json` into the
|
|
55
|
+
* specific `tsconfig.lib.json` it resolves to, so matching on the exact path
|
|
56
|
+
* alone would append a second reference to the same project on every re-run —
|
|
57
|
+
* which leaves the workspace out of sync and fails the next `build`.
|
|
58
|
+
*
|
|
59
|
+
* `projectDirRef` is the referenced project's directory, relative to the
|
|
60
|
+
* tsconfig being updated (eg `../common/shadcn`).
|
|
61
|
+
*/ export const mergeTsProjectDirReference = (existing, projectDirRef)=>{
|
|
62
|
+
const references = [
|
|
63
|
+
...existing ?? []
|
|
64
|
+
];
|
|
65
|
+
const alreadyReferenced = references.some((ref)=>ref.path === projectDirRef || ref.path.startsWith(`${projectDirRef}/tsconfig`));
|
|
66
|
+
return alreadyReferenced ? references : [
|
|
67
|
+
...references,
|
|
68
|
+
{
|
|
69
|
+
path: `${projectDirRef}/tsconfig.json`
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
};
|
|
49
73
|
/**
|
|
50
74
|
* Updates typescript projects
|
|
51
75
|
*/ export const configureTsProject = async (tree, options, declaration)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/ts-project-utils.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { joinPathFragments, logger, type Tree, updateJson } from '@nx/devkit';\nimport { join, relative } from 'path';\nimport { addLicenseCheckToLintTarget } from '../../license/config.js';\nimport { addTsDependencies } from '../../utils/add-dependencies.js';\nimport { AWS_NX_PLUGIN_CONFIG_FILE_NAME } from '../../utils/config/utils.js';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from '../../utils/declared-dependencies.js';\nimport { isEsmWorkspace } from '../../utils/module-format.js';\nimport { ensureProjectPackageJson } from '../../utils/project-package-json.js';\nimport type { ITsDepVersion } from '../../utils/versions.js';\nimport { configureBiomeLint } from './biome.js';\nimport type { ConfigureProjectOptions } from './types.js';\nimport { configureVitest, type VITEST_DEPENDENCIES } from './vitest.js';\n\ninterface TsConfigReference {\n path: string;\n}\n\n/**\n * Dependencies a caller must declare to configure a TypeScript project.\n *\n * `@nx/js` writes `types: ['node']` into every project's `tsconfig.lib.json`, so\n * the types must be declared for `tsc` to resolve them. Declared twice: on the\n * project whose tsconfig names them, and at the root, which `@nx/js` seeded until\n * Nx 23.2 stopped.\n */\nexport const TS_PROJECT_DEPENDENCIES = [\n { name: '@types/node', dev: true },\n { name: '@types/node', dev: true, root: true },\n] as const satisfies readonly {\n name: ITsDepVersion;\n dev?: boolean;\n root?: boolean;\n}[];\n\n/**\n * Merges new TypeScript project references into existing ones, deduplicating by\n * path and preserving the order of existing references so re-running a\n * generator neither duplicates nor reorders references.\n */\nexport const mergeTsReferences = (\n existing: TsConfigReference[] | undefined,\n toAdd: TsConfigReference[],\n): TsConfigReference[] => {\n const references = [...(existing ?? [])];\n const existingPaths = new Set(references.map((ref) => ref.path));\n for (const ref of toAdd) {\n if (!existingPaths.has(ref.path)) {\n references.push(ref);\n existingPaths.add(ref.path);\n }\n }\n return references;\n};\n\n/**\n * Updates typescript projects\n */\nexport const configureTsProject = async <const D extends DependencyDeclaration>(\n tree: Tree,\n options: ConfigureProjectOptions,\n declaration: D &\n MustDeclare<typeof VITEST_DEPENDENCIES, D> &\n MustDeclare<typeof TS_PROJECT_DEPENDENCIES, D>,\n) => {\n // Point users at init when the workspace hasn't been configured, since\n // lint/format targets and workspace dependency sync depend on it.\n if (!tree.exists(AWS_NX_PLUGIN_CONFIG_FILE_NAME)) {\n logger.warn(\n `This workspace has no ${AWS_NX_PLUGIN_CONFIG_FILE_NAME} — run 'nx g @aws/nx-plugin:init' (or 'nx add @aws/nx-plugin') to configure linting, formatting and workspace dependency sync.`,\n );\n }\n\n // When the caller doesn't specify a module format, infer it from the\n // workspace root package.json (defaulting to ESM for a fresh workspace).\n const esm = options.esm ?? isEsmWorkspace(tree);\n\n // Remove a conflicting `module: commonjs` from the project tsconfig.json\n // (CommonJS is configured on tsconfig.lib.json below when needed).\n updateJson(tree, join(options.dir, 'tsconfig.json'), (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n module:\n tsConfig.compilerOptions?.module === 'commonjs'\n ? undefined\n : tsConfig.compilerOptions?.module,\n },\n }));\n const outDirToRootRelativePath = relative(\n join(tree.root, options.dir),\n tree.root,\n );\n const distDir = join(outDirToRootRelativePath, 'dist', options.dir, 'tsc');\n // Remove baseUrl and rootDir from the tsconfig.lib.json\n if (tree.exists(join(options.dir, 'tsconfig.lib.json'))) {\n updateJson(tree, join(options.dir, 'tsconfig.lib.json'), (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n baseUrl: undefined,\n rootDir: '.',\n outDir: distDir,\n tsBuildInfoFile: join(distDir, 'tsconfig.lib.tsbuildinfo'),\n // @nx/js configures the lib for ESM (module `nodenext`). CommonJS\n // projects use `node16`, which honours the workspace's\n // `type: commonjs`, emits CommonJS and resolves extensionless relative\n // imports. (Plain `commonjs`/`node` is deprecated in TypeScript 6.)\n ...(esm ? {} : { module: 'node16', moduleResolution: 'node16' }),\n },\n }));\n }\n // Update root project tsconfig\n updateJson(tree, 'tsconfig.base.json', (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n // baseUrl is deprecated in TypeScript 6 — use ./ prefix in paths instead\n baseUrl: undefined,\n rootDir: '.',\n paths: {\n ...tsConfig.compilerOptions?.paths,\n [options.fullyQualifiedName]: [\n `./${joinPathFragments(options.dir, 'src', 'index.ts')}`,\n ],\n },\n },\n }));\n if (tree.exists('tsconfig.json')) {\n updateJson(tree, 'tsconfig.json', (tsConfig) => ({\n ...tsConfig,\n // Add project references, deduplicating and preserving existing order\n references: mergeTsReferences(tsConfig.references, [\n { path: `./${options.dir}` },\n ]),\n }));\n }\n // Every project carries a minimal private package.json so the workspace\n // follows the standard npm package layout (see ensureProjectPackageJson).\n ensureProjectPackageJson(tree, {\n dir: options.dir,\n fullyQualifiedName: options.fullyQualifiedName,\n esm,\n });\n\n // From this helper's constant, not the caller's declaration, which marks these\n // `ownedElsewhere` because the install happens here.\n addTsDependencies(\n tree,\n { ts: [...TS_PROJECT_DEPENDENCIES], py: [] },\n { projectRoot: options.dir },\n );\n\n await configureBiomeLint(tree, options);\n await configureVitest(\n tree,\n options,\n forDependencies<typeof VITEST_DEPENDENCIES>(declaration),\n );\n\n // If license checking is configured, make this project's lint target depend\n // on the root license-check target. No-op if there's no license-check target\n // (i.e. the license generator hasn't run); the license generator wires up\n // existing projects itself, so this works regardless of generator order.\n addLicenseCheckToLintTarget(tree, options.fullyQualifiedName);\n};\n"],"names":["joinPathFragments","logger","updateJson","join","relative","addLicenseCheckToLintTarget","addTsDependencies","AWS_NX_PLUGIN_CONFIG_FILE_NAME","forDependencies","isEsmWorkspace","ensureProjectPackageJson","configureBiomeLint","configureVitest","TS_PROJECT_DEPENDENCIES","name","dev","root","mergeTsReferences","existing","toAdd","references","existingPaths","Set","map","ref","path","has","push","add","configureTsProject","tree","options","declaration","exists","warn","esm","dir","tsConfig","compilerOptions","module","undefined","outDirToRootRelativePath","distDir","baseUrl","rootDir","outDir","tsBuildInfoFile","moduleResolution","paths","fullyQualifiedName","ts","py","projectRoot"],"mappings":"AAAA;;;CAGC,GACD,SAASA,iBAAiB,EAAEC,MAAM,EAAaC,UAAU,QAAQ,aAAa;AAC9E,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AACtC,SAASC,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sEAAsE;gBACtEjB,YAAYH,kBAAkBoB,SAASjB,UAAU,EAAE;oBACjD;wBAAEK,MAAM,CAAC,EAAE,EAAEM,QAAQK,GAAG,EAAE;oBAAC;iBAC5B;YACH,CAAA;IACF;IACA,wEAAwE;IACxE,0EAA0E;IAC1E1B,yBAAyBoB,MAAM;QAC7BM,KAAKL,QAAQK,GAAG;QAChBa,oBAAoBlB,QAAQkB,kBAAkB;QAC9Cd;IACF;IAEA,+EAA+E;IAC/E,qDAAqD;IACrD7B,kBACEwB,MACA;QAAEoB,IAAI;eAAIrC;SAAwB;QAAEsC,IAAI,EAAE;IAAC,GAC3C;QAAEC,aAAarB,QAAQK,GAAG;IAAC;IAG7B,MAAMzB,mBAAmBmB,MAAMC;IAC/B,MAAMnB,gBACJkB,MACAC,SACAvB,gBAA4CwB;IAG9C,4EAA4E;IAC5E,6EAA6E;IAC7E,0EAA0E;IAC1E,yEAAyE;IACzE3B,4BAA4ByB,MAAMC,QAAQkB,kBAAkB;AAC9D,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/ts-project-utils.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { joinPathFragments, logger, type Tree, updateJson } from '@nx/devkit';\nimport { join, relative } from 'path';\nimport { addLicenseCheckToLintTarget } from '../../license/config.js';\nimport { addTsDependencies } from '../../utils/add-dependencies.js';\nimport { AWS_NX_PLUGIN_CONFIG_FILE_NAME } from '../../utils/config/utils.js';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from '../../utils/declared-dependencies.js';\nimport { isEsmWorkspace } from '../../utils/module-format.js';\nimport { ensureProjectPackageJson } from '../../utils/project-package-json.js';\nimport type { ITsDepVersion } from '../../utils/versions.js';\nimport { configureBiomeLint } from './biome.js';\nimport type { ConfigureProjectOptions } from './types.js';\nimport { configureVitest, type VITEST_DEPENDENCIES } from './vitest.js';\n\ninterface TsConfigReference {\n path: string;\n}\n\n/**\n * Dependencies a caller must declare to configure a TypeScript project.\n *\n * `@nx/js` writes `types: ['node']` into every project's `tsconfig.lib.json`, so\n * the types must be declared for `tsc` to resolve them. Declared twice: on the\n * project whose tsconfig names them, and at the root, which `@nx/js` seeded until\n * Nx 23.2 stopped.\n */\nexport const TS_PROJECT_DEPENDENCIES = [\n { name: '@types/node', dev: true },\n { name: '@types/node', dev: true, root: true },\n] as const satisfies readonly {\n name: ITsDepVersion;\n dev?: boolean;\n root?: boolean;\n}[];\n\n/**\n * Merges new TypeScript project references into existing ones, deduplicating by\n * path and preserving the order of existing references so re-running a\n * generator neither duplicates nor reorders references.\n */\nexport const mergeTsReferences = (\n existing: TsConfigReference[] | undefined,\n toAdd: TsConfigReference[],\n): TsConfigReference[] => {\n const references = [...(existing ?? [])];\n const existingPaths = new Set(references.map((ref) => ref.path));\n for (const ref of toAdd) {\n if (!existingPaths.has(ref.path)) {\n references.push(ref);\n existingPaths.add(ref.path);\n }\n }\n return references;\n};\n\n/**\n * Merges a reference to another project's directory into existing TypeScript\n * project references, treating any reference that resolves inside that\n * directory as the same reference.\n *\n * `nx sync` rewrites a reference to a project's `tsconfig.json` into the\n * specific `tsconfig.lib.json` it resolves to, so matching on the exact path\n * alone would append a second reference to the same project on every re-run —\n * which leaves the workspace out of sync and fails the next `build`.\n *\n * `projectDirRef` is the referenced project's directory, relative to the\n * tsconfig being updated (eg `../common/shadcn`).\n */\nexport const mergeTsProjectDirReference = (\n existing: TsConfigReference[] | undefined,\n projectDirRef: string,\n): TsConfigReference[] => {\n const references = [...(existing ?? [])];\n const alreadyReferenced = references.some(\n (ref) =>\n ref.path === projectDirRef ||\n ref.path.startsWith(`${projectDirRef}/tsconfig`),\n );\n return alreadyReferenced\n ? references\n : [...references, { path: `${projectDirRef}/tsconfig.json` }];\n};\n\n/**\n * Updates typescript projects\n */\nexport const configureTsProject = async <const D extends DependencyDeclaration>(\n tree: Tree,\n options: ConfigureProjectOptions,\n declaration: D &\n MustDeclare<typeof VITEST_DEPENDENCIES, D> &\n MustDeclare<typeof TS_PROJECT_DEPENDENCIES, D>,\n) => {\n // Point users at init when the workspace hasn't been configured, since\n // lint/format targets and workspace dependency sync depend on it.\n if (!tree.exists(AWS_NX_PLUGIN_CONFIG_FILE_NAME)) {\n logger.warn(\n `This workspace has no ${AWS_NX_PLUGIN_CONFIG_FILE_NAME} — run 'nx g @aws/nx-plugin:init' (or 'nx add @aws/nx-plugin') to configure linting, formatting and workspace dependency sync.`,\n );\n }\n\n // When the caller doesn't specify a module format, infer it from the\n // workspace root package.json (defaulting to ESM for a fresh workspace).\n const esm = options.esm ?? isEsmWorkspace(tree);\n\n // Remove a conflicting `module: commonjs` from the project tsconfig.json\n // (CommonJS is configured on tsconfig.lib.json below when needed).\n updateJson(tree, join(options.dir, 'tsconfig.json'), (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n module:\n tsConfig.compilerOptions?.module === 'commonjs'\n ? undefined\n : tsConfig.compilerOptions?.module,\n },\n }));\n const outDirToRootRelativePath = relative(\n join(tree.root, options.dir),\n tree.root,\n );\n const distDir = join(outDirToRootRelativePath, 'dist', options.dir, 'tsc');\n // Remove baseUrl and rootDir from the tsconfig.lib.json\n if (tree.exists(join(options.dir, 'tsconfig.lib.json'))) {\n updateJson(tree, join(options.dir, 'tsconfig.lib.json'), (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n baseUrl: undefined,\n rootDir: '.',\n outDir: distDir,\n tsBuildInfoFile: join(distDir, 'tsconfig.lib.tsbuildinfo'),\n // @nx/js configures the lib for ESM (module `nodenext`). CommonJS\n // projects use `node16`, which honours the workspace's\n // `type: commonjs`, emits CommonJS and resolves extensionless relative\n // imports. (Plain `commonjs`/`node` is deprecated in TypeScript 6.)\n ...(esm ? {} : { module: 'node16', moduleResolution: 'node16' }),\n },\n }));\n }\n // Update root project tsconfig\n updateJson(tree, 'tsconfig.base.json', (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n // baseUrl is deprecated in TypeScript 6 — use ./ prefix in paths instead\n baseUrl: undefined,\n rootDir: '.',\n paths: {\n ...tsConfig.compilerOptions?.paths,\n [options.fullyQualifiedName]: [\n `./${joinPathFragments(options.dir, 'src', 'index.ts')}`,\n ],\n },\n },\n }));\n if (tree.exists('tsconfig.json')) {\n updateJson(tree, 'tsconfig.json', (tsConfig) => ({\n ...tsConfig,\n // Add project references, deduplicating and preserving existing order\n references: mergeTsReferences(tsConfig.references, [\n { path: `./${options.dir}` },\n ]),\n }));\n }\n // Every project carries a minimal private package.json so the workspace\n // follows the standard npm package layout (see ensureProjectPackageJson).\n ensureProjectPackageJson(tree, {\n dir: options.dir,\n fullyQualifiedName: options.fullyQualifiedName,\n esm,\n });\n\n // From this helper's constant, not the caller's declaration, which marks these\n // `ownedElsewhere` because the install happens here.\n addTsDependencies(\n tree,\n { ts: [...TS_PROJECT_DEPENDENCIES], py: [] },\n { projectRoot: options.dir },\n );\n\n await configureBiomeLint(tree, options);\n await configureVitest(\n tree,\n options,\n forDependencies<typeof VITEST_DEPENDENCIES>(declaration),\n );\n\n // If license checking is configured, make this project's lint target depend\n // on the root license-check target. No-op if there's no license-check target\n // (i.e. the license generator hasn't run); the license generator wires up\n // existing projects itself, so this works regardless of generator order.\n addLicenseCheckToLintTarget(tree, options.fullyQualifiedName);\n};\n"],"names":["joinPathFragments","logger","updateJson","join","relative","addLicenseCheckToLintTarget","addTsDependencies","AWS_NX_PLUGIN_CONFIG_FILE_NAME","forDependencies","isEsmWorkspace","ensureProjectPackageJson","configureBiomeLint","configureVitest","TS_PROJECT_DEPENDENCIES","name","dev","root","mergeTsReferences","existing","toAdd","references","existingPaths","Set","map","ref","path","has","push","add","mergeTsProjectDirReference","projectDirRef","alreadyReferenced","some","startsWith","configureTsProject","tree","options","declaration","exists","warn","esm","dir","tsConfig","compilerOptions","module","undefined","outDirToRootRelativePath","distDir","baseUrl","rootDir","outDir","tsBuildInfoFile","moduleResolution","paths","fullyQualifiedName","ts","py","projectRoot"],"mappings":"AAAA;;;CAGC,GACD,SAASA,iBAAiB,EAAEC,MAAM,EAAaC,UAAU,QAAQ,aAAa;AAC9E,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AACtC,SAASC,2BAA2B,QAAQ,0BAA0B;AACtE,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,SAASC,8BAA8B,QAAQ,8BAA8B;AAC7E,SAEEC,eAAe,QAEV,uCAAuC;AAC9C,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,wBAAwB,QAAQ,sCAAsC;AAE/E,SAASC,kBAAkB,QAAQ,aAAa;AAEhD,SAASC,eAAe,QAAkC,cAAc;AAMxE;;;;;;;CAOC,GACD,OAAO,MAAMC,0BAA0B;IACrC;QAAEC,MAAM;QAAeC,KAAK;IAAK;IACjC;QAAED,MAAM;QAAeC,KAAK;QAAMC,MAAM;IAAK;CAC9C,CAIG;AAEJ;;;;CAIC,GACD,OAAO,MAAMC,oBAAoB,CAC/BC,UACAC;IAEA,MAAMC,aAAa;WAAKF,YAAY,EAAE;KAAE;IACxC,MAAMG,gBAAgB,IAAIC,IAAIF,WAAWG,GAAG,CAAC,CAACC,MAAQA,IAAIC,IAAI;IAC9D,KAAK,MAAMD,OAAOL,MAAO;QACvB,IAAI,CAACE,cAAcK,GAAG,CAACF,IAAIC,IAAI,GAAG;YAChCL,WAAWO,IAAI,CAACH;YAChBH,cAAcO,GAAG,CAACJ,IAAIC,IAAI;QAC5B;IACF;IACA,OAAOL;AACT,EAAE;AAEF;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMS,6BAA6B,CACxCX,UACAY;IAEA,MAAMV,aAAa;WAAKF,YAAY,EAAE;KAAE;IACxC,MAAMa,oBAAoBX,WAAWY,IAAI,CACvC,CAACR,MACCA,IAAIC,IAAI,KAAKK,iBACbN,IAAIC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,7 +155,7 @@ exports[`ts#mcp-server generator > should match snapshot for Terraform generated
|
|
|
155
155
|
required_providers {
|
|
156
156
|
aws = {
|
|
157
157
|
source = "hashicorp/aws"
|
|
158
|
-
version = "6.
|
|
158
|
+
version = "6.63.0"
|
|
159
159
|
}
|
|
160
160
|
null = {
|
|
161
161
|
source = "hashicorp/null"
|
|
@@ -514,7 +514,7 @@ resource "null_resource" "runtime_ready" {
|
|
|
514
514
|
|
|
515
515
|
provisioner "local-exec" {
|
|
516
516
|
command = <<-EOT
|
|
517
|
-
uv run --with boto3==1.43.
|
|
517
|
+
uv run --with boto3==1.43.89 python -c "
|
|
518
518
|
import boto3
|
|
519
519
|
import json
|
|
520
520
|
import os
|
|
@@ -737,9 +737,9 @@ output "security_group_id" {
|
|
|
737
737
|
|
|
738
738
|
exports[`ts#mcp-server generator > should match snapshot for generated files > mcp-server-http.ts 1`] = `
|
|
739
739
|
"#!/usr/bin/env node
|
|
740
|
-
import { createServer } from './server.js';
|
|
741
740
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
742
741
|
import express, { Request, Response } from 'express';
|
|
742
|
+
import { createServer } from './server.js';
|
|
743
743
|
|
|
744
744
|
const PORT = parseInt(process.env.PORT || '8000');
|
|
745
745
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createServer } from './server<% if (esm) { %>.js<% } %>';
|
|
3
2
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
4
3
|
import express, { Request, Response } from 'express';
|
|
4
|
+
import { createServer } from './server<% if (esm) { %>.js<% } %>';
|
|
5
5
|
|
|
6
6
|
const PORT = parseInt(process.env.PORT || '8000');
|
|
7
7
|
|
|
@@ -17,7 +17,7 @@ import { addGeneratorMetricsIfApplicable } from "../../utils/metrics.js";
|
|
|
17
17
|
import { isEsmWorkspace } from "../../utils/module-format.js";
|
|
18
18
|
import { kebabCase, toClassName } from "../../utils/names.js";
|
|
19
19
|
import { getNpmScope } from "../../utils/npm-scope.js";
|
|
20
|
-
import { addArtifactDependencyToTargets, addComponentDevTarget, addComponentGeneratorMetadata, addDependencyToTargetIfNotPresent, getGeneratorInfo, readProjectConfigurationUnqualified } from "../../utils/nx.js";
|
|
20
|
+
import { addArtifactDependencyToTargets, addComponentDevTarget, addComponentGeneratorMetadata, addDependencyToTargetIfNotPresent, getGeneratorInfo, normalizeTargetKeyOrder, readProjectConfigurationUnqualified } from "../../utils/nx.js";
|
|
21
21
|
import { sortObjectKeys } from "../../utils/object.js";
|
|
22
22
|
import { registerPnpmBuiltDependencies } from "../../utils/pnpm-workspace.js";
|
|
23
23
|
import { assignPort } from "../../utils/port.js";
|
|
@@ -124,7 +124,7 @@ export const tsMcpServerGenerator = async (tree, options)=>{
|
|
|
124
124
|
});
|
|
125
125
|
const dockerTargetName = `${mcpTargetPrefix}-docker`;
|
|
126
126
|
const fs = new FsCommands(tree, DEPENDENCIES);
|
|
127
|
-
project.targets[dockerTargetName] = {
|
|
127
|
+
project.targets[dockerTargetName] = normalizeTargetKeyOrder({
|
|
128
128
|
cache: IMAGE_BUILD_CACHE,
|
|
129
129
|
executor: 'nx:run-commands',
|
|
130
130
|
options: {
|
|
@@ -137,7 +137,7 @@ export const tsMcpServerGenerator = async (tree, options)=>{
|
|
|
137
137
|
dependsOn: [
|
|
138
138
|
'bundle'
|
|
139
139
|
]
|
|
140
|
-
};
|
|
140
|
+
});
|
|
141
141
|
addDependencyToTargetIfNotPresent(project, 'docker', dockerTargetName);
|
|
142
142
|
addArtifactDependencyToTargets(project, 'docker');
|
|
143
143
|
addDockerScanTarget(tree, {
|