@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.
Files changed (313) hide show
  1. package/LICENSE-THIRD-PARTY +9 -9
  2. package/migrations.json +124 -84
  3. package/package.json +3 -3
  4. package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +2 -2
  5. package/src/agentcore-gateway/generator.js +6 -0
  6. package/src/agentcore-gateway/generator.js.map +1 -1
  7. package/src/agentcore-gateway/react-connection/__snapshots__/generator.spec.ts.snap +4 -1
  8. package/src/agentcore-harness/__snapshots__/generator.spec.ts.snap +68 -4
  9. package/src/agentcore-harness/generator.js +6 -0
  10. package/src/agentcore-harness/generator.js.map +1 -1
  11. package/src/connection/gateway-runtime-config.js +1 -1
  12. package/src/connection/gateway-runtime-config.js.map +1 -1
  13. package/src/infra/app/__snapshots__/generator.spec.ts.snap +10 -10
  14. package/src/infra/app/generator.js +39 -9
  15. package/src/infra/app/generator.js.map +1 -1
  16. package/src/init/generator.d.ts +1 -1
  17. package/src/init/generator.js +8 -6
  18. package/src/init/generator.js.map +1 -1
  19. package/src/init/schema.d.js.map +1 -1
  20. package/src/init/schema.d.ts +1 -0
  21. package/src/init/schema.json +5 -0
  22. package/src/internal/test-matrix/generator.js +2 -2
  23. package/src/internal/test-matrix/generator.js.map +1 -1
  24. package/src/license/sync/generator.d.ts +10 -0
  25. package/src/license/sync/generator.js +1 -1
  26. package/src/license/sync/generator.js.map +1 -1
  27. package/src/mcp-server/server.js +2 -0
  28. package/src/mcp-server/server.js.map +1 -1
  29. package/src/mcp-server/tools/best-practices.d.ts +28 -0
  30. package/src/mcp-server/tools/best-practices.js +43 -0
  31. package/src/mcp-server/tools/best-practices.js.map +1 -0
  32. package/src/mcp-server/tools/general-guidance.d.ts +1 -1
  33. package/src/mcp-server/tools/general-guidance.js +13 -4
  34. package/src/mcp-server/tools/general-guidance.js.map +1 -1
  35. package/src/migrations/latest/sandbox-pattern-nested-stacks/metadata.json +3 -0
  36. package/src/migrations/latest/sandbox-pattern-nested-stacks/migration.js +68 -0
  37. package/src/migrations/latest/sandbox-pattern-nested-stacks/migration.js.map +1 -0
  38. package/src/migrations/latest/shadcn-cn-package/metadata.json +3 -0
  39. package/src/migrations/latest/shadcn-cn-package/migration.js +114 -0
  40. package/src/migrations/latest/shadcn-cn-package/migration.js.map +1 -0
  41. package/src/migrations/v1.0.0-rc.90/0001-dev-target-depends-on-pull-image/migration.js.map +1 -0
  42. package/src/migrations/v1.0.0-rc.90/0002-open-api-codegen-executor/migration.js.map +1 -0
  43. package/src/migrations/v1.0.0-rc.90/0003-terraform-provider-plugin-cache/migration.js.map +1 -0
  44. package/src/migrations/v1.0.0-rc.90/0004-python-test-input-scoping/migration.js.map +1 -0
  45. package/src/migrations/v1.0.0-rc.90/0005-vitest-coverage-output-dir/migration.js.map +1 -0
  46. package/src/migrations/v1.0.0-rc.90/0006-add-assemble-target/migration.js.map +1 -0
  47. package/src/migrations/v1.0.0-rc.90/0007-docker-target-cache-soundness/migration.js.map +1 -0
  48. package/src/migrations/v1.0.0-rc.90/0008-declare-cacheable-target-inputs/migration.js.map +1 -0
  49. package/src/migrations/v1.0.0-rc.90/0009-terraform-fmt-check/migration.js.map +1 -0
  50. package/src/migrations/v1.0.0-rc.92/0001-react-website-unique-dev-ports/migration.js.map +1 -0
  51. package/src/migrations/v1.0.0-rc.94/0001-infra-deploy-express-mode/metadata.json +3 -0
  52. package/src/migrations/{latest/infra-deploy-express-mode → v1.0.0-rc.94/0001-infra-deploy-express-mode}/migration.js +26 -28
  53. package/src/migrations/v1.0.0-rc.94/0001-infra-deploy-express-mode/migration.js.map +1 -0
  54. package/src/migrations/v1.0.0-rc.94/0002-shx-fs-commands/migration.js.map +1 -0
  55. package/src/migrations/v1.0.0-rc.94/0003-agent-core-vendor-target/migration.js.map +1 -0
  56. package/src/migrations/v1.0.0-rc.95/0001-rolldown-config-bundle-transient/migration.d.ts +6 -0
  57. package/src/migrations/v1.0.0-rc.95/0001-rolldown-config-bundle-transient/migration.js.map +1 -0
  58. package/src/migrations/v1.0.0-rc.95/0002-agent-connection-pin-strands-peers/migration.js.map +1 -0
  59. package/src/migrations/v1.0.0-rc.95/0003-ignore-package-manager-temp-files/migration.js.map +1 -0
  60. package/src/migrations/v1.0.0-rc.95/0004-shadcn-package-imports-exports/migration.d.ts +6 -0
  61. package/src/migrations/v1.0.0-rc.95/0004-shadcn-package-imports-exports/migration.js.map +1 -0
  62. package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/__snapshots__/migration.spec.ts.snap +84 -0
  63. package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/metadata.json +3 -0
  64. package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/migration.d.ts +6 -0
  65. package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/migration.js +94 -0
  66. package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/migration.js.map +1 -0
  67. package/src/migrations/v1.0.0-rc.97/0002-checkov-scan-cache-inputs/metadata.json +3 -0
  68. package/src/migrations/v1.0.0-rc.97/0002-checkov-scan-cache-inputs/migration.d.ts +6 -0
  69. package/src/migrations/v1.0.0-rc.97/0002-checkov-scan-cache-inputs/migration.js +58 -0
  70. package/src/migrations/v1.0.0-rc.97/0002-checkov-scan-cache-inputs/migration.js.map +1 -0
  71. package/src/migrations/v1.0.0-rc.97/0003-terraform-validate-without-backend/metadata.json +3 -0
  72. package/src/migrations/v1.0.0-rc.97/0003-terraform-validate-without-backend/migration.d.ts +6 -0
  73. package/src/migrations/v1.0.0-rc.97/0003-terraform-validate-without-backend/migration.js +84 -0
  74. package/src/migrations/v1.0.0-rc.97/0003-terraform-validate-without-backend/migration.js.map +1 -0
  75. package/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/metadata.json +3 -0
  76. package/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/migration.d.ts +6 -0
  77. package/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/migration.js +58 -0
  78. package/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/migration.js.map +1 -0
  79. package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/__snapshots__/migration.spec.ts.snap +25 -0
  80. package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/metadata.json +3 -0
  81. package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/migration.d.ts +28 -0
  82. package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/migration.js +75 -0
  83. package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/migration.js.map +1 -0
  84. package/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/metadata.json +3 -0
  85. package/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/migration.d.ts +6 -0
  86. package/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/migration.js +53 -0
  87. package/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/migration.js.map +1 -0
  88. package/src/preset/__snapshots__/generator.spec.ts.snap +2 -2
  89. package/src/preset/generator.js +4 -25
  90. package/src/preset/generator.js.map +1 -1
  91. package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +2 -2
  92. package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +4 -4
  93. package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +4 -4
  94. package/src/py/agent/a2a-connection/generator.d.ts +1 -1
  95. package/src/py/agent/gateway-connection/generator.d.ts +1 -1
  96. package/src/py/agent/mcp-connection/generator.d.ts +1 -1
  97. package/src/py/agent/react-connection/__snapshots__/generator.spec.ts.snap +4 -1
  98. package/src/py/agent/react-connection/generator.d.ts +1 -7
  99. package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +10 -12
  100. package/src/py/dynamodb/generator.js +34 -7
  101. package/src/py/dynamodb/generator.js.map +1 -1
  102. package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
  103. package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +4 -3
  104. package/src/py/lambda-function/files/handler/__lambdaFunctionSnakeCase__.py.template +2 -1
  105. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +3 -3
  106. package/src/py/project/schema.json +3 -1
  107. package/src/py/rdb/__snapshots__/generator.spec.ts.snap +31 -15
  108. package/src/py/rdb/files/Dockerfile.create-db-user.template +7 -3
  109. package/src/py/rdb/files/Dockerfile.migration.template +7 -3
  110. package/src/py/rdb/generator.js +29 -28
  111. package/src/py/rdb/generator.js.map +1 -1
  112. package/src/smithy/project/__snapshots__/generator.spec.ts.snap +5 -5
  113. package/src/smithy/react-connection/files/model/extensions.smithy.template +3 -3
  114. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +8 -8
  115. package/src/smithy/ts/api/generator.js +7 -2
  116. package/src/smithy/ts/api/generator.js.map +1 -1
  117. package/src/terraform/project/generator.js +34 -10
  118. package/src/terraform/project/generator.js.map +1 -1
  119. package/src/terraform/project/schema.d.js +0 -3
  120. package/src/terraform/project/schema.d.js.map +1 -1
  121. package/src/terraform/project/schema.d.ts +0 -4
  122. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
  123. package/src/trpc/backend/generator.js +7 -1
  124. package/src/trpc/backend/generator.js.map +1 -1
  125. package/src/trpc/react/generator.js +6 -0
  126. package/src/trpc/react/generator.js.map +1 -1
  127. package/src/ts/agent/__snapshots__/generator.spec.ts.snap +4 -4
  128. package/src/ts/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +2 -2
  129. package/src/ts/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +2 -2
  130. package/src/ts/agent/generator.js +3 -3
  131. package/src/ts/agent/generator.js.map +1 -1
  132. package/src/ts/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +2 -2
  133. package/src/ts/agent/react-connection/generator.d.ts +1 -9
  134. package/src/ts/astro-docs/files/translation/scripts/translate.ts.template +47 -2
  135. package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +1 -1
  136. package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +6 -4
  137. package/src/ts/dynamodb/generator.js +30 -6
  138. package/src/ts/dynamodb/generator.js.map +1 -1
  139. package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  140. package/src/ts/lib/biome.d.ts +15 -1
  141. package/src/ts/lib/biome.js +79 -63
  142. package/src/ts/lib/biome.js.map +1 -1
  143. package/src/ts/lib/generator.js +11 -7
  144. package/src/ts/lib/generator.js.map +1 -1
  145. package/src/ts/lib/ts-project-utils.d.ts +14 -0
  146. package/src/ts/lib/ts-project-utils.js +24 -0
  147. package/src/ts/lib/ts-project-utils.js.map +1 -1
  148. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +3 -3
  149. package/src/ts/mcp-server/files/app/http.ts.template +1 -1
  150. package/src/ts/mcp-server/generator.js +3 -3
  151. package/src/ts/mcp-server/generator.js.map +1 -1
  152. package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +2 -2
  153. package/src/ts/nx-generator/files/local/generator.spec.ts.template +2 -2
  154. package/src/ts/nx-migration/generator.js +3 -1
  155. package/src/ts/nx-migration/generator.js.map +1 -1
  156. package/src/ts/nx-plugin/__snapshots__/generator.spec.ts.snap +1 -25
  157. package/src/ts/nx-plugin/generator.js +19 -17
  158. package/src/ts/nx-plugin/generator.js.map +1 -1
  159. package/src/ts/nx-plugin/utils.d.ts +21 -0
  160. package/src/ts/nx-plugin/utils.js +41 -1
  161. package/src/ts/nx-plugin/utils.js.map +1 -1
  162. package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +13 -8
  163. package/src/ts/rdb/files/Dockerfile.template +5 -0
  164. package/src/ts/rdb/generator.d.ts +8 -0
  165. package/src/ts/rdb/generator.js +28 -24
  166. package/src/ts/rdb/generator.js.map +1 -1
  167. package/src/ts/rdb/trpc-connection/__snapshots__/generator.spec.ts.snap +39 -0
  168. package/src/ts/rdb/trpc-connection/generator.js +13 -0
  169. package/src/ts/rdb/trpc-connection/generator.js.map +1 -1
  170. package/src/ts/react-website/agui/files/common/src/components/__agentNameKebabCase__-chat.tsx.template +9 -0
  171. package/src/ts/react-website/agui/files/common/src/hooks/useAgui__agentNameClassName__.tsx.template +4 -1
  172. package/src/ts/react-website/agui/generator.d.ts +1 -5
  173. package/src/ts/react-website/agui/generator.js +6 -2
  174. package/src/ts/react-website/agui/generator.js.map +1 -1
  175. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +26 -26
  176. package/src/ts/react-website/app/generator.d.ts +1 -5
  177. package/src/ts/react-website/app/generator.js +3 -8
  178. package/src/ts/react-website/app/generator.js.map +1 -1
  179. package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
  180. package/src/utils/agent-connection/agent-connection.d.ts +2 -1
  181. package/src/utils/agent-connection/agent-connection.js +6 -1
  182. package/src/utils/agent-connection/agent-connection.js.map +1 -1
  183. package/src/utils/agent-core-constructs/files/cdk/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.ts.template +11 -7
  184. package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/agentcore-gateway.ts.template +14 -6
  185. package/src/utils/agent-core-packaging.js +5 -5
  186. package/src/utils/agent-core-packaging.js.map +1 -1
  187. package/src/utils/api-constructs/api-constructs.d.ts +5 -0
  188. package/src/utils/api-constructs/api-constructs.js +8 -0
  189. package/src/utils/api-constructs/api-constructs.js.map +1 -1
  190. package/src/utils/api-constructs/files/cdk/app/apis/http/__apiNameKebabCase__.ts.template +4 -2
  191. package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +4 -2
  192. package/src/utils/ast.d.ts +10 -0
  193. package/src/utils/ast.js +87 -15
  194. package/src/utils/ast.js.map +1 -1
  195. package/src/utils/dependencies.d.ts +10 -0
  196. package/src/utils/dependencies.js +93 -1
  197. package/src/utils/dependencies.js.map +1 -1
  198. package/src/utils/docker.d.ts +11 -0
  199. package/src/utils/docker.js +16 -3
  200. package/src/utils/docker.js.map +1 -1
  201. package/src/utils/dynamodb-config.d.ts +48 -0
  202. package/src/utils/dynamodb-config.js +44 -0
  203. package/src/utils/dynamodb-config.js.map +1 -0
  204. package/src/utils/dynamodb-constructs/files/cdk/app/dynamodb/__nameKebabCase__.ts.template +8 -4
  205. package/src/utils/files/common/shadcn/src/components/ui/alert.tsx.template +1 -2
  206. package/src/utils/files/common/shadcn/src/components/ui/avatar.tsx.template +1 -2
  207. package/src/utils/files/common/shadcn/src/components/ui/breadcrumb.tsx.template +1 -2
  208. package/src/utils/files/common/shadcn/src/components/ui/button.tsx.template +1 -2
  209. package/src/utils/files/common/shadcn/src/components/ui/card.tsx.template +1 -2
  210. package/src/utils/files/common/shadcn/src/components/ui/input.tsx.template +1 -2
  211. package/src/utils/files/common/shadcn/src/components/ui/separator.tsx.template +1 -2
  212. package/src/utils/files/common/shadcn/src/components/ui/sheet.tsx.template +1 -2
  213. package/src/utils/files/common/shadcn/src/components/ui/sidebar.tsx.template +1 -1
  214. package/src/utils/files/common/shadcn/src/components/ui/skeleton.tsx.template +1 -1
  215. package/src/utils/files/common/shadcn/src/components/ui/spinner.tsx.template +1 -2
  216. package/src/utils/files/common/shadcn/src/components/ui/textarea.tsx.template +1 -2
  217. package/src/utils/files/common/shadcn/src/components/ui/tooltip.tsx.template +1 -2
  218. package/src/utils/files/common/shadcn/src/lib/utils.ts.template +1 -6
  219. package/src/utils/git-secrets.d.ts +28 -0
  220. package/src/utils/git-secrets.js +66 -0
  221. package/src/utils/git-secrets.js.map +1 -0
  222. package/src/utils/init.js +7 -6
  223. package/src/utils/init.js.map +1 -1
  224. package/src/utils/local-project-dependency.d.ts +28 -0
  225. package/src/utils/local-project-dependency.js +40 -0
  226. package/src/utils/local-project-dependency.js.map +1 -0
  227. package/src/utils/nx.d.ts +14 -0
  228. package/src/utils/nx.js +30 -0
  229. package/src/utils/nx.js.map +1 -1
  230. package/src/utils/rdb-constructs/files/cdk/app/dbs/__nameKebabCase__.ts.template +11 -6
  231. package/src/utils/script-project-targets.d.ts +26 -0
  232. package/src/utils/script-project-targets.js +75 -0
  233. package/src/utils/script-project-targets.js.map +1 -0
  234. package/src/utils/shared-shadcn.d.ts +1 -3
  235. package/src/utils/shared-shadcn.js +1 -4
  236. package/src/utils/shared-shadcn.js.map +1 -1
  237. package/src/utils/versions.d.ts +52 -50
  238. package/src/utils/versions.js +55 -49
  239. package/src/utils/versions.js.map +1 -1
  240. package/src/utils/website-constructs/files/cdk/app/static-websites/__websiteNameKebabCase__.ts.template +8 -4
  241. package/src/migrations/latest/add-assemble-target/migration.js.map +0 -1
  242. package/src/migrations/latest/agent-connection-pin-strands-peers/migration.js.map +0 -1
  243. package/src/migrations/latest/agent-core-vendor-target/migration.js.map +0 -1
  244. package/src/migrations/latest/declare-cacheable-target-inputs/migration.js.map +0 -1
  245. package/src/migrations/latest/dev-target-depends-on-pull-image/migration.js.map +0 -1
  246. package/src/migrations/latest/docker-target-cache-soundness/migration.js.map +0 -1
  247. package/src/migrations/latest/ignore-package-manager-temp-files/migration.js.map +0 -1
  248. package/src/migrations/latest/infra-deploy-express-mode/metadata.json +0 -3
  249. package/src/migrations/latest/infra-deploy-express-mode/migration.js.map +0 -1
  250. package/src/migrations/latest/open-api-codegen-executor/migration.js.map +0 -1
  251. package/src/migrations/latest/python-test-input-scoping/migration.js.map +0 -1
  252. package/src/migrations/latest/react-website-unique-dev-ports/migration.js.map +0 -1
  253. package/src/migrations/latest/rolldown-config-bundle-transient/migration.js.map +0 -1
  254. package/src/migrations/latest/shadcn-package-imports-exports/migration.js.map +0 -1
  255. package/src/migrations/latest/shx-fs-commands/migration.js.map +0 -1
  256. package/src/migrations/latest/terraform-fmt-check/migration.js.map +0 -1
  257. package/src/migrations/latest/terraform-provider-plugin-cache/migration.js.map +0 -1
  258. package/src/migrations/latest/vitest-coverage-output-dir/migration.js.map +0 -1
  259. package/src/py/dynamodb/files/__name__/__init__.py.template +0 -6
  260. package/src/py/dynamodb/files/__name__/entities/__init__.py.template +0 -4
  261. package/src/py/dynamodb/files/config.json.template +0 -24
  262. package/src/ts/dynamodb/files/config.json.template +0 -24
  263. package/src/ts/dynamodb/files/src/entities/index.ts.template +0 -1
  264. package/src/ts/dynamodb/files/src/index.ts.template +0 -2
  265. /package/src/migrations/latest/{add-assemble-target → sandbox-pattern-nested-stacks}/migration.d.ts +0 -0
  266. /package/src/migrations/latest/{agent-core-vendor-target → shadcn-cn-package}/migration.d.ts +0 -0
  267. /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
  268. /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
  269. /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
  270. /package/src/migrations/{latest/open-api-codegen-executor → v1.0.0-rc.90/0002-open-api-codegen-executor}/metadata.json +0 -0
  271. /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
  272. /package/src/migrations/{latest/open-api-codegen-executor → v1.0.0-rc.90/0002-open-api-codegen-executor}/migration.js +0 -0
  273. /package/src/migrations/{latest/terraform-provider-plugin-cache → v1.0.0-rc.90/0003-terraform-provider-plugin-cache}/metadata.json +0 -0
  274. /package/src/migrations/{latest/docker-target-cache-soundness → v1.0.0-rc.90/0003-terraform-provider-plugin-cache}/migration.d.ts +0 -0
  275. /package/src/migrations/{latest/terraform-provider-plugin-cache → v1.0.0-rc.90/0003-terraform-provider-plugin-cache}/migration.js +0 -0
  276. /package/src/migrations/{latest/python-test-input-scoping → v1.0.0-rc.90/0004-python-test-input-scoping}/metadata.json +0 -0
  277. /package/src/migrations/{latest/infra-deploy-express-mode → v1.0.0-rc.90/0004-python-test-input-scoping}/migration.d.ts +0 -0
  278. /package/src/migrations/{latest/python-test-input-scoping → v1.0.0-rc.90/0004-python-test-input-scoping}/migration.js +0 -0
  279. /package/src/migrations/{latest/vitest-coverage-output-dir → v1.0.0-rc.90/0005-vitest-coverage-output-dir}/metadata.json +0 -0
  280. /package/src/migrations/{latest/open-api-codegen-executor → v1.0.0-rc.90/0005-vitest-coverage-output-dir}/migration.d.ts +0 -0
  281. /package/src/migrations/{latest/vitest-coverage-output-dir → v1.0.0-rc.90/0005-vitest-coverage-output-dir}/migration.js +0 -0
  282. /package/src/migrations/{latest/add-assemble-target → v1.0.0-rc.90/0006-add-assemble-target}/metadata.json +0 -0
  283. /package/src/migrations/{latest/python-test-input-scoping → v1.0.0-rc.90/0006-add-assemble-target}/migration.d.ts +0 -0
  284. /package/src/migrations/{latest/add-assemble-target → v1.0.0-rc.90/0006-add-assemble-target}/migration.js +0 -0
  285. /package/src/migrations/{latest/docker-target-cache-soundness → v1.0.0-rc.90/0007-docker-target-cache-soundness}/metadata.json +0 -0
  286. /package/src/migrations/{latest/react-website-unique-dev-ports → v1.0.0-rc.90/0007-docker-target-cache-soundness}/migration.d.ts +0 -0
  287. /package/src/migrations/{latest/docker-target-cache-soundness → v1.0.0-rc.90/0007-docker-target-cache-soundness}/migration.js +0 -0
  288. /package/src/migrations/{latest/declare-cacheable-target-inputs → v1.0.0-rc.90/0008-declare-cacheable-target-inputs}/metadata.json +0 -0
  289. /package/src/migrations/{latest/rolldown-config-bundle-transient → v1.0.0-rc.90/0008-declare-cacheable-target-inputs}/migration.d.ts +0 -0
  290. /package/src/migrations/{latest/declare-cacheable-target-inputs → v1.0.0-rc.90/0008-declare-cacheable-target-inputs}/migration.js +0 -0
  291. /package/src/migrations/{latest/terraform-fmt-check → v1.0.0-rc.90/0009-terraform-fmt-check}/metadata.json +0 -0
  292. /package/src/migrations/{latest/shadcn-package-imports-exports → v1.0.0-rc.90/0009-terraform-fmt-check}/migration.d.ts +0 -0
  293. /package/src/migrations/{latest/terraform-fmt-check → v1.0.0-rc.90/0009-terraform-fmt-check}/migration.js +0 -0
  294. /package/src/migrations/{latest/react-website-unique-dev-ports → v1.0.0-rc.92/0001-react-website-unique-dev-ports}/metadata.json +0 -0
  295. /package/src/migrations/{latest/shx-fs-commands → v1.0.0-rc.92/0001-react-website-unique-dev-ports}/migration.d.ts +0 -0
  296. /package/src/migrations/{latest/react-website-unique-dev-ports → v1.0.0-rc.92/0001-react-website-unique-dev-ports}/migration.js +0 -0
  297. /package/src/migrations/{latest/terraform-fmt-check → v1.0.0-rc.94/0001-infra-deploy-express-mode}/migration.d.ts +0 -0
  298. /package/src/migrations/{latest/shx-fs-commands → v1.0.0-rc.94/0002-shx-fs-commands}/metadata.json +0 -0
  299. /package/src/migrations/{latest/terraform-provider-plugin-cache → v1.0.0-rc.94/0002-shx-fs-commands}/migration.d.ts +0 -0
  300. /package/src/migrations/{latest/shx-fs-commands → v1.0.0-rc.94/0002-shx-fs-commands}/migration.js +0 -0
  301. /package/src/migrations/{latest/agent-core-vendor-target → v1.0.0-rc.94/0003-agent-core-vendor-target}/metadata.json +0 -0
  302. /package/src/migrations/{latest/vitest-coverage-output-dir → v1.0.0-rc.94/0003-agent-core-vendor-target}/migration.d.ts +0 -0
  303. /package/src/migrations/{latest/agent-core-vendor-target → v1.0.0-rc.94/0003-agent-core-vendor-target}/migration.js +0 -0
  304. /package/src/migrations/{latest/rolldown-config-bundle-transient → v1.0.0-rc.95/0001-rolldown-config-bundle-transient}/metadata.json +0 -0
  305. /package/src/migrations/{latest/rolldown-config-bundle-transient → v1.0.0-rc.95/0001-rolldown-config-bundle-transient}/migration.js +0 -0
  306. /package/src/migrations/{latest/agent-connection-pin-strands-peers → v1.0.0-rc.95/0002-agent-connection-pin-strands-peers}/metadata.json +0 -0
  307. /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
  308. /package/src/migrations/{latest/agent-connection-pin-strands-peers → v1.0.0-rc.95/0002-agent-connection-pin-strands-peers}/migration.js +0 -0
  309. /package/src/migrations/{latest/ignore-package-manager-temp-files → v1.0.0-rc.95/0003-ignore-package-manager-temp-files}/metadata.json +0 -0
  310. /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
  311. /package/src/migrations/{latest/ignore-package-manager-temp-files → v1.0.0-rc.95/0003-ignore-package-manager-temp-files}/migration.js +0 -0
  312. /package/src/migrations/{latest/shadcn-package-imports-exports → v1.0.0-rc.95/0004-shadcn-package-imports-exports}/metadata.json +0 -0
  313. /package/src/migrations/{latest/shadcn-package-imports-exports → v1.0.0-rc.95/0004-shadcn-package-imports-exports}/migration.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/docker.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n joinPathFragments,\n type ProjectConfiguration,\n type Tree,\n} from '@nx/devkit';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from './declared-dependencies.js';\nimport { FS_DEPENDENCIES, FsCommands } from './fs.js';\nimport { addDependencyToTargetIfNotPresent } from './nx.js';\nimport { containerImage, type ITsDepVersion, TS_VERSIONS } from './versions.js';\n\n/** Dependencies a caller must declare to add a Docker scan target. */\nexport const DOCKER_DEPENDENCIES = [...FS_DEPENDENCIES] as const;\n\n/**\n * The `cache` setting every target that builds a container image must use.\n *\n * A built image lives in the container engine's own store, not under any\n * `outputs` path, so Nx has nothing to restore a cache hit from: it would\n * report the build complete while the image is missing, and the `trivy` scan\n * that depends on it would report a cached pass against an image that isn't\n * there. The container engine's layer cache is the sound cache here — it is\n * keyed on the build context and lives alongside the image, so an unchanged\n * context rebuilds in well under a second and always leaves the image present.\n */\nexport const IMAGE_BUILD_CACHE = false;\n\nconst TRIVY_IGNORE_FILE = '.trivyignore';\n\nconst TRIVY_IGNORE_CONTENTS = `# Trivy ignore file. Add one vulnerability ID (e.g. CVE-2021-12345) per line to\n# suppress it during the image scan (\\`nx run-many --target trivy\\`).\n# https://trivy.dev/latest/docs/configuration/filtering/#by-finding-ids\n`;\n\n/**\n * Substitution variables for the vended Node `Dockerfile` templates: the npm\n * version to install globally, and the versions its dependency overrides pin.\n */\nexport const nodeImageVersions = () => ({\n npmVersion: TS_VERSIONS.npm,\n minimatchVersion: TS_VERSIONS.minimatch,\n});\n\n/**\n * Packages a vended Node `Dockerfile` pins, which every generator writing one\n * must declare so the version sync keeps those pins current.\n *\n * Spread through `ownedElsewhere`: the pin lives in the image build rather than\n * in any manifest, so nothing is installed into the workspace. Left undeclared\n * these would be the only vended versions never upgraded — and they are\n * precisely the ones held at a version clear of a known HIGH/CRITICAL\n * vulnerability.\n */\nexport const NODE_IMAGE_DEPENDENCIES = [\n { name: 'npm' },\n { name: 'minimatch' },\n] as const satisfies readonly { name: ITsDepVersion }[];\n\n/**\n * Packages the AWS Distro for OpenTelemetry install in a vended `Dockerfile`\n * pins, for the images that auto-instrument with it. Spread through\n * `ownedElsewhere` for the same reason as {@link NODE_IMAGE_DEPENDENCIES}.\n */\nexport const ADOT_IMAGE_DEPENDENCIES = [\n { name: '@aws/aws-distro-opentelemetry-node-autoinstrumentation' },\n { name: '@opentelemetry/propagator-jaeger' },\n] as const satisfies readonly { name: ITsDepVersion }[];\n\nexport interface DockerScanTargetOptions {\n /**\n * Project configuration to add the scan target to (mutated in place).\n */\n readonly project: ProjectConfiguration;\n /**\n * Container engine command to invoke (\\`docker\\` or \\`finch\\`).\n */\n readonly containerEngine: string;\n /**\n * Name of the scan target to add, e.g. \\`my-agent-trivy\\`.\n */\n readonly trivyTargetName: string;\n /**\n * Name of the docker target that builds the image(s) to scan. The scan\n * target depends on it.\n */\n readonly dockerTargetName: string;\n /**\n * Tags of the images built by the docker target which should be scanned.\n */\n readonly imageTags: string[];\n}\n\n/**\n * Add a Trivy scan target for the images built by a docker target and wire it\n * under the aggregate \\`trivy\\` target. The scan is not part of \\`build\\` — run\n * \\`nx run-many --target trivy\\` (the root \\`trivy\\` script) in CI.\n *\n * The scan target depends on the docker target and is not cacheable, because\n * what it scans lives in the container engine rather than under its \\`outputs\\`.\n * Each image is saved to a tarball under \\`dist/<projectRoot>/trivy/<scan-key>\\`\n * (kept out of any Docker build context) and scanned with the pinned ECR-hosted\n * Trivy image via a workspace-relative bind mount, so the same commands work\n * under both docker and finch. The scan exits non-zero (exit code 1) on\n * HIGH/CRITICAL vulnerabilities.\n *\n * A \\`.trivyignore\\` is vended at the project root (kept if it already exists)\n * for suppressing findings.\n */\nexport const addDockerScanTarget = <const D extends DependencyDeclaration>(\n tree: Tree,\n options: DockerScanTargetOptions,\n declaration: D & MustDeclare<typeof DOCKER_DEPENDENCIES, D>,\n): void => {\n const { project, containerEngine, trivyTargetName, dockerTargetName } =\n options;\n const { imageTags } = options;\n const projectRoot = project.root;\n\n const ignoreFilePath = joinPathFragments(projectRoot, TRIVY_IGNORE_FILE);\n if (!tree.exists(ignoreFilePath)) {\n tree.write(ignoreFilePath, TRIVY_IGNORE_CONTENTS);\n }\n\n // Stage scan artifacts in a directory unique to this scan target so that\n // sibling targets in the same project (e.g. multiple agents) don't clobber\n // each other's tarballs when run in parallel. The first image tag is unique\n // per target, so it makes a stable, collision-free key.\n const scanKey = imageTags[0].replace(/[^a-zA-Z0-9-]/g, '-');\n const scanDir = joinPathFragments('dist', projectRoot, 'trivy', scanKey);\n const trivyImage = containerImage('trivy');\n\n const fs = new FsCommands(\n tree,\n forDependencies<typeof DOCKER_DEPENDENCIES>(declaration),\n );\n const commands = [\n fs.rm(scanDir),\n fs.mkdir(scanDir),\n fs.cpFile(ignoreFilePath, joinPathFragments(scanDir, TRIVY_IGNORE_FILE)),\n ];\n\n imageTags.forEach((imageTag, index) => {\n const tarName = `image-${index}.tar`;\n commands.push(\n `${containerEngine} save -o ${joinPathFragments(scanDir, tarName)} ${imageTag}`,\n `${containerEngine} run --rm -v \"./${scanDir}\":/scan ${trivyImage} image --input /scan/${tarName} --ignorefile /scan/${TRIVY_IGNORE_FILE} --scanners vuln --severity HIGH,CRITICAL --ignore-unfixed --exit-code 1 --no-progress -q`,\n );\n });\n\n project.targets ??= {};\n project.targets[trivyTargetName] = {\n // The image being scanned is only reachable through the container engine,\n // so a restored cache entry would report a pass for an image that may no\n // longer exist. The scan re-runs and either scans the real image or fails.\n // Nx only hashes a cacheable task, so declaring `inputs` here would have no\n // effect.\n cache: false,\n outputs: [`{workspaceRoot}/${scanDir}`],\n executor: 'nx:run-commands',\n options: {\n commands,\n parallel: false,\n },\n dependsOn: [dockerTargetName],\n };\n\n // Aggregate per-component scan targets under a single `trivy` target. The\n // scan is intentionally NOT wired into `build`: image scanning is slow and\n // its result depends on the ever-changing vulnerability database (a scan\n // that passes today can fail tomorrow when a new CVE is published), so\n // coupling it to `build` would make local and CI builds non-deterministic.\n // Run `nx run-many --target trivy` (the root `trivy` script) in CI instead.\n if (trivyTargetName !== 'trivy') {\n addDependencyToTargetIfNotPresent(project, 'trivy', trivyTargetName);\n }\n};\n"],"names":["joinPathFragments","forDependencies","FS_DEPENDENCIES","FsCommands","addDependencyToTargetIfNotPresent","containerImage","TS_VERSIONS","DOCKER_DEPENDENCIES","IMAGE_BUILD_CACHE","TRIVY_IGNORE_FILE","TRIVY_IGNORE_CONTENTS","nodeImageVersions","npmVersion","npm","minimatchVersion","minimatch","NODE_IMAGE_DEPENDENCIES","name","ADOT_IMAGE_DEPENDENCIES","addDockerScanTarget","tree","options","declaration","project","containerEngine","trivyTargetName","dockerTargetName","imageTags","projectRoot","root","ignoreFilePath","exists","write","scanKey","replace","scanDir","trivyImage","fs","commands","rm","mkdir","cpFile","forEach","imageTag","index","tarName","push","targets","cache","outputs","executor","parallel","dependsOn"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,QAGZ,aAAa;AACp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AChE,MAAMG,aAAa/B,eAAe;IAElC,MAAMgC,KAAK,IAAIlC,WACbiB,MACAnB,gBAA4CqB;IAE9C,MAAMgB,WAAW;QACfD,GAAGE,EAAE,CAACJ;QACNE,GAAGG,KAAK,CAACL;QACTE,GAAGI,MAAM,CAACX,gBAAgB9B,kBAAkBmC,SAAS1B;KACtD;IAEDkB,UAAUe,OAAO,CAAC,CAACC,UAAUC;QAC3B,MAAMC,UAAU,CAAC,MAAM,EAAED,MAAM,IAAI,CAAC;QACpCN,SAASQ,IAAI,CACX,GAAGtB,gBAAgB,SAAS,EAAExB,kBAAkBmC,SAASU,SAAS,CAAC,EAAEF,UAAU,EAC/E,GAAGnB,gBAAgB,gBAAgB,EAAEW,QAAQ,QAAQ,EAAEC,WAAW,qBAAqB,EAAES,QAAQ,oBAAoB,EAAEpC,kBAAkB,yFAAyF,CAAC;IAEvO;IAEAc,QAAQwB,OAAO,KAAK,CAAC;IACrBxB,QAAQwB,OAAO,CAACtB,gBAAgB,GAAG;QACjC,0EAA0E;QAC1E,yEAAyE;QACzE,2EAA2E;QAC3E,4EAA4E;QAC5E,UAAU;QACVuB,OAAO;QACPC,SAAS;YAAC,CAAC,gBAAgB,EAAEd,SAAS;SAAC;QACvCe,UAAU;QACV7B,SAAS;YACPiB;YACAa,UAAU;QACZ;QACAC,WAAW;YAAC1B;SAAiB;IAC/B;IAEA,0EAA0E;IAC1E,2EAA2E;IAC3E,yEAAyE;IACzE,uEAAuE;IACvE,2EAA2E;IAC3E,4EAA4E;IAC5E,IAAID,oBAAoB,SAAS;QAC/BrB,kCAAkCmB,SAAS,SAASE;IACtD;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/docker.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n joinPathFragments,\n type ProjectConfiguration,\n type Tree,\n} from '@nx/devkit';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from './declared-dependencies.js';\nimport { FS_DEPENDENCIES, FsCommands } from './fs.js';\nimport {\n addDependencyToTargetIfNotPresent,\n normalizeTargetKeyOrder,\n} from './nx.js';\nimport { containerImage, type ITsDepVersion, TS_VERSIONS } from './versions.js';\n\n/** Dependencies a caller must declare to add a Docker scan target. */\nexport const DOCKER_DEPENDENCIES = [...FS_DEPENDENCIES] as const;\n\n/**\n * The `cache` setting every target that builds a container image must use.\n *\n * A built image lives in the container engine's own store, not under any\n * `outputs` path, so Nx has nothing to restore a cache hit from: it would\n * report the build complete while the image is missing, and the `trivy` scan\n * that depends on it would report a cached pass against an image that isn't\n * there. The container engine's layer cache is the sound cache here — it is\n * keyed on the build context and lives alongside the image, so an unchanged\n * context rebuilds in well under a second and always leaves the image present.\n */\nexport const IMAGE_BUILD_CACHE = false;\n\nconst TRIVY_IGNORE_FILE = '.trivyignore';\n\nconst TRIVY_IGNORE_CONTENTS = `# Trivy ignore file. Add one vulnerability ID (e.g. CVE-2021-12345) per line to\n# suppress it during the image scan (\\`nx run-many --target trivy\\`).\n# https://trivy.dev/latest/docs/configuration/filtering/#by-finding-ids\n`;\n\n/**\n * Substitution variables for the vended Node `Dockerfile` templates: the npm\n * version to install globally, and the versions its dependency overrides pin.\n */\nexport const nodeImageVersions = () => ({\n npmVersion: TS_VERSIONS.npm,\n minimatchVersion: TS_VERSIONS.minimatch,\n});\n\n/**\n * Packages a vended Node `Dockerfile` pins, which every generator writing one\n * must declare so the version sync keeps those pins current.\n *\n * Spread through `ownedElsewhere`: the pin lives in the image build rather than\n * in any manifest, so nothing is installed into the workspace. Left undeclared\n * these would be the only vended versions never upgraded — and they are\n * precisely the ones held at a version clear of a known HIGH/CRITICAL\n * vulnerability.\n */\nexport const NODE_IMAGE_DEPENDENCIES = [\n { name: 'npm' },\n { name: 'minimatch' },\n] as const satisfies readonly { name: ITsDepVersion }[];\n\n/**\n * Packages the prisma CLI install in a vended RDB migration `Dockerfile` pins.\n * The CLI's own ranges resolve both below a known HIGH vulnerability's fix, so\n * the image overrides them. Spread through `ownedElsewhere` for the same reason\n * as {@link NODE_IMAGE_DEPENDENCIES}.\n */\nexport const PRISMA_IMAGE_DEPENDENCIES = [\n { name: 'deepmerge-ts' },\n { name: 'mysql2' },\n] as const satisfies readonly { name: ITsDepVersion }[];\n\n/**\n * Packages the AWS Distro for OpenTelemetry install in a vended `Dockerfile`\n * pins, for the images that auto-instrument with it. Spread through\n * `ownedElsewhere` for the same reason as {@link NODE_IMAGE_DEPENDENCIES}.\n */\nexport const ADOT_IMAGE_DEPENDENCIES = [\n { name: '@aws/aws-distro-opentelemetry-node-autoinstrumentation' },\n { name: '@opentelemetry/propagator-jaeger' },\n] as const satisfies readonly { name: ITsDepVersion }[];\n\nexport interface DockerScanTargetOptions {\n /**\n * Project configuration to add the scan target to (mutated in place).\n */\n readonly project: ProjectConfiguration;\n /**\n * Container engine command to invoke (\\`docker\\` or \\`finch\\`).\n */\n readonly containerEngine: string;\n /**\n * Name of the scan target to add, e.g. \\`my-agent-trivy\\`.\n */\n readonly trivyTargetName: string;\n /**\n * Name of the docker target that builds the image(s) to scan. The scan\n * target depends on it.\n */\n readonly dockerTargetName: string;\n /**\n * Tags of the images built by the docker target which should be scanned.\n */\n readonly imageTags: string[];\n}\n\n/**\n * Add a Trivy scan target for the images built by a docker target and wire it\n * under the aggregate \\`trivy\\` target. The scan is not part of \\`build\\` — run\n * \\`nx run-many --target trivy\\` (the root \\`trivy\\` script) in CI.\n *\n * The scan target depends on the docker target and is not cacheable, because\n * what it scans lives in the container engine rather than under its \\`outputs\\`.\n * Each image is saved to a tarball under \\`dist/<projectRoot>/trivy/<scan-key>\\`\n * (kept out of any Docker build context) and scanned with the pinned ECR-hosted\n * Trivy image via a workspace-relative bind mount, so the same commands work\n * under both docker and finch. The scan exits non-zero (exit code 1) on\n * HIGH/CRITICAL vulnerabilities.\n *\n * A \\`.trivyignore\\` is vended at the project root (kept if it already exists)\n * for suppressing findings.\n */\nexport const addDockerScanTarget = <const D extends DependencyDeclaration>(\n tree: Tree,\n options: DockerScanTargetOptions,\n declaration: D & MustDeclare<typeof DOCKER_DEPENDENCIES, D>,\n): void => {\n const { project, containerEngine, trivyTargetName, dockerTargetName } =\n options;\n const { imageTags } = options;\n const projectRoot = project.root;\n\n const ignoreFilePath = joinPathFragments(projectRoot, TRIVY_IGNORE_FILE);\n if (!tree.exists(ignoreFilePath)) {\n tree.write(ignoreFilePath, TRIVY_IGNORE_CONTENTS);\n }\n\n // Stage scan artifacts in a directory unique to this scan target so that\n // sibling targets in the same project (e.g. multiple agents) don't clobber\n // each other's tarballs when run in parallel. The first image tag is unique\n // per target, so it makes a stable, collision-free key.\n const scanKey = imageTags[0].replace(/[^a-zA-Z0-9-]/g, '-');\n const scanDir = joinPathFragments('dist', projectRoot, 'trivy', scanKey);\n const trivyImage = containerImage('trivy');\n\n const fs = new FsCommands(\n tree,\n forDependencies<typeof DOCKER_DEPENDENCIES>(declaration),\n );\n const commands = [\n fs.rm(scanDir),\n fs.mkdir(scanDir),\n fs.cpFile(ignoreFilePath, joinPathFragments(scanDir, TRIVY_IGNORE_FILE)),\n ];\n\n imageTags.forEach((imageTag, index) => {\n const tarName = `image-${index}.tar`;\n commands.push(\n `${containerEngine} save -o ${joinPathFragments(scanDir, tarName)} ${imageTag}`,\n `${containerEngine} run --rm -v \"./${scanDir}\":/scan ${trivyImage} image --input /scan/${tarName} --ignorefile /scan/${TRIVY_IGNORE_FILE} --scanners vuln --severity HIGH,CRITICAL --ignore-unfixed --exit-code 1 --no-progress -q`,\n );\n });\n\n project.targets ??= {};\n project.targets[trivyTargetName] = normalizeTargetKeyOrder({\n // The image being scanned is only reachable through the container engine,\n // so a restored cache entry would report a pass for an image that may no\n // longer exist. The scan re-runs and either scans the real image or fails.\n // Nx only hashes a cacheable task, so declaring `inputs` here would have no\n // effect.\n cache: false,\n outputs: [`{workspaceRoot}/${scanDir}`],\n executor: 'nx:run-commands',\n options: {\n commands,\n parallel: false,\n },\n dependsOn: [dockerTargetName],\n });\n\n // Aggregate per-component scan targets under a single `trivy` target. The\n // scan is intentionally NOT wired into `build`: image scanning is slow and\n // its result depends on the ever-changing vulnerability database (a scan\n // that passes today can fail tomorrow when a new CVE is published), so\n // coupling it to `build` would make local and CI builds non-deterministic.\n // Run `nx run-many --target trivy` (the root `trivy` script) in CI instead.\n if (trivyTargetName !== 'trivy') {\n addDependencyToTargetIfNotPresent(project, 'trivy', trivyTargetName);\n }\n};\n"],"names":["joinPathFragments","forDependencies","FS_DEPENDENCIES","FsCommands","addDependencyToTargetIfNotPresent","normalizeTargetKeyOrder","containerImage","TS_VERSIONS","DOCKER_DEPENDENCIES","IMAGE_BUILD_CACHE","TRIVY_IGNORE_FILE","TRIVY_IGNORE_CONTENTS","nodeImageVersions","npmVersion","npm","minimatchVersion","minimatch","NODE_IMAGE_DEPENDENCIES","name","PRISMA_IMAGE_DEPENDENCIES","ADOT_IMAGE_DEPENDENCIES","addDockerScanTarget","tree","options","declaration","project","containerEngine","trivyTargetName","dockerTargetName","imageTags","projectRoot","root","ignoreFilePath","exists","write","scanKey","replace","scanDir","trivyImage","fs","commands","rm","mkdir","cpFile","forEach","imageTag","index","tarName","push","targets","cache","outputs","executor","parallel","dependsOn"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,QAGZ,aAAa;AACpB,SAEEC,eAAe,QAEV,6BAA6B;AACpC,SAASC,eAAe,EAAEC,UAAU,QAAQ,UAAU;AACtD,SACEC,iCAAiC,EACjCC,uBAAuB,QAClB,UAAU;AACjB,SAASC,cAAc,EAAsBC,WAAW,QAAQ,gBAAgB;AAEhF,oEAAoE,GACpE,OAAO,MAAMC,sBAAsB;OAAIN;CAAgB,CAAU;AAEjE;;;;;;;;;;CAUC,GACD,OAAO,MAAMO,oBAAoB,MAAM;AAEvC,MAAMC,oBAAoB;AAE1B,MAAMC,wBAAwB,CAAC;;;AAG/B,CAAC;AAED;;;CAGC,GACD,OAA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,MAAMC,UAAU,CAAC,MAAM,EAAED,MAAM,IAAI,CAAC;QACpCN,SAASQ,IAAI,CACX,GAAGtB,gBAAgB,SAAS,EAAE1B,kBAAkBqC,SAASU,SAAS,CAAC,EAAEF,UAAU,EAC/E,GAAGnB,gBAAgB,gBAAgB,EAAEW,QAAQ,QAAQ,EAAEC,WAAW,qBAAqB,EAAES,QAAQ,oBAAoB,EAAErC,kBAAkB,yFAAyF,CAAC;IAEvO;IAEAe,QAAQwB,OAAO,KAAK,CAAC;IACrBxB,QAAQwB,OAAO,CAACtB,gBAAgB,GAAGtB,wBAAwB;QACzD,0EAA0E;QAC1E,yEAAyE;QACzE,2EAA2E;QAC3E,4EAA4E;QAC5E,UAAU;QACV6C,OAAO;QACPC,SAAS;YAAC,CAAC,gBAAgB,EAAEd,SAAS;SAAC;QACvCe,UAAU;QACV7B,SAAS;YACPiB;YACAa,UAAU;QACZ;QACAC,WAAW;YAAC1B;SAAiB;IAC/B;IAEA,0EAA0E;IAC1E,2EAA2E;IAC3E,yEAAyE;IACzE,uEAAuE;IACvE,2EAA2E;IAC3E,4EAA4E;IAC5E,IAAID,oBAAoB,SAAS;QAC/BvB,kCAAkCqB,SAAS,SAASE;IACtD;AACF,EAAE"}
@@ -0,0 +1,48 @@
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
+ /** A Global Secondary Index as `config.json` declares it. */
7
+ export interface DynamoDBGlobalSecondaryIndex {
8
+ readonly indexName: string;
9
+ readonly partitionKey: string;
10
+ readonly sortKey?: string;
11
+ }
12
+ export interface DynamoDBLocalDevConfig {
13
+ readonly port: number;
14
+ readonly tableName: string;
15
+ readonly image: string;
16
+ readonly containerName: string;
17
+ readonly containerEngine: string;
18
+ }
19
+ export interface DynamoDBConfig {
20
+ runtimeConfigKey: string;
21
+ localDev: DynamoDBLocalDevConfig;
22
+ tableConfig: {
23
+ globalSecondaryIndexes: DynamoDBGlobalSecondaryIndex[];
24
+ };
25
+ }
26
+ /** The image the local DynamoDB container runs. */
27
+ export declare const DYNAMODB_LOCAL_IMAGE = "public.ecr.aws/aws-dynamodb-local/aws-dynamodb-local:latest";
28
+ /**
29
+ * The two overloadable GSIs a new table starts with, following the single-table
30
+ * design naming convention the guides describe.
31
+ */
32
+ export declare const DEFAULT_GLOBAL_SECONDARY_INDEXES: DynamoDBGlobalSecondaryIndex[];
33
+ /**
34
+ * Write a DynamoDB project's `config.json`.
35
+ *
36
+ * The file has two halves with different owners, so it is merged rather than
37
+ * re-emitted whole:
38
+ *
39
+ * - `runtimeConfigKey` and `localDev` are derived from the generator's options,
40
+ * so they converge on a re-run — changing `--tableName` still takes effect.
41
+ * - `tableConfig.globalSecondaryIndexes` is the user's, since the guides tell
42
+ * them to add an entry per GSI. The defaults seed a new project; an existing
43
+ * list is carried through untouched.
44
+ */
45
+ export declare const writeDynamoDBConfig: (tree: Tree, projectRoot: string, config: {
46
+ runtimeConfigKey: string;
47
+ localDev: DynamoDBLocalDevConfig;
48
+ }) => void;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */ import { joinPathFragments, readJson, writeJson } from "@nx/devkit";
5
+ /** The image the local DynamoDB container runs. */ export const DYNAMODB_LOCAL_IMAGE = 'public.ecr.aws/aws-dynamodb-local/aws-dynamodb-local:latest';
6
+ /**
7
+ * The two overloadable GSIs a new table starts with, following the single-table
8
+ * design naming convention the guides describe.
9
+ */ export const DEFAULT_GLOBAL_SECONDARY_INDEXES = [
10
+ {
11
+ indexName: 'gsi1pk-gsi1sk-index',
12
+ partitionKey: 'gsi1pk',
13
+ sortKey: 'gsi1sk'
14
+ },
15
+ {
16
+ indexName: 'gsi2pk-gsi2sk-index',
17
+ partitionKey: 'gsi2pk',
18
+ sortKey: 'gsi2sk'
19
+ }
20
+ ];
21
+ /**
22
+ * Write a DynamoDB project's `config.json`.
23
+ *
24
+ * The file has two halves with different owners, so it is merged rather than
25
+ * re-emitted whole:
26
+ *
27
+ * - `runtimeConfigKey` and `localDev` are derived from the generator's options,
28
+ * so they converge on a re-run — changing `--tableName` still takes effect.
29
+ * - `tableConfig.globalSecondaryIndexes` is the user's, since the guides tell
30
+ * them to add an entry per GSI. The defaults seed a new project; an existing
31
+ * list is carried through untouched.
32
+ */ export const writeDynamoDBConfig = (tree, projectRoot, config)=>{
33
+ const configPath = joinPathFragments(projectRoot, 'config.json');
34
+ const existing = tree.exists(configPath) ? readJson(tree, configPath) : {};
35
+ writeJson(tree, configPath, {
36
+ runtimeConfigKey: config.runtimeConfigKey,
37
+ localDev: config.localDev,
38
+ tableConfig: {
39
+ globalSecondaryIndexes: existing.tableConfig?.globalSecondaryIndexes ?? DEFAULT_GLOBAL_SECONDARY_INDEXES
40
+ }
41
+ });
42
+ };
43
+
44
+ //# sourceMappingURL=dynamodb-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/dynamodb-config.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { joinPathFragments, readJson, type Tree, writeJson } from '@nx/devkit';\n\n/** A Global Secondary Index as `config.json` declares it. */\nexport interface DynamoDBGlobalSecondaryIndex {\n readonly indexName: string;\n readonly partitionKey: string;\n readonly sortKey?: string;\n}\n\nexport interface DynamoDBLocalDevConfig {\n readonly port: number;\n readonly tableName: string;\n readonly image: string;\n readonly containerName: string;\n readonly containerEngine: string;\n}\n\nexport interface DynamoDBConfig {\n runtimeConfigKey: string;\n localDev: DynamoDBLocalDevConfig;\n tableConfig: { globalSecondaryIndexes: DynamoDBGlobalSecondaryIndex[] };\n}\n\n/** The image the local DynamoDB container runs. */\nexport const DYNAMODB_LOCAL_IMAGE =\n 'public.ecr.aws/aws-dynamodb-local/aws-dynamodb-local:latest';\n\n/**\n * The two overloadable GSIs a new table starts with, following the single-table\n * design naming convention the guides describe.\n */\nexport const DEFAULT_GLOBAL_SECONDARY_INDEXES: DynamoDBGlobalSecondaryIndex[] =\n [\n {\n indexName: 'gsi1pk-gsi1sk-index',\n partitionKey: 'gsi1pk',\n sortKey: 'gsi1sk',\n },\n {\n indexName: 'gsi2pk-gsi2sk-index',\n partitionKey: 'gsi2pk',\n sortKey: 'gsi2sk',\n },\n ];\n\n/**\n * Write a DynamoDB project's `config.json`.\n *\n * The file has two halves with different owners, so it is merged rather than\n * re-emitted whole:\n *\n * - `runtimeConfigKey` and `localDev` are derived from the generator's options,\n * so they converge on a re-run — changing `--tableName` still takes effect.\n * - `tableConfig.globalSecondaryIndexes` is the user's, since the guides tell\n * them to add an entry per GSI. The defaults seed a new project; an existing\n * list is carried through untouched.\n */\nexport const writeDynamoDBConfig = (\n tree: Tree,\n projectRoot: string,\n config: {\n runtimeConfigKey: string;\n localDev: DynamoDBLocalDevConfig;\n },\n): void => {\n const configPath = joinPathFragments(projectRoot, 'config.json');\n const existing: Partial<DynamoDBConfig> = tree.exists(configPath)\n ? readJson(tree, configPath)\n : {};\n\n writeJson(tree, configPath, {\n runtimeConfigKey: config.runtimeConfigKey,\n localDev: config.localDev,\n tableConfig: {\n globalSecondaryIndexes:\n existing.tableConfig?.globalSecondaryIndexes ??\n DEFAULT_GLOBAL_SECONDARY_INDEXES,\n },\n } satisfies DynamoDBConfig);\n};\n"],"names":["joinPathFragments","readJson","writeJson","DYNAMODB_LOCAL_IMAGE","DEFAULT_GLOBAL_SECONDARY_INDEXES","indexName","partitionKey","sortKey","writeDynamoDBConfig","tree","projectRoot","config","configPath","existing","exists","runtimeConfigKey","localDev","tableConfig","globalSecondaryIndexes"],"mappings":"AAAA;;;CAGC,GACD,SAASA,iBAAiB,EAAEC,QAAQ,EAAaC,SAAS,QAAQ,aAAa;AAuB/E,iDAAiD,GACjD,OAAO,MAAMC,uBACX,8DAA8D;AAEhE;;;CAGC,GACD,OAAO,MAAMC,mCACX;IACE;QACEC,WAAW;QACXC,cAAc;QACdC,SAAS;IACX;IACA;QACEF,WAAW;QACXC,cAAc;QACdC,SAAS;IACX;CACD,CAAC;AAEJ;;;;;;;;;;;CAWC,GACD,OAAO,MAAMC,sBAAsB,CACjCC,MACAC,aACAC;IAKA,MAAMC,aAAaZ,kBAAkBU,aAAa;IAClD,MAAMG,WAAoCJ,KAAKK,MAAM,CAACF,cAClDX,SAASQ,MAAMG,cACf,CAAC;IAELV,UAAUO,MAAMG,YAAY;QAC1BG,kBAAkBJ,OAAOI,gBAAgB;QACzCC,UAAUL,OAAOK,QAAQ;QACzBC,aAAa;YACXC,wBACEL,SAASI,WAAW,EAAEC,0BACtBd;QACJ;IACF;AACF,EAAE"}
@@ -1,8 +1,12 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { AttributeType, ProjectionType } from 'aws-cdk-lib/aws-dynamodb';
3
+ <%_ /* Alias the core imports only when this table's name would shadow them. */ _%>
4
+ <%_ const collides = nameClassName === 'DynamoDBTable'; _%>
5
+ <%_ const coreTable = collides ? 'CoreDynamoDBTable' : 'DynamoDBTable'; _%>
6
+ <%_ const coreTableProps = collides ? 'CoreDynamoDBTableProps' : 'DynamoDBTableProps'; _%>
3
7
  import {
4
- DynamoDBTable,
5
- DynamoDBTableProps,
8
+ DynamoDBTable<% if (collides) { %> as <%= coreTable %><% } %>,
9
+ DynamoDBTableProps<% if (collides) { %> as <%= coreTableProps %><% } %>,
6
10
  } from '../../core/dynamodb<% if (esm) { %>.js<% } %>';
7
11
  import { findWorkspaceRoot } from '../../core/workspace<% if (esm) { %>.js<% } %>';
8
12
  import { readFileSync } from 'fs';
@@ -20,11 +24,11 @@ const { runtimeConfigKey, tableConfig } = JSON.parse(
20
24
  ) as { runtimeConfigKey: string; tableConfig: { globalSecondaryIndexes: { indexName: string; partitionKey: string; sortKey?: string }[] } };
21
25
 
22
26
  export type <%= nameClassName %>Props = Omit<
23
- DynamoDBTableProps,
27
+ <%= coreTableProps %>,
24
28
  'runtimeConfigKey'
25
29
  >;
26
30
 
27
- export class <%= nameClassName %> extends DynamoDBTable {
31
+ export class <%= nameClassName %> extends <%= coreTable %> {
28
32
  constructor(scope: Construct, id: string, props?: <%= nameClassName %>Props) {
29
33
  super(scope, id, {
30
34
  ...props,
@@ -1,7 +1,6 @@
1
1
  import * as React from "react"
2
2
  import { cva, type VariantProps } from "class-variance-authority"
3
-
4
- import { cn } from "#lib/utils"
3
+ import { cn } from "cn"
5
4
 
6
5
  const alertVariants = cva(
7
6
  "relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
@@ -1,10 +1,9 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from "react"
4
+ import { cn } from "cn"
4
5
  import { Avatar as AvatarPrimitive } from "radix-ui"
5
6
 
6
- import { cn } from "#lib/utils"
7
-
8
7
  function Avatar({
9
8
  className,
10
9
  size = "default",
@@ -1,9 +1,8 @@
1
1
  import * as React from "react"
2
+ import { cn } from "cn"
2
3
  import { ChevronRight, MoreHorizontal } from "lucide-react"
3
4
  import { Slot } from "radix-ui"
4
5
 
5
- import { cn } from "#lib/utils"
6
-
7
6
  function Breadcrumb({ ...props }: React.ComponentProps<"nav">) {
8
7
  return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />
9
8
  }
@@ -1,9 +1,8 @@
1
1
  import * as React from "react"
2
2
  import { cva, type VariantProps } from "class-variance-authority"
3
+ import { cn } from "cn"
3
4
  import { Slot } from "radix-ui"
4
5
 
5
- import { cn } from "#lib/utils"
6
-
7
6
  const buttonVariants = cva(
8
7
  "inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
9
8
  {
@@ -1,6 +1,5 @@
1
1
  import * as React from "react"
2
-
3
- import { cn } from "#lib/utils"
2
+ import { cn } from "cn"
4
3
 
5
4
  function Card({ className, ...props }: React.ComponentProps<"div">) {
6
5
  return (
@@ -1,6 +1,5 @@
1
1
  import * as React from "react"
2
-
3
- import { cn } from "#lib/utils"
2
+ import { cn } from "cn"
4
3
 
5
4
  function Input({ className, type, ...props }: React.ComponentProps<"input">) {
6
5
  return (
@@ -1,10 +1,9 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from "react"
4
+ import { cn } from "cn"
4
5
  import { Separator as SeparatorPrimitive } from "radix-ui"
5
6
 
6
- import { cn } from "#lib/utils"
7
-
8
7
  function Separator({
9
8
  className,
10
9
  orientation = "horizontal",
@@ -1,11 +1,10 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from "react"
4
+ import { cn } from "cn"
4
5
  import { XIcon } from "lucide-react"
5
6
  import { Dialog as SheetPrimitive } from "radix-ui"
6
7
 
7
- import { cn } from "#lib/utils"
8
-
9
8
  function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
10
9
  return <SheetPrimitive.Root data-slot="sheet" {...props} />
11
10
  }
@@ -2,11 +2,11 @@
2
2
 
3
3
  import * as React from "react"
4
4
  import { cva, type VariantProps } from "class-variance-authority"
5
+ import { cn } from "cn"
5
6
  import { PanelLeftIcon } from "lucide-react"
6
7
  import { Slot } from "radix-ui"
7
8
 
8
9
  import { useIsMobile } from "#hooks/use-mobile"
9
- import { cn } from "#lib/utils"
10
10
  import { Button } from "#components/ui/button"
11
11
  import { Input } from "#components/ui/input"
12
12
  import { Separator } from "#components/ui/separator"
@@ -1,4 +1,4 @@
1
- import { cn } from "#lib/utils"
1
+ import { cn } from "cn"
2
2
 
3
3
  function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
4
4
  return (
@@ -1,7 +1,6 @@
1
+ import { cn } from "cn"
1
2
  import { Loader2Icon } from "lucide-react"
2
3
 
3
- import { cn } from "#lib/utils"
4
-
5
4
  function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
6
5
  return (
7
6
  <Loader2Icon
@@ -1,6 +1,5 @@
1
1
  import * as React from "react"
2
-
3
- import { cn } from "#lib/utils"
2
+ import { cn } from "cn"
4
3
 
5
4
  function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
6
5
  return (
@@ -1,10 +1,9 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from "react"
4
+ import { cn } from "cn"
4
5
  import { Tooltip as TooltipPrimitive } from "radix-ui"
5
6
 
6
- import { cn } from "#lib/utils"
7
-
8
7
  function TooltipProvider({
9
8
  delayDuration = 0,
10
9
  ...props
@@ -1,6 +1 @@
1
- import { clsx, type ClassValue } from 'clsx';
2
- import { twMerge } from 'tailwind-merge';
3
-
4
- export function cn(...inputs: ClassValue[]) {
5
- return twMerge(clsx(inputs));
6
- }
1
+ export { cn } from 'cn';
@@ -0,0 +1,28 @@
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
+ import { type DependencyDeclaration, type MustDeclare } from './declared-dependencies.js';
7
+ /** Dependencies a caller must declare to set up git-secrets. */
8
+ export declare const GIT_SECRETS_DEPENDENCIES: readonly [{
9
+ readonly name: "husky";
10
+ }];
11
+ /** The vended script, which the husky pre-commit hook runs. */
12
+ export declare const GIT_SECRETS_SCRIPT = ".git-secrets/git-secrets";
13
+ /**
14
+ * Patterns allowed so a generated workspace commits cleanly, matched against
15
+ * `<path>:<line>:<content>`. Only the vended script, whose body contains the
16
+ * patterns it registers.
17
+ */
18
+ export declare const GIT_SECRETS_ALLOWED: string[];
19
+ /**
20
+ * Vend the git-secrets pre-commit hook: the script itself, the husky hook that
21
+ * runs it, and the allowlist.
22
+ *
23
+ * Re-runnable. The vendored script is always rewritten so an upgrade picks up a
24
+ * newer copy, while everything a user owns is preserved: `.gitallowed` only
25
+ * gains the entries a generated workspace needs, and an existing `pre-commit`
26
+ * hook or `prepare` script is left alone and reported rather than replaced.
27
+ */
28
+ export declare const setUpGitSecrets: <const D extends DependencyDeclaration>(tree: Tree, declaration: D & MustDeclare<typeof GIT_SECRETS_DEPENDENCIES, D>) => void;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */ import { joinPathFragments, logger, updateJson } from "@nx/devkit";
5
+ import { readFileSync } from "fs";
6
+ import { forDependencies } from "./declared-dependencies.js";
7
+ import { addDependenciesToPackageJson } from "./dependencies.js";
8
+ import { withVersions } from "./versions.js";
9
+ /** Dependencies a caller must declare to set up git-secrets. */ export const GIT_SECRETS_DEPENDENCIES = [
10
+ {
11
+ name: 'husky'
12
+ }
13
+ ];
14
+ /** The vended script, which the husky pre-commit hook runs. */ export const GIT_SECRETS_SCRIPT = '.git-secrets/git-secrets';
15
+ const HUSKY_PRE_COMMIT = '.husky/pre-commit';
16
+ /**
17
+ * Patterns allowed so a generated workspace commits cleanly, matched against
18
+ * `<path>:<line>:<content>`. Only the vended script, whose body contains the
19
+ * patterns it registers.
20
+ */ export const GIT_SECRETS_ALLOWED = [
21
+ '\\.git-secrets/git-secrets:'
22
+ ];
23
+ /**
24
+ * Vend the git-secrets pre-commit hook: the script itself, the husky hook that
25
+ * runs it, and the allowlist.
26
+ *
27
+ * Re-runnable. The vendored script is always rewritten so an upgrade picks up a
28
+ * newer copy, while everything a user owns is preserved: `.gitallowed` only
29
+ * gains the entries a generated workspace needs, and an existing `pre-commit`
30
+ * hook or `prepare` script is left alone and reported rather than replaced.
31
+ */ export const setUpGitSecrets = (tree, declaration)=>{
32
+ const filesDir = joinPathFragments(import.meta.dirname, '..', 'preset', 'git-secrets-files');
33
+ tree.write(GIT_SECRETS_SCRIPT, readFileSync(joinPathFragments(filesDir, 'git-secrets-dir', 'git-secrets'), 'utf-8'));
34
+ const hook = readFileSync(joinPathFragments(filesDir, 'husky-dir', 'pre-commit'), 'utf-8');
35
+ const existingHook = tree.read(HUSKY_PRE_COMMIT, 'utf-8');
36
+ if (existingHook === null) {
37
+ tree.write(HUSKY_PRE_COMMIT, hook);
38
+ } else if (!existingHook.includes(GIT_SECRETS_SCRIPT)) {
39
+ logger.warn(`Your ${HUSKY_PRE_COMMIT} was left as-is. To scan staged files for AWS credentials, add:\n\n${hook}`);
40
+ }
41
+ // Preserve any entries the user has added, appending only the ones missing.
42
+ const existingAllowed = tree.read('.gitallowed', 'utf-8')?.split('\n').map((line)=>line.trimEnd()).filter((line)=>line !== '') ?? [];
43
+ const allowed = [
44
+ ...existingAllowed,
45
+ ...GIT_SECRETS_ALLOWED.filter((pattern)=>!existingAllowed.includes(pattern))
46
+ ];
47
+ tree.write('.gitallowed', `${allowed.join('\n')}\n`);
48
+ updateJson(tree, 'package.json', (json)=>{
49
+ const prepare = json.scripts?.prepare;
50
+ if (prepare !== undefined && !prepare.includes('husky')) {
51
+ logger.warn(`Your \`prepare\` script was left as-is. Git hooks are installed by husky, so add \`husky\` to it for the pre-commit hook to run.`);
52
+ }
53
+ return {
54
+ ...json,
55
+ scripts: {
56
+ ...json.scripts,
57
+ prepare: prepare ?? 'husky'
58
+ }
59
+ };
60
+ });
61
+ addDependenciesToPackageJson(tree, {}, withVersions(forDependencies(declaration), [
62
+ 'husky'
63
+ ]));
64
+ };
65
+
66
+ //# sourceMappingURL=git-secrets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/git-secrets.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 { readFileSync } from 'fs';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from './declared-dependencies.js';\nimport { addDependenciesToPackageJson } from './dependencies.js';\nimport { type ITsDepVersion, withVersions } from './versions.js';\n\n/** Dependencies a caller must declare to set up git-secrets. */\nexport const GIT_SECRETS_DEPENDENCIES = [\n { name: 'husky' },\n] as const satisfies readonly { name: ITsDepVersion }[];\n\n/** The vended script, which the husky pre-commit hook runs. */\nexport const GIT_SECRETS_SCRIPT = '.git-secrets/git-secrets';\n\nconst HUSKY_PRE_COMMIT = '.husky/pre-commit';\n\n/**\n * Patterns allowed so a generated workspace commits cleanly, matched against\n * `<path>:<line>:<content>`. Only the vended script, whose body contains the\n * patterns it registers.\n */\nexport const GIT_SECRETS_ALLOWED = ['\\\\.git-secrets/git-secrets:'];\n\n/**\n * Vend the git-secrets pre-commit hook: the script itself, the husky hook that\n * runs it, and the allowlist.\n *\n * Re-runnable. The vendored script is always rewritten so an upgrade picks up a\n * newer copy, while everything a user owns is preserved: `.gitallowed` only\n * gains the entries a generated workspace needs, and an existing `pre-commit`\n * hook or `prepare` script is left alone and reported rather than replaced.\n */\nexport const setUpGitSecrets = <const D extends DependencyDeclaration>(\n tree: Tree,\n declaration: D & MustDeclare<typeof GIT_SECRETS_DEPENDENCIES, D>,\n) => {\n const filesDir = joinPathFragments(\n import.meta.dirname,\n '..',\n 'preset',\n 'git-secrets-files',\n );\n\n tree.write(\n GIT_SECRETS_SCRIPT,\n readFileSync(\n joinPathFragments(filesDir, 'git-secrets-dir', 'git-secrets'),\n 'utf-8',\n ),\n );\n\n const hook = readFileSync(\n joinPathFragments(filesDir, 'husky-dir', 'pre-commit'),\n 'utf-8',\n );\n const existingHook = tree.read(HUSKY_PRE_COMMIT, 'utf-8');\n if (existingHook === null) {\n tree.write(HUSKY_PRE_COMMIT, hook);\n } else if (!existingHook.includes(GIT_SECRETS_SCRIPT)) {\n logger.warn(\n `Your ${HUSKY_PRE_COMMIT} was left as-is. To scan staged files for AWS credentials, add:\\n\\n${hook}`,\n );\n }\n\n // Preserve any entries the user has added, appending only the ones missing.\n const existingAllowed =\n tree\n .read('.gitallowed', 'utf-8')\n ?.split('\\n')\n .map((line) => line.trimEnd())\n .filter((line) => line !== '') ?? [];\n const allowed = [\n ...existingAllowed,\n ...GIT_SECRETS_ALLOWED.filter(\n (pattern) => !existingAllowed.includes(pattern),\n ),\n ];\n tree.write('.gitallowed', `${allowed.join('\\n')}\\n`);\n\n updateJson(tree, 'package.json', (json) => {\n const prepare: string | undefined = json.scripts?.prepare;\n if (prepare !== undefined && !prepare.includes('husky')) {\n logger.warn(\n `Your \\`prepare\\` script was left as-is. Git hooks are installed by husky, so add \\`husky\\` to it for the pre-commit hook to run.`,\n );\n }\n return {\n ...json,\n scripts: { ...json.scripts, prepare: prepare ?? 'husky' },\n };\n });\n\n addDependenciesToPackageJson(\n tree,\n {},\n withVersions(\n forDependencies<typeof GIT_SECRETS_DEPENDENCIES>(declaration),\n ['husky'],\n ),\n );\n};\n"],"names":["joinPathFragments","logger","updateJson","readFileSync","forDependencies","addDependenciesToPackageJson","withVersions","GIT_SECRETS_DEPENDENCIES","name","GIT_SECRETS_SCRIPT","HUSKY_PRE_COMMIT","GIT_SECRETS_ALLOWED","setUpGitSecrets","tree","declaration","filesDir","dirname","write","hook","existingHook","read","includes","warn","existingAllowed","split","map","line","trimEnd","filter","allowed","pattern","join","json","prepare","scripts","undefined"],"mappings":"AAAA;;;CAGC,GACD,SAASA,iBAAiB,EAAEC,MAAM,EAAaC,UAAU,QAAQ,aAAa;AAC9E,SAASC,YAAY,QAAQ,KAAK;AAClC,SAEEC,eAAe,QAEV,6BAA6B;AACpC,SAASC,4BAA4B,QAAQ,oBAAoB;AACjE,SAA6BC,YAAY,QAAQ,gBAAgB;AAEjE,8DAA8D,GAC9D,OAAO,MAAMC,2BAA2B;IACtC;QAAEC,MAAM;IAAQ;CACjB,C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AKE,OAAO;gBAAED,SAASA,WAAW;YAAQ;QAC1D;IACF;IAEA5B,6BACEQ,MACA,CAAC,GACDP,aACEF,gBAAiDU,cACjD;QAAC;KAAQ;AAGf,EAAE"}
package/src/utils/init.js CHANGED
@@ -256,12 +256,13 @@ export const PNPM_BUILT_DEPENDENCIES = [
256
256
  ...packageJson.scripts
257
257
  }
258
258
  }));
259
- // Pin the workspace's `nx` to the version the plugin's @nx/* packages are
260
- // built against. A mismatched workspace nx (even a patch apart) hoists a
261
- // second nested nx under @nx/js, and the two instances deadlock `nx sync`.
262
- // `@nx/js` must be a root dependency for the `@nx/js:typescript-sync`
263
- // generator registered in nx.json to resolve (npm doesn't hoist the
264
- // plugin's own copy reliably).
259
+ // Declare the `nx` version the plugin's @nx/* packages are built against. A
260
+ // mismatched workspace nx (even a patch apart) hoists a second nested nx
261
+ // under @nx/js, and the two instances deadlock `nx sync` — but a workspace
262
+ // already on a newer nx keeps it, since devkit never downgrades an existing
263
+ // range. `@nx/js` must be a root dependency for the
264
+ // `@nx/js:typescript-sync` generator registered in nx.json to resolve (npm
265
+ // doesn't hoist the plugin's own copy reliably).
265
266
  addDependenciesToPackageJson(tree, {}, {
266
267
  ...withVersions(forDependencies(declaration), [
267
268
  'nx',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/init.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n readNxJson,\n type Tree,\n updateJson,\n updateNxJson,\n} from '@nx/devkit';\nimport { initGenerator } from '@nx/js';\nimport { readFileSync } from 'fs';\nimport yaml from 'js-yaml';\nimport { SYNC_GENERATOR_NAME as TS_SYNC_GENERATOR_NAME } from '../ts/sync/generator.js';\nimport { BASE_TSCONFIG_COMPILER_OPTIONS } from './base-tsconfig.js';\nimport {\n ensureAwsNxPluginConfig,\n updateAwsNxPluginConfig,\n} from './config/utils.js';\nimport { type Containers, inferContainers } from './containers.js';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from './declared-dependencies.js';\nimport {\n addDependenciesToPackageJson,\n detectWorkspacePackageManager,\n} from './dependencies.js';\nimport { getDefaultBiomeConfig } from './format.js';\nimport {\n describeGeneratorForCatalogue,\n generatorsJsonEntries,\n} from './generators.js';\nimport { updateGitIgnore } from './git.js';\nimport type { Iac } from './iac.js';\nimport { configureMcpServers } from './mcp.js';\nimport { getNpmScope } from './npm-scope.js';\nimport {\n mergeTargetDefault,\n nxPluginMcpDependency,\n nxPluginSelfDependency,\n} from './nx.js';\nimport { getPackageManagerDisplayCommands } from './pkg-manager.js';\nimport { workspaceGlobs } from './project-package-json.js';\nimport { type ITsDepVersion, withVersions } from './versions.js';\n\nconst WORKSPACES = ['packages/*'];\nconst NX_TYPESCRIPT_SYNC_GENERATOR = '@nx/js:typescript-sync';\n\nexport const DEFAULT_PARALLEL = 8;\n\n/** Dependencies a caller must declare to apply the workspace init. */\nexport const INIT_DEPENDENCIES = [\n { name: 'nx' },\n { name: '@nx/js' },\n { name: '@nx/workspace' },\n { name: 'typescript' },\n { name: '@biomejs/biome' },\n] as const satisfies readonly { name: ITsDepVersion }[];\n\n// Built dependencies whose install scripts the generated workspace trusts.\n// `onlyBuiltDependencies` is the pnpm 10 key (silently ignored from pnpm 11\n// onwards); pnpm 11 and above read `allowBuilds` instead. Any dep NOT in this\n// allowlist will have its install scripts skipped with a warning — matching\n// pnpm 10's default behaviour. The user can opt-in later via\n// `pnpm approve-builds`.\nexport const PNPM_BUILT_DEPENDENCIES = ['@swc/core', 'esbuild', 'nx', 'sharp'];\n\n/**\n * Options controlling how the workspace is initialised. These mirror the\n * preset schema so a workspace created via the preset and one initialised via\n * the `init` generator end up in the same shape.\n */\nexport interface ApplyWorkspaceInitOptions {\n /** The IaC provider to record in the plugin config. */\n readonly iac: Iac;\n /**\n * The container engine to record. `undefined`/`'infer'` picks docker when\n * installed, else finch.\n */\n readonly containers?: Containers | 'infer';\n /** Whether to configure MCP servers for coding agents. Defaults to true. */\n readonly mcp?: boolean;\n /**\n * How to treat the generated workspace README. The preset owns the README of\n * a greenfield workspace (`Overwrite`); the `init` generator must not clobber\n * an existing workspace's README (`KeepExisting`, the default).\n */\n readonly readmeOverwriteStrategy?: OverwriteStrategy;\n /**\n * Whether to overwrite root package.json scripts that already exist. The\n * preset owns a greenfield workspace's scripts (`true`); the `init`\n * generator must not clobber an existing workspace's scripts (`false`,\n * the default) — it only adds the convenience scripts that are absent.\n */\n readonly overwriteScripts?: boolean;\n /**\n * Whether generators use the package manager's dependency catalog. On pnpm\n * this also sets `catalogMode: strict` so `pnpm add` records new deps in the\n * catalog. Defaults to true.\n */\n readonly catalogs?: boolean;\n}\n\n/**\n * Add or repair the pnpm `allowBuilds` / `onlyBuiltDependencies` allowlist for\n * the workspace's `packages` globs, without clobbering any packages the user\n * has already declared.\n *\n * A workspace not created by the preset commonly has either no\n * `pnpm-workspace.yaml`, one missing the `packages` globs, or one carrying the\n * broken `set this to true or false` placeholder pnpm writes when it skips a\n * build script. This makes the file self-consistent so the first generator's\n * install doesn't fail with `ERR_PNPM_IGNORED_BUILDS`.\n */\nconst setUpPnpmWorkspace = (tree: Tree, catalogs: boolean) => {\n const existing = tree.exists('pnpm-workspace.yaml')\n ? ((yaml.load(tree.read('pnpm-workspace.yaml', 'utf-8') ?? '') as Record<\n string,\n unknown\n >) ?? {})\n : {};\n\n // Preserve any packages globs the user already has, ensuring ours are present.\n const packages = Array.from(\n new Set([...((existing.packages as string[]) ?? []), ...WORKSPACES]),\n );\n\n const allowBuilds = {\n ...(typeof existing.allowBuilds === 'object' && existing.allowBuilds\n ? (existing.allowBuilds as Record<string, unknown>)\n : {}),\n // Overwrite any non-boolean (e.g. the \"set this to true or false\"\n // placeholder) with an explicit true for the deps we trust.\n ...Object.fromEntries(PNPM_BUILT_DEPENDENCIES.map((dep) => [dep, true])),\n };\n\n // `strict` makes `pnpm add` record new deps in the catalog; it only gates\n // that flow, so pre-declared direct ranges (e.g. tslib) still install.\n // Preserve an explicit user choice.\n const catalogMode = catalogs\n ? (existing.catalogMode ?? 'strict')\n : existing.catalogMode;\n\n tree.write(\n 'pnpm-workspace.yaml',\n yaml.dump(\n {\n ...existing,\n packages,\n allowBuilds,\n onlyBuiltDependencies: PNPM_BUILT_DEPENDENCIES,\n ...(catalogMode ? { catalogMode } : {}),\n },\n { quotingType: \"'\" },\n ),\n );\n};\n\n/**\n * Configure the workspace's package manager for a monorepo layout.\n *\n * pnpm workspaces are declared in `pnpm-workspace.yaml`; every other package\n * manager reads the `workspaces` field of the root `package.json`.\n */\nconst setUpWorkspaces = (tree: Tree, catalogs: boolean) => {\n if (detectWorkspacePackageManager(tree) === 'pnpm') {\n setUpPnpmWorkspace(tree, catalogs);\n // pnpm creates these at the workspace root while it materialises packages.\n updateGitIgnore(tree, '.', (patterns) => [...patterns, '_tmp_*']);\n } else {\n updateJson(tree, 'package.json', (json) => {\n // The `workspaces` field may be the object form ({ \"packages\": [...] })\n // accepted by yarn and bun — extend the globs while preserving the form.\n const globs = Array.from(\n new Set([...workspaceGlobs(json.workspaces), ...WORKSPACES]),\n );\n return {\n ...json,\n workspaces:\n json.workspaces !== undefined && !Array.isArray(json.workspaces)\n ? { ...json.workspaces, packages: globs }\n : globs,\n };\n });\n }\n};\n\n/**\n * Ensure the workspace has a `tsconfig.base.json`.\n *\n * `@nx/js` `initGenerator` (with `addTsPlugin`) normally creates this, but it\n * short-circuits when the workspace already has a root `tsconfig.json` — in\n * which case no base file is written and the next project generator fails with\n * `Cannot find tsconfig.base.json`. So we create a compatible one when it's\n * absent. An existing base is left untouched: the user may have tuned it, and\n * rewriting shared compiler options can break other projects (see the\n * \"add to an existing workspace\" guide).\n */\nconst ensureBaseTsConfig = (tree: Tree) => {\n if (tree.exists('tsconfig.base.json')) {\n return;\n }\n tree.write(\n 'tsconfig.base.json',\n JSON.stringify(\n {\n compilerOptions: {\n ...BASE_TSCONFIG_COMPILER_OPTIONS,\n customConditions: [getNpmScope(tree)],\n },\n },\n null,\n 2,\n ),\n );\n};\n\n/**\n * Ensure the workspace has a root `tsconfig.json`.\n *\n * Nx's `@nx/js:typescript-sync` generator hard-fails with\n * `Missing root \"tsconfig.json\"` when it's absent. The plugin's TypeScript\n * projects reference each other via this file, so we guarantee a minimal one\n * exists (sync populates its `references`).\n */\nconst ensureRootTsConfig = (tree: Tree) => {\n if (tree.exists('tsconfig.json')) {\n return;\n }\n tree.write(\n 'tsconfig.json',\n JSON.stringify(\n {\n extends: './tsconfig.base.json',\n files: [],\n references: [],\n },\n null,\n 2,\n ),\n );\n};\n\n/**\n * Transform an Nx workspace into one ready to run `@aws/nx-plugin` generators.\n *\n * This is the deterministic core shared by the workspace preset and the `init`\n * generator. It is safe to re-run: every step is idempotent (config merges,\n * keyed nx.json / package.json entries, create-if-missing files), so running\n * it against an already-initialised workspace is a no-op.\n *\n * It preserves the workspace's module format: the root package.json `type`\n * field is owned by the preset (written from its `--module` option) and left\n * untouched here. It does NOT rewrite an existing `tsconfig.base.json`'s\n * compiler options, migrate a workspace's package manager, or restructure\n * existing projects — those are decisions for the user (see the \"add to an\n * existing workspace\" guide).\n */\nexport const applyWorkspaceInit = async <const D extends DependencyDeclaration>(\n tree: Tree,\n {\n iac,\n containers,\n mcp,\n readmeOverwriteStrategy = OverwriteStrategy.KeepExisting,\n overwriteScripts = false,\n catalogs = true,\n }: ApplyWorkspaceInitOptions,\n declaration: D & MustDeclare<typeof INIT_DEPENDENCIES, D>,\n) => {\n const resolvedContainers =\n !containers || containers === 'infer' ? inferContainers() : containers;\n\n // The catalogs flag is written explicitly (even when true) so the workspace\n // records its dependency-management choice.\n await ensureAwsNxPluginConfig(tree);\n await updateAwsNxPluginConfig(tree, {\n iac: { provider: iac },\n containers: { engine: resolvedContainers },\n packageManager: { catalogs },\n });\n\n // Set up the TypeScript plugin, base tsconfig, formatter etc. `@nx/js`\n // creates `tsconfig.base.json` when absent, but skips it when a root\n // `tsconfig.json` already exists — so we ensure both explicitly below.\n await initGenerator(tree, {\n formatter: 'none',\n addTsPlugin: true,\n });\n\n ensureBaseTsConfig(tree);\n ensureRootTsConfig(tree);\n\n setUpWorkspaces(tree, catalogs);\n\n const nxJson = readNxJson(tree);\n updateNxJson(tree, {\n ...nxJson,\n // Preserve an explicit analytics choice in an existing workspace.\n analytics: (nxJson as { analytics?: boolean }).analytics ?? false,\n parallel: nxJson.parallel ?? DEFAULT_PARALLEL,\n targetDefaults: {\n ...nxJson.targetDefaults,\n compile: mergeTargetDefault(nxJson.targetDefaults?.compile, (base) => ({\n ...base,\n syncGenerators: [\n ...(base.syncGenerators ?? []).filter(\n (g) =>\n ![TS_SYNC_GENERATOR_NAME, NX_TYPESCRIPT_SYNC_GENERATOR].includes(\n g,\n ),\n ),\n NX_TYPESCRIPT_SYNC_GENERATOR,\n TS_SYNC_GENERATOR_NAME,\n ],\n })),\n },\n });\n\n const CONVENIENCE_SCRIPTS = {\n dev: 'nx run-many --target dev',\n build: 'nx run-many --target build',\n lint: 'nx run-many --target lint --configuration=fix',\n test: 'nx run-many --target test --all',\n // Trivy container image scanning is not part of `build` (its result\n // depends on the ever-changing vulnerability database); run it explicitly,\n // e.g. in CI.\n trivy: 'nx run-many --target trivy --all',\n 'build:skip-lint': 'nx run-many --target build --configuration=skip-lint',\n 'build:all': 'nx run-many --target build --all',\n 'affected:all': 'nx affected --target build',\n };\n updateJson(tree, 'package.json', (packageJson) => ({\n ...packageJson,\n // The root `type` field is owned by the preset (written explicitly from\n // its `--module` option). `init` preserves an existing workspace's field\n // as-is: an ESM workspace already carries `type: \"module\"` (that is how\n // the format is inferred), and introducing a `type` into a CommonJS\n // workspace that lacks one changes behaviour for frameworks that parse it\n // (e.g. Next.js starts treating the app's ESM source as CJS).\n scripts: overwriteScripts\n ? { ...packageJson.scripts, ...CONVENIENCE_SCRIPTS }\n : { ...CONVENIENCE_SCRIPTS, ...packageJson.scripts },\n }));\n\n // Pin the workspace's `nx` to the version the plugin's @nx/* packages are\n // built against. A mismatched workspace nx (even a patch apart) hoists a\n // second nested nx under @nx/js, and the two instances deadlock `nx sync`.\n // `@nx/js` must be a root dependency for the `@nx/js:typescript-sync`\n // generator registered in nx.json to resolve (npm doesn't hoist the\n // plugin's own copy reliably).\n addDependenciesToPackageJson(\n tree,\n {},\n {\n ...withVersions(forDependencies<typeof INIT_DEPENDENCIES>(declaration), [\n 'nx',\n '@nx/js',\n '@nx/workspace',\n ]),\n ...withVersions(forDependencies<typeof INIT_DEPENDENCIES>(declaration), [\n 'typescript',\n '@biomejs/biome',\n ]),\n // Declare the plugin the generators are running from, plus the MCP server\n // package the vended config runs, so both are pinned in the workspace's\n // lockfile and upgrading them upgrades what the agents use.\n ...nxPluginSelfDependency(tree),\n ...nxPluginMcpDependency(tree),\n },\n );\n\n // Write biome.json for formatting and linting\n if (!tree.exists('biome.json')) {\n tree.write(\n 'biome.json',\n JSON.stringify(getDefaultBiomeConfig(tree), null, 2),\n );\n }\n\n generateFiles(\n tree, // the virtual file system\n joinPathFragments(import.meta.dirname, '..', 'preset', 'files'),\n '.',\n {\n projectName: getNpmScope(tree),\n generators: Object.entries(generatorsJsonEntries)\n .filter(([, info]) => !info.hidden)\n .map(([id, info]) => ({\n name: id,\n description: describeGeneratorForCatalogue(info),\n })),\n ...(() => {\n const cmds = getPackageManagerDisplayCommands();\n return {\n pkgMgrCmd: cmds.exec,\n buildCmd: `${cmds.run} build`,\n lintCmd: `${cmds.run} lint`,\n };\n })(),\n },\n {\n overwriteStrategy: readmeOverwriteStrategy,\n },\n );\n\n if (mcp !== false) {\n configureMcpServers(tree);\n }\n};\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readNxJson","updateJson","updateNxJson","initGenerator","yaml","SYNC_GENERATOR_NAME","TS_SYNC_GENERATOR_NAME","BASE_TSCONFIG_COMPILER_OPTIONS","ensureAwsNxPluginConfig","updateAwsNxPluginConfig","inferContainers","forDependencies","addDependenciesToPackageJson","detectWorkspacePackageManager","getDefaultBiomeConfig","describeGeneratorForCatalogue","generatorsJsonEntries","updateGitIgnore","configureMcpServers","getNpmScope","mergeTargetDefault","nxPluginMcpDependency","nxPluginSelfDependency","getPackageManagerDisplayCommands","workspaceGlobs","withVersions","WORKSPACES","NX_TYPESCRIPT_SYNC_GENERATOR","DEFAULT_PARALLEL","INIT_DEPENDENCIES","name","PNPM_BUILT_DEPENDENCIES","setUpPnpmWorkspace","tree","catalogs","existing","exists","load","read","packages","Array","from","Set","allowBuilds","Object","fromEntries","map","dep","catalogMode","write","dump","onlyBuiltDependencies","quotingType","setUpWorkspaces","patterns","json","globs","workspaces","undefined","isArray","ensureBaseTsConfig","JSON","stringify","compilerOptions","customConditions","ensureRootTsConfig","extends","files","references","applyWorkspaceInit","iac","containers","mcp","readmeOverwriteStrategy","KeepExisting","overwriteScripts","declaration","resolvedContainers","provider","engine","packageManager","formatter","addTsPlugin","nxJson","analytics","parallel","targetDefaults","compile","base","syncGenerators","filter","g","includes","CONVENIENCE_SCRIPTS","dev","build","lint","test","trivy","packageJson","scripts","dirname","projectName","generators","entries","info","hidden","id","description","cmds","pkgMgrCmd","exec","buildCmd","run","lintCmd","overwriteStrategy"],"mappings":"AAAA;;;CAGC,GACD,SACEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EACjBC,UAAU,EAEVC,UAAU,EACVC,YAAY,QACP,aAAa;AACpB,SAASC,aAAa,QAAQ,SAAS;AAEvC,OAAOC,UAAU,UAAU;AAC3B,SAASC,uBAAuBC,sBAAsB,QAAQ,0BAA0B;AACxF,SAASC,8BAA8B,QAAQ,qBAAqB;AACpE,SACEC,uBAAuB,EACvBC,uBAAuB,QAClB,oBAAoB;AAC3B,SAA0BC,eAAe,QAAQ,kBAAkB;AACnE,SAEEC,eAAe,QAEV,6BAA6B;AACpC,SACEC,4BAA4B,EAC5BC,6BAA6B,QACxB,oBAAoB;AAC3B,SAASC,qBAAqB,QAA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AAM,CAAC,CAAC,GAAGe,KAAK,GAAK,CAACA,KAAKC,MAAM,EACjC5D,GAAG,CAAC,CAAC,CAAC6D,IAAIF,KAAK,GAAM,CAAA;gBACpB3E,MAAM6E;gBACNC,aAAa7F,8BAA8B0F;YAC7C,CAAA;QACF,GAAG,AAAC,CAAA;YACF,MAAMI,OAAOtF;YACb,OAAO;gBACLuF,WAAWD,KAAKE,IAAI;gBACpBC,UAAU,GAAGH,KAAKI,GAAG,CAAC,MAAM,CAAC;gBAC7BC,SAAS,GAAGL,KAAKI,GAAG,CAAC,KAAK,CAAC;YAC7B;QACF,CAAA,GAAI;IACN,GACA;QACEE,mBAAmB1C;IACrB;IAGF,IAAID,QAAQ,OAAO;QACjBtD,oBAAoBe;IACtB;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/init.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n readNxJson,\n type Tree,\n updateJson,\n updateNxJson,\n} from '@nx/devkit';\nimport { initGenerator } from '@nx/js';\nimport { readFileSync } from 'fs';\nimport yaml from 'js-yaml';\nimport { SYNC_GENERATOR_NAME as TS_SYNC_GENERATOR_NAME } from '../ts/sync/generator.js';\nimport { BASE_TSCONFIG_COMPILER_OPTIONS } from './base-tsconfig.js';\nimport {\n ensureAwsNxPluginConfig,\n updateAwsNxPluginConfig,\n} from './config/utils.js';\nimport { type Containers, inferContainers } from './containers.js';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from './declared-dependencies.js';\nimport {\n addDependenciesToPackageJson,\n detectWorkspacePackageManager,\n} from './dependencies.js';\nimport { getDefaultBiomeConfig } from './format.js';\nimport {\n describeGeneratorForCatalogue,\n generatorsJsonEntries,\n} from './generators.js';\nimport { updateGitIgnore } from './git.js';\nimport type { Iac } from './iac.js';\nimport { configureMcpServers } from './mcp.js';\nimport { getNpmScope } from './npm-scope.js';\nimport {\n mergeTargetDefault,\n nxPluginMcpDependency,\n nxPluginSelfDependency,\n} from './nx.js';\nimport { getPackageManagerDisplayCommands } from './pkg-manager.js';\nimport { workspaceGlobs } from './project-package-json.js';\nimport { type ITsDepVersion, withVersions } from './versions.js';\n\nconst WORKSPACES = ['packages/*'];\nconst NX_TYPESCRIPT_SYNC_GENERATOR = '@nx/js:typescript-sync';\n\nexport const DEFAULT_PARALLEL = 8;\n\n/** Dependencies a caller must declare to apply the workspace init. */\nexport const INIT_DEPENDENCIES = [\n { name: 'nx' },\n { name: '@nx/js' },\n { name: '@nx/workspace' },\n { name: 'typescript' },\n { name: '@biomejs/biome' },\n] as const satisfies readonly { name: ITsDepVersion }[];\n\n// Built dependencies whose install scripts the generated workspace trusts.\n// `onlyBuiltDependencies` is the pnpm 10 key (silently ignored from pnpm 11\n// onwards); pnpm 11 and above read `allowBuilds` instead. Any dep NOT in this\n// allowlist will have its install scripts skipped with a warning — matching\n// pnpm 10's default behaviour. The user can opt-in later via\n// `pnpm approve-builds`.\nexport const PNPM_BUILT_DEPENDENCIES = ['@swc/core', 'esbuild', 'nx', 'sharp'];\n\n/**\n * Options controlling how the workspace is initialised. These mirror the\n * preset schema so a workspace created via the preset and one initialised via\n * the `init` generator end up in the same shape.\n */\nexport interface ApplyWorkspaceInitOptions {\n /** The IaC provider to record in the plugin config. */\n readonly iac: Iac;\n /**\n * The container engine to record. `undefined`/`'infer'` picks docker when\n * installed, else finch.\n */\n readonly containers?: Containers | 'infer';\n /** Whether to configure MCP servers for coding agents. Defaults to true. */\n readonly mcp?: boolean;\n /**\n * How to treat the generated workspace README. The preset owns the README of\n * a greenfield workspace (`Overwrite`); the `init` generator must not clobber\n * an existing workspace's README (`KeepExisting`, the default).\n */\n readonly readmeOverwriteStrategy?: OverwriteStrategy;\n /**\n * Whether to overwrite root package.json scripts that already exist. The\n * preset owns a greenfield workspace's scripts (`true`); the `init`\n * generator must not clobber an existing workspace's scripts (`false`,\n * the default) — it only adds the convenience scripts that are absent.\n */\n readonly overwriteScripts?: boolean;\n /**\n * Whether generators use the package manager's dependency catalog. On pnpm\n * this also sets `catalogMode: strict` so `pnpm add` records new deps in the\n * catalog. Defaults to true.\n */\n readonly catalogs?: boolean;\n}\n\n/**\n * Add or repair the pnpm `allowBuilds` / `onlyBuiltDependencies` allowlist for\n * the workspace's `packages` globs, without clobbering any packages the user\n * has already declared.\n *\n * A workspace not created by the preset commonly has either no\n * `pnpm-workspace.yaml`, one missing the `packages` globs, or one carrying the\n * broken `set this to true or false` placeholder pnpm writes when it skips a\n * build script. This makes the file self-consistent so the first generator's\n * install doesn't fail with `ERR_PNPM_IGNORED_BUILDS`.\n */\nconst setUpPnpmWorkspace = (tree: Tree, catalogs: boolean) => {\n const existing = tree.exists('pnpm-workspace.yaml')\n ? ((yaml.load(tree.read('pnpm-workspace.yaml', 'utf-8') ?? '') as Record<\n string,\n unknown\n >) ?? {})\n : {};\n\n // Preserve any packages globs the user already has, ensuring ours are present.\n const packages = Array.from(\n new Set([...((existing.packages as string[]) ?? []), ...WORKSPACES]),\n );\n\n const allowBuilds = {\n ...(typeof existing.allowBuilds === 'object' && existing.allowBuilds\n ? (existing.allowBuilds as Record<string, unknown>)\n : {}),\n // Overwrite any non-boolean (e.g. the \"set this to true or false\"\n // placeholder) with an explicit true for the deps we trust.\n ...Object.fromEntries(PNPM_BUILT_DEPENDENCIES.map((dep) => [dep, true])),\n };\n\n // `strict` makes `pnpm add` record new deps in the catalog; it only gates\n // that flow, so pre-declared direct ranges (e.g. tslib) still install.\n // Preserve an explicit user choice.\n const catalogMode = catalogs\n ? (existing.catalogMode ?? 'strict')\n : existing.catalogMode;\n\n tree.write(\n 'pnpm-workspace.yaml',\n yaml.dump(\n {\n ...existing,\n packages,\n allowBuilds,\n onlyBuiltDependencies: PNPM_BUILT_DEPENDENCIES,\n ...(catalogMode ? { catalogMode } : {}),\n },\n { quotingType: \"'\" },\n ),\n );\n};\n\n/**\n * Configure the workspace's package manager for a monorepo layout.\n *\n * pnpm workspaces are declared in `pnpm-workspace.yaml`; every other package\n * manager reads the `workspaces` field of the root `package.json`.\n */\nconst setUpWorkspaces = (tree: Tree, catalogs: boolean) => {\n if (detectWorkspacePackageManager(tree) === 'pnpm') {\n setUpPnpmWorkspace(tree, catalogs);\n // pnpm creates these at the workspace root while it materialises packages.\n updateGitIgnore(tree, '.', (patterns) => [...patterns, '_tmp_*']);\n } else {\n updateJson(tree, 'package.json', (json) => {\n // The `workspaces` field may be the object form ({ \"packages\": [...] })\n // accepted by yarn and bun — extend the globs while preserving the form.\n const globs = Array.from(\n new Set([...workspaceGlobs(json.workspaces), ...WORKSPACES]),\n );\n return {\n ...json,\n workspaces:\n json.workspaces !== undefined && !Array.isArray(json.workspaces)\n ? { ...json.workspaces, packages: globs }\n : globs,\n };\n });\n }\n};\n\n/**\n * Ensure the workspace has a `tsconfig.base.json`.\n *\n * `@nx/js` `initGenerator` (with `addTsPlugin`) normally creates this, but it\n * short-circuits when the workspace already has a root `tsconfig.json` — in\n * which case no base file is written and the next project generator fails with\n * `Cannot find tsconfig.base.json`. So we create a compatible one when it's\n * absent. An existing base is left untouched: the user may have tuned it, and\n * rewriting shared compiler options can break other projects (see the\n * \"add to an existing workspace\" guide).\n */\nconst ensureBaseTsConfig = (tree: Tree) => {\n if (tree.exists('tsconfig.base.json')) {\n return;\n }\n tree.write(\n 'tsconfig.base.json',\n JSON.stringify(\n {\n compilerOptions: {\n ...BASE_TSCONFIG_COMPILER_OPTIONS,\n customConditions: [getNpmScope(tree)],\n },\n },\n null,\n 2,\n ),\n );\n};\n\n/**\n * Ensure the workspace has a root `tsconfig.json`.\n *\n * Nx's `@nx/js:typescript-sync` generator hard-fails with\n * `Missing root \"tsconfig.json\"` when it's absent. The plugin's TypeScript\n * projects reference each other via this file, so we guarantee a minimal one\n * exists (sync populates its `references`).\n */\nconst ensureRootTsConfig = (tree: Tree) => {\n if (tree.exists('tsconfig.json')) {\n return;\n }\n tree.write(\n 'tsconfig.json',\n JSON.stringify(\n {\n extends: './tsconfig.base.json',\n files: [],\n references: [],\n },\n null,\n 2,\n ),\n );\n};\n\n/**\n * Transform an Nx workspace into one ready to run `@aws/nx-plugin` generators.\n *\n * This is the deterministic core shared by the workspace preset and the `init`\n * generator. It is safe to re-run: every step is idempotent (config merges,\n * keyed nx.json / package.json entries, create-if-missing files), so running\n * it against an already-initialised workspace is a no-op.\n *\n * It preserves the workspace's module format: the root package.json `type`\n * field is owned by the preset (written from its `--module` option) and left\n * untouched here. It does NOT rewrite an existing `tsconfig.base.json`'s\n * compiler options, migrate a workspace's package manager, or restructure\n * existing projects — those are decisions for the user (see the \"add to an\n * existing workspace\" guide).\n */\nexport const applyWorkspaceInit = async <const D extends DependencyDeclaration>(\n tree: Tree,\n {\n iac,\n containers,\n mcp,\n readmeOverwriteStrategy = OverwriteStrategy.KeepExisting,\n overwriteScripts = false,\n catalogs = true,\n }: ApplyWorkspaceInitOptions,\n declaration: D & MustDeclare<typeof INIT_DEPENDENCIES, D>,\n) => {\n const resolvedContainers =\n !containers || containers === 'infer' ? inferContainers() : containers;\n\n // The catalogs flag is written explicitly (even when true) so the workspace\n // records its dependency-management choice.\n await ensureAwsNxPluginConfig(tree);\n await updateAwsNxPluginConfig(tree, {\n iac: { provider: iac },\n containers: { engine: resolvedContainers },\n packageManager: { catalogs },\n });\n\n // Set up the TypeScript plugin, base tsconfig, formatter etc. `@nx/js`\n // creates `tsconfig.base.json` when absent, but skips it when a root\n // `tsconfig.json` already exists — so we ensure both explicitly below.\n await initGenerator(tree, {\n formatter: 'none',\n addTsPlugin: true,\n });\n\n ensureBaseTsConfig(tree);\n ensureRootTsConfig(tree);\n\n setUpWorkspaces(tree, catalogs);\n\n const nxJson = readNxJson(tree);\n updateNxJson(tree, {\n ...nxJson,\n // Preserve an explicit analytics choice in an existing workspace.\n analytics: (nxJson as { analytics?: boolean }).analytics ?? false,\n parallel: nxJson.parallel ?? DEFAULT_PARALLEL,\n targetDefaults: {\n ...nxJson.targetDefaults,\n compile: mergeTargetDefault(nxJson.targetDefaults?.compile, (base) => ({\n ...base,\n syncGenerators: [\n ...(base.syncGenerators ?? []).filter(\n (g) =>\n ![TS_SYNC_GENERATOR_NAME, NX_TYPESCRIPT_SYNC_GENERATOR].includes(\n g,\n ),\n ),\n NX_TYPESCRIPT_SYNC_GENERATOR,\n TS_SYNC_GENERATOR_NAME,\n ],\n })),\n },\n });\n\n const CONVENIENCE_SCRIPTS = {\n dev: 'nx run-many --target dev',\n build: 'nx run-many --target build',\n lint: 'nx run-many --target lint --configuration=fix',\n test: 'nx run-many --target test --all',\n // Trivy container image scanning is not part of `build` (its result\n // depends on the ever-changing vulnerability database); run it explicitly,\n // e.g. in CI.\n trivy: 'nx run-many --target trivy --all',\n 'build:skip-lint': 'nx run-many --target build --configuration=skip-lint',\n 'build:all': 'nx run-many --target build --all',\n 'affected:all': 'nx affected --target build',\n };\n updateJson(tree, 'package.json', (packageJson) => ({\n ...packageJson,\n // The root `type` field is owned by the preset (written explicitly from\n // its `--module` option). `init` preserves an existing workspace's field\n // as-is: an ESM workspace already carries `type: \"module\"` (that is how\n // the format is inferred), and introducing a `type` into a CommonJS\n // workspace that lacks one changes behaviour for frameworks that parse it\n // (e.g. Next.js starts treating the app's ESM source as CJS).\n scripts: overwriteScripts\n ? { ...packageJson.scripts, ...CONVENIENCE_SCRIPTS }\n : { ...CONVENIENCE_SCRIPTS, ...packageJson.scripts },\n }));\n\n // Declare the `nx` version the plugin's @nx/* packages are built against. A\n // mismatched workspace nx (even a patch apart) hoists a second nested nx\n // under @nx/js, and the two instances deadlock `nx sync` — but a workspace\n // already on a newer nx keeps it, since devkit never downgrades an existing\n // range. `@nx/js` must be a root dependency for the\n // `@nx/js:typescript-sync` generator registered in nx.json to resolve (npm\n // doesn't hoist the plugin's own copy reliably).\n addDependenciesToPackageJson(\n tree,\n {},\n {\n ...withVersions(forDependencies<typeof INIT_DEPENDENCIES>(declaration), [\n 'nx',\n '@nx/js',\n '@nx/workspace',\n ]),\n ...withVersions(forDependencies<typeof INIT_DEPENDENCIES>(declaration), [\n 'typescript',\n '@biomejs/biome',\n ]),\n // Declare the plugin the generators are running from, plus the MCP server\n // package the vended config runs, so both are pinned in the workspace's\n // lockfile and upgrading them upgrades what the agents use.\n ...nxPluginSelfDependency(tree),\n ...nxPluginMcpDependency(tree),\n },\n );\n\n // Write biome.json for formatting and linting\n if (!tree.exists('biome.json')) {\n tree.write(\n 'biome.json',\n JSON.stringify(getDefaultBiomeConfig(tree), null, 2),\n );\n }\n\n generateFiles(\n tree, // the virtual file system\n joinPathFragments(import.meta.dirname, '..', 'preset', 'files'),\n '.',\n {\n projectName: getNpmScope(tree),\n generators: Object.entries(generatorsJsonEntries)\n .filter(([, info]) => !info.hidden)\n .map(([id, info]) => ({\n name: id,\n description: describeGeneratorForCatalogue(info),\n })),\n ...(() => {\n const cmds = getPackageManagerDisplayCommands();\n return {\n pkgMgrCmd: cmds.exec,\n buildCmd: `${cmds.run} build`,\n lintCmd: `${cmds.run} lint`,\n };\n })(),\n },\n {\n overwriteStrategy: readmeOverwriteStrategy,\n },\n );\n\n if (mcp !== false) {\n configureMcpServers(tree);\n }\n};\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readNxJson","updateJson","updateNxJson","initGenerator","yaml","SYNC_GENERATOR_NAME","TS_SYNC_GENERATOR_NAME","BASE_TSCONFIG_COMPILER_OPTIONS","ensureAwsNxPluginConfig","updateAwsNxPluginConfig","inferContainers","forDependencies","addDependenciesToPackageJson","detectWorkspacePackageManager","getDefaultBiomeConfig","describeGeneratorForCatalogue","generatorsJsonEntries","updateGitIgnore","configureMcpServers","getNpmScope","mergeTargetDefault","nxPluginMcpDependency","nxPluginSelfDependency","getPackageManagerDisplayCommands","workspaceGlobs","withVersions","WORKSPACES","NX_TYPESCRIPT_SYNC_GENERATOR","DEFAULT_PARALLEL","INIT_DEPENDENCIES","name","PNPM_BUILT_DEPENDENCIES","setUpPnpmWorkspace","tree","catalogs","existing","exists","load","read","packages","Array","from","Set","allowBuilds","Object","fromEntries","map","dep","catalogMode","write","dump","onlyBuiltDependencies","quotingType","setUpWorkspaces","patterns","json","globs","workspaces","undefined","isArray","ensureBaseTsConfig","JSON","stringify","compilerOptions","customConditions","ensureRootTsConfig","extends","files","references","applyWorkspaceInit","iac","containers","mcp","readmeOverwriteStrategy","KeepExisting","overwriteScripts","declaration","resolvedContainers","provider","engine","packageManager","formatter","addTsPlugin","nxJson","analytics","parallel","targetDefaults","compile","base","syncGenerators","filter","g","includes","CONVENIENCE_SCRIPTS","dev","build","lint","test","trivy","packageJson","scripts","dirname","projectName","generators","entries","info","hidden","id","description","cmds","pkgMgrCmd","exec","buildCmd","run","lintCmd","overwriteStrategy"],"mappings":"AAAA;;;CAGC,GACD,SACEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EACjBC,UAAU,EAEVC,UAAU,EACVC,YAAY,QACP,aAAa;AACpB,SAASC,aAAa,QAAQ,SAAS;AAEvC,OAAOC,UAAU,UAAU;AAC3B,SAASC,uBAAuBC,sBAAsB,QAAQ,0BAA0B;AACxF,SAASC,8BAA8B,QAAQ,qBAAqB;AACpE,SACEC,uBAAuB,EACvBC,uBAAuB,QAClB,oBAAoB;AAC3B,SAA0BC,eAAe,QAAQ,kBAAkB;AACnE,SAEEC,eAAe,QAEV,6BAA6B;AACpC,SACEC,4BAA4B,EAC5BC,6BAA6B,QACxB,oBAAoB;AAC3B,SAASC,qBAAqB,QAAQ,cAAc;AACpD,SACEC,6BAA6B,EAC7BC,qBAAqB,QAChB,kBAAkB;AACzB,SAASC,eAAe,QAAQ,WAAW;AAE3C,SAASC,mBAAmB,QAAQ,WAAW;AAC/C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SACEC,kBAAkB,EAClBC,qBAAqB,EACrBC,sBAAsB,QACjB,UAAU;AACjB,SAASC,gCAAgC,QAAQ,mBAAmB;AACpE,SAASC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