@aws/nx-plugin 1.0.0-rc.95 → 1.0.0-rc.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-THIRD-PARTY +234 -38
- package/migrations.json +34 -1
- package/package.json +6 -6
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +4 -10
- package/src/preset/__snapshots__/generator.spec.ts.snap +3 -5
- package/src/py/agent/a2a-connection/generator.d.ts +1 -1
- package/src/py/agent/gateway-connection/generator.d.ts +1 -1
- package/src/py/agent/mcp-connection/generator.d.ts +1 -1
- package/src/py/agent/react-connection/generator.d.ts +29 -0
- package/src/ts/agent/react-connection/generator.d.ts +37 -0
- package/src/ts/lib/generator.d.ts +13 -0
- package/src/ts/lib/generator.js +3 -2
- package/src/ts/lib/generator.js.map +1 -1
- package/src/ts/lib/ts-project-utils.d.ts +17 -1
- package/src/ts/lib/ts-project-utils.js +29 -0
- package/src/ts/lib/ts-project-utils.js.map +1 -1
- package/src/ts/lib/vitest.d.ts +6 -0
- package/src/ts/lib/vitest.js +16 -1
- package/src/ts/lib/vitest.js.map +1 -1
- package/src/ts/react-website/agui/generator.d.ts +21 -0
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +26 -22
- package/src/ts/react-website/app/generator.d.ts +42 -0
- package/src/ts/react-website/app/generator.js +2 -1
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/utils/dependencies.js +1 -10
- package/src/utils/dependencies.js.map +1 -1
- package/src/utils/shared-shadcn.d.ts +13 -0
- package/src/utils/shared-shadcn.js +3 -2
- package/src/utils/shared-shadcn.js.map +1 -1
- package/src/utils/test.js +15 -0
- package/src/utils/test.js.map +1 -1
- package/src/utils/version-upgrade-migration/sync-vended-versions.js +4 -4
- package/src/utils/version-upgrade-migration/sync-vended-versions.js.map +1 -1
- package/src/utils/versions.d.ts +10 -9
- package/src/utils/versions.js +10 -8
- package/src/utils/versions.js.map +1 -1
|
@@ -190,6 +190,43 @@ export declare const DEPENDENCIES: import("../../../utils/declared-dependencies.
|
|
|
190
190
|
when: (m: TsAgentReactConnectionMetadata) => boolean;
|
|
191
191
|
} & {
|
|
192
192
|
versionOnly: true;
|
|
193
|
+
}, Omit<{
|
|
194
|
+
readonly name: "jsdom";
|
|
195
|
+
} & {
|
|
196
|
+
versionOnly: true;
|
|
197
|
+
}, "when"> & {
|
|
198
|
+
when: (m: TsAgentReactConnectionMetadata) => boolean;
|
|
199
|
+
} & {
|
|
200
|
+
versionOnly: true;
|
|
201
|
+
}, Omit<{
|
|
202
|
+
readonly name: "@nx/vitest";
|
|
203
|
+
readonly dev: true;
|
|
204
|
+
readonly root: true;
|
|
205
|
+
} & {
|
|
206
|
+
versionOnly: true;
|
|
207
|
+
}, "when"> & {
|
|
208
|
+
when: (m: TsAgentReactConnectionMetadata) => boolean;
|
|
209
|
+
} & {
|
|
210
|
+
versionOnly: true;
|
|
211
|
+
}, Omit<{
|
|
212
|
+
readonly name: "@types/node";
|
|
213
|
+
readonly dev: true;
|
|
214
|
+
} & {
|
|
215
|
+
versionOnly: true;
|
|
216
|
+
}, "when"> & {
|
|
217
|
+
when: (m: TsAgentReactConnectionMetadata) => boolean;
|
|
218
|
+
} & {
|
|
219
|
+
versionOnly: true;
|
|
220
|
+
}, Omit<{
|
|
221
|
+
readonly name: "@types/node";
|
|
222
|
+
readonly dev: true;
|
|
223
|
+
readonly root: true;
|
|
224
|
+
} & {
|
|
225
|
+
versionOnly: true;
|
|
226
|
+
}, "when"> & {
|
|
227
|
+
when: (m: TsAgentReactConnectionMetadata) => boolean;
|
|
228
|
+
} & {
|
|
229
|
+
versionOnly: true;
|
|
193
230
|
}], readonly import("../../../utils/declared-dependencies.js").DeclaredPyDependency<"ruff" | "a2a-sdk" | "ag-ui-langgraph" | "ag-ui-protocol" | "ag-ui-strands" | "aiosqlite" | "aws-lambda-powertools" | "aws-lambda-powertools[tracer]" | "aws-lambda-powertools[parser]" | "aws-opentelemetry-distro" | "bedrock-agentcore" | "boto3" | "checkov" | "fastapi" | "fastapi[standard]" | "httpx" | "langchain" | "langchain-aws" | "langchain-mcp-adapters" | "langgraph" | "langgraph-checkpoint-aws" | "langgraph-checkpoint-sqlite" | "mcp" | "pip-check-updates" | "pip-licenses" | "strands-agents" | "strands-agents[a2a]" | "strands-agents-tools" | "ty" | "pynamodb" | "uvicorn" | "sqlmodel" | "alembic" | "aiomysql" | "asyncpg" | "greenlet", TsAgentReactConnectionMetadata>[]>;
|
|
194
231
|
export declare const TS_AGENT_REACT_CONNECTION_GENERATOR_INFO: NxGeneratorInfo;
|
|
195
232
|
/**
|
|
@@ -11,6 +11,19 @@ export declare const DEPENDENCIES: import("../../utils/declared-dependencies.js"
|
|
|
11
11
|
readonly name: "vitest";
|
|
12
12
|
}, {
|
|
13
13
|
readonly name: "@vitest/coverage-v8";
|
|
14
|
+
}, {
|
|
15
|
+
readonly name: "jsdom";
|
|
16
|
+
}, {
|
|
17
|
+
readonly name: "@nx/vitest";
|
|
18
|
+
readonly dev: true;
|
|
19
|
+
readonly root: true;
|
|
20
|
+
}, {
|
|
21
|
+
readonly name: "@types/node";
|
|
22
|
+
readonly dev: true;
|
|
23
|
+
}, {
|
|
24
|
+
readonly name: "@types/node";
|
|
25
|
+
readonly dev: true;
|
|
26
|
+
readonly root: true;
|
|
14
27
|
}], readonly import("../../utils/declared-dependencies.js").DeclaredPyDependency<"ruff" | "a2a-sdk" | "ag-ui-langgraph" | "ag-ui-protocol" | "ag-ui-strands" | "aiosqlite" | "aws-lambda-powertools" | "aws-lambda-powertools[tracer]" | "aws-lambda-powertools[parser]" | "aws-opentelemetry-distro" | "bedrock-agentcore" | "boto3" | "checkov" | "fastapi" | "fastapi[standard]" | "httpx" | "langchain" | "langchain-aws" | "langchain-mcp-adapters" | "langgraph" | "langgraph-checkpoint-aws" | "langgraph-checkpoint-sqlite" | "mcp" | "pip-check-updates" | "pip-licenses" | "strands-agents" | "strands-agents[a2a]" | "strands-agents-tools" | "ty" | "pynamodb" | "uvicorn" | "sqlmodel" | "alembic" | "aiomysql" | "asyncpg" | "greenlet", Record<string, never>>[]>;
|
|
15
28
|
export declare const TS_LIB_GENERATOR_INFO: NxGeneratorInfo;
|
|
16
29
|
/**
|
package/src/ts/lib/generator.js
CHANGED
|
@@ -13,11 +13,12 @@ import { getNpmScopePrefix } from "../../utils/npm-scope.js";
|
|
|
13
13
|
import { addGeneratorMetadata, getGeneratorInfo, mergeTargetDefault, projectExists } from "../../utils/nx.js";
|
|
14
14
|
import { sortObjectKeys } from "../../utils/object.js";
|
|
15
15
|
import { getPackageManagerDisplayCommands } from "../../utils/pkg-manager.js";
|
|
16
|
-
import { configureTsProject } from "./ts-project-utils.js";
|
|
16
|
+
import { configureTsProject, TS_PROJECT_DEPENDENCIES } from "./ts-project-utils.js";
|
|
17
17
|
import { VITEST_DEPENDENCIES } from "./vitest.js";
|
|
18
18
|
export const DEPENDENCIES = declareDependencies()({
|
|
19
19
|
ts: [
|
|
20
|
-
...VITEST_DEPENDENCIES
|
|
20
|
+
...VITEST_DEPENDENCIES,
|
|
21
|
+
...TS_PROJECT_DEPENDENCIES
|
|
21
22
|
]
|
|
22
23
|
});
|
|
23
24
|
export const TS_LIB_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n type NxJsonConfiguration,\n OverwriteStrategy,\n readProjectConfiguration,\n type TargetConfiguration,\n type Tree,\n updateJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { libraryGenerator } from '@nx/js';\nimport { declareDependencies } from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { isEsmWorkspace } from '../../utils/module-format.js';\nimport { toKebabCase } from '../../utils/names.js';\nimport { getNpmScopePrefix } from '../../utils/npm-scope.js';\nimport {\n addGeneratorMetadata,\n getGeneratorInfo,\n mergeTargetDefault,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { getPackageManagerDisplayCommands } from '../../utils/pkg-manager.js';\nimport type { TsProjectGeneratorSchema } from './schema';\nimport { configureTsProject } from './ts-project-utils.js';\nimport { VITEST_DEPENDENCIES } from './vitest.js';\n\nexport const DEPENDENCIES = declareDependencies()({\n ts: [...VITEST_DEPENDENCIES],\n});\n\nexport const TS_LIB_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\n/**\n * Consumes build artifacts produced by a project's dependencies, so a task\n * re-runs when the output it actually reads changes.\n *\n * Test reports are excluded rather than build artifacts included: several\n * generators emit generated sources outside `dist` (an OpenAPI client under a\n * website's `src/generated`, a Smithy SSDK, the Prisma client) and add them to\n * `.gitignore`, which keeps them out of the project's own fileset — so this\n * input is the only thing that hashes them. `reports/` and `coverage/` hold\n * pytest's JUnit and coverage XML, which carry a wall-clock timestamp and so\n * mint a fresh hash on every test run that would cascade through the graph.\n */\nexport const DEPENDENT_TASKS_OUTPUT_FILES_INPUT = {\n dependentTasksOutputFiles: '!{reports,coverage}/**',\n transitive: true,\n};\n\n// Globs this generator has vended for the dependent-task-output input. Any of\n// them is replaced in place, so the entry is neither duplicated nor left at a\n// different scope when a generator re-runs.\nconst VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS = [\n '**/*',\n 'dist/**',\n DEPENDENT_TASKS_OUTPUT_FILES_INPUT.dependentTasksOutputFiles,\n];\n\nexport interface TsLibDetails {\n /**\n * Full package name including scope (eg @foo/bar)\n */\n readonly fullyQualifiedName: string;\n /**\n * Directory of the library relative to the root\n */\n readonly dir: string;\n}\n\n/**\n * Returns details about the TS library to be created\n */\nexport const getTsLibDetails = (\n tree: Tree,\n schema: TsProjectGeneratorSchema,\n): TsLibDetails => {\n const scope = getNpmScopePrefix(tree);\n const normalizedName = toKebabCase(schema.name);\n const fullyQualifiedName = `${scope}${normalizedName}`;\n // NB: interactive nx generator cli can pass empty string\n const dir = joinPathFragments(\n schema.directory || '.',\n schema.subDirectory || normalizedName,\n );\n return { dir, fullyQualifiedName };\n};\n\n/**\n * Generates a typescript project\n */\nexport const tsProjectGenerator = async (\n tree: Tree,\n schema: TsProjectGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const { fullyQualifiedName, dir } = getTsLibDetails(tree, schema);\n // The module format is workspace-wide, established by the preset when the\n // workspace is created, so vending generators always infer it from the tree.\n const esm = isEsmWorkspace(tree);\n\n // Only scaffold the project on first run; on re-run skip creation so user\n // edits are preserved, but continue to (re)apply the configuration below.\n if (!projectExists(tree, fullyQualifiedName)) {\n await libraryGenerator(tree, {\n ...schema,\n name: fullyQualifiedName,\n directory: dir,\n skipPackageJson: true,\n bundler: 'tsc', // TODO: consider supporting others\n linter: 'none',\n unitTestRunner: 'vitest',\n // Register the @nx/vitest plugin so the test target is inferred rather\n // than emitting the deprecated @nx/vitest:test executor target.\n addPlugin: true,\n });\n\n // Replace with simpler sample source code\n tree.delete(joinPathFragments(dir, 'src'));\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n joinPathFragments(dir),\n {\n fullyQualifiedName,\n esm,\n pkgMgrCmd: getPackageManagerDisplayCommands().exec,\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n }\n await configureTsProject(\n tree,\n {\n dir,\n fullyQualifiedName,\n esm,\n },\n DEPENDENCIES,\n );\n\n const projectConfiguration = readProjectConfiguration(\n tree,\n fullyQualifiedName,\n );\n const targets = projectConfiguration.targets;\n\n targets['compile'] = {\n executor: 'nx:run-commands',\n outputs: ['{workspaceRoot}/dist/{projectRoot}/tsc'],\n options: {\n command: 'tsc --build tsconfig.lib.json',\n cwd: '{projectRoot}',\n },\n };\n targets['build'] = {\n dependsOn: ['lint', 'compile', 'test'],\n };\n // The artifact-only sibling of build, which the deploy targets depend on.\n targets['assemble'] = {\n dependsOn: ['compile'],\n };\n projectConfiguration.targets = sortObjectKeys(targets);\n\n updateProjectConfiguration(tree, fullyQualifiedName, projectConfiguration);\n\n addGeneratorMetadata(tree, fullyQualifiedName, TS_LIB_GENERATOR_INFO);\n\n updateJson(tree, 'nx.json', (nxJson: NxJsonConfiguration) => {\n nxJson.namedInputs = {\n ...nxJson.namedInputs,\n default: [\n ...(nxJson.namedInputs?.default ?? []).filter(\n (input) =>\n typeof input !== 'object' ||\n !('dependentTasksOutputFiles' in input) ||\n !(\n VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS.includes(\n input.dependentTasksOutputFiles as string,\n ) && input.transitive\n ),\n ),\n DEPENDENT_TASKS_OUTPUT_FILES_INPUT,\n ],\n };\n\n const withDefaultInput = (base: Partial<TargetConfiguration>) => ({\n ...base,\n inputs: [\n ...(base.inputs ?? []).filter((i) => i !== 'default'),\n 'default',\n ],\n });\n\n nxJson.targetDefaults = {\n ...nxJson.targetDefaults,\n compile: mergeTargetDefault(nxJson.targetDefaults?.compile, (base) => ({\n cache: true,\n ...withDefaultInput(base),\n })),\n build: mergeTargetDefault(nxJson.targetDefaults?.build, (base) => ({\n cache: true,\n ...withDefaultInput(base),\n })),\n test: mergeTargetDefault(nxJson.targetDefaults?.test, withDefaultInput),\n };\n\n // Ensure we only declare a single typescript plugin with the correct settings\n nxJson.plugins = [\n {\n plugin: '@nx/js/typescript',\n options: {\n typecheck: {\n targetName: 'typecheck',\n },\n build: {\n targetName: 'compile',\n configName: 'tsconfig.lib.json',\n buildDepsName: 'build-deps',\n watchDepsName: 'watch-deps',\n },\n },\n },\n ...(nxJson.plugins ?? []).filter(\n (p) => typeof p === 'string' || p.plugin !== '@nx/js/typescript',\n ),\n ];\n\n return nxJson;\n });\n\n await addGeneratorMetricsIfApplicable(tree, [TS_LIB_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n\n // `installDependencies` ensures vitest resolves for the `typescript` language (the\n // generated vitest.config.mts imports it and Nx loads that config when\n // computing the project graph), so a deferred install still runs when needed.\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\nexport default tsProjectGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readProjectConfiguration","updateJson","updateProjectConfiguration","libraryGenerator","declareDependencies","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","isEsmWorkspace","toKebabCase","getNpmScopePrefix","addGeneratorMetadata","getGeneratorInfo","mergeTargetDefault","projectExists","sortObjectKeys","getPackageManagerDisplayCommands","configureTsProject","VITEST_DEPENDENCIES","DEPENDENCIES","ts","TS_LIB_GENERATOR_INFO","filename","DEPENDENT_TASKS_OUTPUT_FILES_INPUT","dependentTasksOutputFiles","transitive","VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS","getTsLibDetails","tree","schema","scope","normalizedName","name","fullyQualifiedName","dir","directory","subDirectory","tsProjectGenerator","esm","skipPackageJson","bundler","linter","unitTestRunner","addPlugin","delete","dirname","pkgMgrCmd","exec","overwriteStrategy","KeepExisting","projectConfiguration","targets","executor","outputs","options","command","cwd","dependsOn","nxJson","namedInputs","default","filter","input","includes","withDefaultInput","base","inputs","i","targetDefaults","compile","cache","build","test","plugins","plugin","typecheck","targetName","configName","buildDepsName","watchDepsName","p","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EAEjBC,iBAAiB,EACjBC,wBAAwB,EAGxBC,UAAU,EACVC,0BAA0B,QACrB,aAAa;AACpB,SAASC,gBAAgB,QAAQ,SAAS;AAC1C,SAASC,mBAAmB,QAAQ,uCAAuC;AAC3E,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,yB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AACJ,EAAE;AACF,eAAe7C,mBAAmB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n type NxJsonConfiguration,\n OverwriteStrategy,\n readProjectConfiguration,\n type TargetConfiguration,\n type Tree,\n updateJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { libraryGenerator } from '@nx/js';\nimport { declareDependencies } from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { isEsmWorkspace } from '../../utils/module-format.js';\nimport { toKebabCase } from '../../utils/names.js';\nimport { getNpmScopePrefix } from '../../utils/npm-scope.js';\nimport {\n addGeneratorMetadata,\n getGeneratorInfo,\n mergeTargetDefault,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { getPackageManagerDisplayCommands } from '../../utils/pkg-manager.js';\nimport type { TsProjectGeneratorSchema } from './schema';\nimport {\n configureTsProject,\n TS_PROJECT_DEPENDENCIES,\n} from './ts-project-utils.js';\nimport { VITEST_DEPENDENCIES } from './vitest.js';\n\nexport const DEPENDENCIES = declareDependencies()({\n ts: [...VITEST_DEPENDENCIES, ...TS_PROJECT_DEPENDENCIES],\n});\n\nexport const TS_LIB_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\n/**\n * Consumes build artifacts produced by a project's dependencies, so a task\n * re-runs when the output it actually reads changes.\n *\n * Test reports are excluded rather than build artifacts included: several\n * generators emit generated sources outside `dist` (an OpenAPI client under a\n * website's `src/generated`, a Smithy SSDK, the Prisma client) and add them to\n * `.gitignore`, which keeps them out of the project's own fileset — so this\n * input is the only thing that hashes them. `reports/` and `coverage/` hold\n * pytest's JUnit and coverage XML, which carry a wall-clock timestamp and so\n * mint a fresh hash on every test run that would cascade through the graph.\n */\nexport const DEPENDENT_TASKS_OUTPUT_FILES_INPUT = {\n dependentTasksOutputFiles: '!{reports,coverage}/**',\n transitive: true,\n};\n\n// Globs this generator has vended for the dependent-task-output input. Any of\n// them is replaced in place, so the entry is neither duplicated nor left at a\n// different scope when a generator re-runs.\nconst VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS = [\n '**/*',\n 'dist/**',\n DEPENDENT_TASKS_OUTPUT_FILES_INPUT.dependentTasksOutputFiles,\n];\n\nexport interface TsLibDetails {\n /**\n * Full package name including scope (eg @foo/bar)\n */\n readonly fullyQualifiedName: string;\n /**\n * Directory of the library relative to the root\n */\n readonly dir: string;\n}\n\n/**\n * Returns details about the TS library to be created\n */\nexport const getTsLibDetails = (\n tree: Tree,\n schema: TsProjectGeneratorSchema,\n): TsLibDetails => {\n const scope = getNpmScopePrefix(tree);\n const normalizedName = toKebabCase(schema.name);\n const fullyQualifiedName = `${scope}${normalizedName}`;\n // NB: interactive nx generator cli can pass empty string\n const dir = joinPathFragments(\n schema.directory || '.',\n schema.subDirectory || normalizedName,\n );\n return { dir, fullyQualifiedName };\n};\n\n/**\n * Generates a typescript project\n */\nexport const tsProjectGenerator = async (\n tree: Tree,\n schema: TsProjectGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const { fullyQualifiedName, dir } = getTsLibDetails(tree, schema);\n // The module format is workspace-wide, established by the preset when the\n // workspace is created, so vending generators always infer it from the tree.\n const esm = isEsmWorkspace(tree);\n\n // Only scaffold the project on first run; on re-run skip creation so user\n // edits are preserved, but continue to (re)apply the configuration below.\n if (!projectExists(tree, fullyQualifiedName)) {\n await libraryGenerator(tree, {\n ...schema,\n name: fullyQualifiedName,\n directory: dir,\n skipPackageJson: true,\n bundler: 'tsc', // TODO: consider supporting others\n linter: 'none',\n unitTestRunner: 'vitest',\n // Register the @nx/vitest plugin so the test target is inferred rather\n // than emitting the deprecated @nx/vitest:test executor target.\n addPlugin: true,\n });\n\n // Replace with simpler sample source code\n tree.delete(joinPathFragments(dir, 'src'));\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n joinPathFragments(dir),\n {\n fullyQualifiedName,\n esm,\n pkgMgrCmd: getPackageManagerDisplayCommands().exec,\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n }\n await configureTsProject(\n tree,\n {\n dir,\n fullyQualifiedName,\n esm,\n },\n DEPENDENCIES,\n );\n\n const projectConfiguration = readProjectConfiguration(\n tree,\n fullyQualifiedName,\n );\n const targets = projectConfiguration.targets;\n\n targets['compile'] = {\n executor: 'nx:run-commands',\n outputs: ['{workspaceRoot}/dist/{projectRoot}/tsc'],\n options: {\n command: 'tsc --build tsconfig.lib.json',\n cwd: '{projectRoot}',\n },\n };\n targets['build'] = {\n dependsOn: ['lint', 'compile', 'test'],\n };\n // The artifact-only sibling of build, which the deploy targets depend on.\n targets['assemble'] = {\n dependsOn: ['compile'],\n };\n projectConfiguration.targets = sortObjectKeys(targets);\n\n updateProjectConfiguration(tree, fullyQualifiedName, projectConfiguration);\n\n addGeneratorMetadata(tree, fullyQualifiedName, TS_LIB_GENERATOR_INFO);\n\n updateJson(tree, 'nx.json', (nxJson: NxJsonConfiguration) => {\n nxJson.namedInputs = {\n ...nxJson.namedInputs,\n default: [\n ...(nxJson.namedInputs?.default ?? []).filter(\n (input) =>\n typeof input !== 'object' ||\n !('dependentTasksOutputFiles' in input) ||\n !(\n VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS.includes(\n input.dependentTasksOutputFiles as string,\n ) && input.transitive\n ),\n ),\n DEPENDENT_TASKS_OUTPUT_FILES_INPUT,\n ],\n };\n\n const withDefaultInput = (base: Partial<TargetConfiguration>) => ({\n ...base,\n inputs: [\n ...(base.inputs ?? []).filter((i) => i !== 'default'),\n 'default',\n ],\n });\n\n nxJson.targetDefaults = {\n ...nxJson.targetDefaults,\n compile: mergeTargetDefault(nxJson.targetDefaults?.compile, (base) => ({\n cache: true,\n ...withDefaultInput(base),\n })),\n build: mergeTargetDefault(nxJson.targetDefaults?.build, (base) => ({\n cache: true,\n ...withDefaultInput(base),\n })),\n test: mergeTargetDefault(nxJson.targetDefaults?.test, withDefaultInput),\n };\n\n // Ensure we only declare a single typescript plugin with the correct settings\n nxJson.plugins = [\n {\n plugin: '@nx/js/typescript',\n options: {\n typecheck: {\n targetName: 'typecheck',\n },\n build: {\n targetName: 'compile',\n configName: 'tsconfig.lib.json',\n buildDepsName: 'build-deps',\n watchDepsName: 'watch-deps',\n },\n },\n },\n ...(nxJson.plugins ?? []).filter(\n (p) => typeof p === 'string' || p.plugin !== '@nx/js/typescript',\n ),\n ];\n\n return nxJson;\n });\n\n await addGeneratorMetricsIfApplicable(tree, [TS_LIB_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n\n // `installDependencies` ensures vitest resolves for the `typescript` language (the\n // generated vitest.config.mts imports it and Nx loads that config when\n // computing the project graph), so a deferred install still runs when needed.\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\nexport default tsProjectGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readProjectConfiguration","updateJson","updateProjectConfiguration","libraryGenerator","declareDependencies","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","isEsmWorkspace","toKebabCase","getNpmScopePrefix","addGeneratorMetadata","getGeneratorInfo","mergeTargetDefault","projectExists","sortObjectKeys","getPackageManagerDisplayCommands","configureTsProject","TS_PROJECT_DEPENDENCIES","VITEST_DEPENDENCIES","DEPENDENCIES","ts","TS_LIB_GENERATOR_INFO","filename","DEPENDENT_TASKS_OUTPUT_FILES_INPUT","dependentTasksOutputFiles","transitive","VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS","getTsLibDetails","tree","schema","scope","normalizedName","name","fullyQualifiedName","dir","directory","subDirectory","tsProjectGenerator","esm","skipPackageJson","bundler","linter","unitTestRunner","addPlugin","delete","dirname","pkgMgrCmd","exec","overwriteStrategy","KeepExisting","projectConfiguration","targets","executor","outputs","options","command","cwd","dependsOn","nxJson","namedInputs","default","filter","input","includes","withDefaultInput","base","inputs","i","targetDefaults","compile","cache","build","test","plugins","plugin","typecheck","targetName","configName","buildDepsName","watchDepsName","p","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EAEjBC,iBAAiB,EACjBC,wBAAwB,EAGxBC,UAAU,EACVC,0BAA0B,QACrB,aAAa;AACpB,SAASC,gBAAgB,QAAQ,SAAS;AAC1C,SAASC,mBAAmB,QAAQ,uCAAuC;AAC3E,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,iBAAiB,QAAQ,2BAA2B;AAC7D,SACEC,oBAAoB,EACpBC,gBAAgB,EAChBC,kBAAkB,EAElBC,aAAa,QACR,oBAAoB;AAC3B,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,gCAAgC,QAAQ,6BAA6B;AAE9E,SACEC,kBAAkB,EAClBC,uBAAuB,QAClB,wBAAwB;AAC/B,SAASC,mBAAmB,QAAQ,cAAc;AAElD,OAAO,MAAMC,eAAehB,sBAAsB;IAChDiB,IAAI;WAAIF;WAAwBD;KAAwB;AAC1D,GAAG;AAEH,OAAO,MAAMI,wBAAyCV,iBACpD,YAAYW,QAAQ,EACpB;AAEF;;;;;;;;;;;CAWC,GACD,OAAO,MAAMC,qCAAqC;IAChDC,2BAA2B;IAC3BC,YAAY;AACd,EAAE;AAEF,8EAA8E;AAC9E,8EAA8E;AAC9E,4CAA4C;AAC5C,MAAMC,sCAAsC;IAC1C;IACA;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QAEA,8EAA8E;QAC9EN,OAAOe,OAAO,GAAG;YACf;gBACEC,QAAQ;gBACRpB,SAAS;oBACPqB,WAAW;wBACTC,YAAY;oBACd;oBACAL,OAAO;wBACLK,YAAY;wBACZC,YAAY;wBACZC,eAAe;wBACfC,eAAe;oBACjB;gBACF;YACF;eACG,AAACrB,CAAAA,OAAOe,OAAO,IAAI,EAAE,AAAD,EAAGZ,MAAM,CAC9B,CAACmB,IAAM,OAAOA,MAAM,YAAYA,EAAEN,MAAM,KAAK;SAEhD;QAED,OAAOhB;IACT;IAEA,MAAMpD,gCAAgCsB,MAAM;QAACP;KAAsB;IAEnE,MAAMjB,qBAAqBwB;IAE3B,mFAAmF;IACnF,uEAAuE;IACvE,8EAA8E;IAC9E,OAAO,IACLvB,oBAAoBuB,MAAMC,OAAOoD,yBAAyB,EAAE;YAC1DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AACF,eAAe7C,mBAAmB"}
|
|
@@ -9,6 +9,22 @@ import { type VITEST_DEPENDENCIES } from './vitest.js';
|
|
|
9
9
|
interface TsConfigReference {
|
|
10
10
|
path: string;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Dependencies a caller must declare to configure a TypeScript project.
|
|
14
|
+
*
|
|
15
|
+
* `@nx/js` writes `types: ['node']` into every project's `tsconfig.lib.json`, so
|
|
16
|
+
* the types must be declared for `tsc` to resolve them. Declared twice: on the
|
|
17
|
+
* project whose tsconfig names them, and at the root, which `@nx/js` seeded until
|
|
18
|
+
* Nx 23.2 stopped.
|
|
19
|
+
*/
|
|
20
|
+
export declare const TS_PROJECT_DEPENDENCIES: readonly [{
|
|
21
|
+
readonly name: "@types/node";
|
|
22
|
+
readonly dev: true;
|
|
23
|
+
}, {
|
|
24
|
+
readonly name: "@types/node";
|
|
25
|
+
readonly dev: true;
|
|
26
|
+
readonly root: true;
|
|
27
|
+
}];
|
|
12
28
|
/**
|
|
13
29
|
* Merges new TypeScript project references into existing ones, deduplicating by
|
|
14
30
|
* path and preserving the order of existing references so re-running a
|
|
@@ -18,5 +34,5 @@ export declare const mergeTsReferences: (existing: TsConfigReference[] | undefin
|
|
|
18
34
|
/**
|
|
19
35
|
* Updates typescript projects
|
|
20
36
|
*/
|
|
21
|
-
export declare const configureTsProject: <const D extends DependencyDeclaration>(tree: Tree, options: ConfigureProjectOptions, declaration: D & MustDeclare<typeof VITEST_DEPENDENCIES, D>) => Promise<void>;
|
|
37
|
+
export declare const configureTsProject: <const D extends DependencyDeclaration>(tree: Tree, options: ConfigureProjectOptions, declaration: D & MustDeclare<typeof VITEST_DEPENDENCIES, D> & MustDeclare<typeof TS_PROJECT_DEPENDENCIES, D>) => Promise<void>;
|
|
22
38
|
export {};
|
|
@@ -4,12 +4,31 @@
|
|
|
4
4
|
*/ import { joinPathFragments, logger, updateJson } from "@nx/devkit";
|
|
5
5
|
import { join, relative } from "path";
|
|
6
6
|
import { addLicenseCheckToLintTarget } from "../../license/config.js";
|
|
7
|
+
import { addTsDependencies } from "../../utils/add-dependencies.js";
|
|
7
8
|
import { AWS_NX_PLUGIN_CONFIG_FILE_NAME } from "../../utils/config/utils.js";
|
|
8
9
|
import { forDependencies } from "../../utils/declared-dependencies.js";
|
|
9
10
|
import { isEsmWorkspace } from "../../utils/module-format.js";
|
|
10
11
|
import { ensureProjectPackageJson } from "../../utils/project-package-json.js";
|
|
11
12
|
import { configureBiomeLint } from "./biome.js";
|
|
12
13
|
import { configureVitest } from "./vitest.js";
|
|
14
|
+
/**
|
|
15
|
+
* Dependencies a caller must declare to configure a TypeScript project.
|
|
16
|
+
*
|
|
17
|
+
* `@nx/js` writes `types: ['node']` into every project's `tsconfig.lib.json`, so
|
|
18
|
+
* the types must be declared for `tsc` to resolve them. Declared twice: on the
|
|
19
|
+
* project whose tsconfig names them, and at the root, which `@nx/js` seeded until
|
|
20
|
+
* Nx 23.2 stopped.
|
|
21
|
+
*/ export const TS_PROJECT_DEPENDENCIES = [
|
|
22
|
+
{
|
|
23
|
+
name: '@types/node',
|
|
24
|
+
dev: true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: '@types/node',
|
|
28
|
+
dev: true,
|
|
29
|
+
root: true
|
|
30
|
+
}
|
|
31
|
+
];
|
|
13
32
|
/**
|
|
14
33
|
* Merges new TypeScript project references into existing ones, deduplicating by
|
|
15
34
|
* path and preserving the order of existing references so re-running a
|
|
@@ -104,6 +123,16 @@ import { configureVitest } from "./vitest.js";
|
|
|
104
123
|
fullyQualifiedName: options.fullyQualifiedName,
|
|
105
124
|
esm
|
|
106
125
|
});
|
|
126
|
+
// From this helper's constant, not the caller's declaration, which marks these
|
|
127
|
+
// `ownedElsewhere` because the install happens here.
|
|
128
|
+
addTsDependencies(tree, {
|
|
129
|
+
ts: [
|
|
130
|
+
...TS_PROJECT_DEPENDENCIES
|
|
131
|
+
],
|
|
132
|
+
py: []
|
|
133
|
+
}, {
|
|
134
|
+
projectRoot: options.dir
|
|
135
|
+
});
|
|
107
136
|
await configureBiomeLint(tree, options);
|
|
108
137
|
await configureVitest(tree, options, forDependencies(declaration));
|
|
109
138
|
// If license checking is configured, make this project's lint target depend
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/ts-project-utils.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { joinPathFragments, logger, type Tree, updateJson } from '@nx/devkit';\nimport { join, relative } from 'path';\nimport { addLicenseCheckToLintTarget } from '../../license/config.js';\nimport { AWS_NX_PLUGIN_CONFIG_FILE_NAME } from '../../utils/config/utils.js';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from '../../utils/declared-dependencies.js';\nimport { isEsmWorkspace } from '../../utils/module-format.js';\nimport { ensureProjectPackageJson } from '../../utils/project-package-json.js';\nimport { configureBiomeLint } from './biome.js';\nimport type { ConfigureProjectOptions } from './types.js';\nimport { configureVitest, type VITEST_DEPENDENCIES } from './vitest.js';\n\ninterface TsConfigReference {\n path: string;\n}\n\n/**\n * Merges new TypeScript project references into existing ones, deduplicating by\n * path and preserving the order of existing references so re-running a\n * generator neither duplicates nor reorders references.\n */\nexport const mergeTsReferences = (\n existing: TsConfigReference[] | undefined,\n toAdd: TsConfigReference[],\n): TsConfigReference[] => {\n const references = [...(existing ?? [])];\n const existingPaths = new Set(references.map((ref) => ref.path));\n for (const ref of toAdd) {\n if (!existingPaths.has(ref.path)) {\n references.push(ref);\n existingPaths.add(ref.path);\n }\n }\n return references;\n};\n\n/**\n * Updates typescript projects\n */\nexport const configureTsProject = async <const D extends DependencyDeclaration>(\n tree: Tree,\n options: ConfigureProjectOptions,\n declaration: D & MustDeclare<typeof VITEST_DEPENDENCIES, D>,\n) => {\n // Point users at init when the workspace hasn't been configured, since\n // lint/format targets and workspace dependency sync depend on it.\n if (!tree.exists(AWS_NX_PLUGIN_CONFIG_FILE_NAME)) {\n logger.warn(\n `This workspace has no ${AWS_NX_PLUGIN_CONFIG_FILE_NAME} — run 'nx g @aws/nx-plugin:init' (or 'nx add @aws/nx-plugin') to configure linting, formatting and workspace dependency sync.`,\n );\n }\n\n // When the caller doesn't specify a module format, infer it from the\n // workspace root package.json (defaulting to ESM for a fresh workspace).\n const esm = options.esm ?? isEsmWorkspace(tree);\n\n // Remove a conflicting `module: commonjs` from the project tsconfig.json\n // (CommonJS is configured on tsconfig.lib.json below when needed).\n updateJson(tree, join(options.dir, 'tsconfig.json'), (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n module:\n tsConfig.compilerOptions?.module === 'commonjs'\n ? undefined\n : tsConfig.compilerOptions?.module,\n },\n }));\n const outDirToRootRelativePath = relative(\n join(tree.root, options.dir),\n tree.root,\n );\n const distDir = join(outDirToRootRelativePath, 'dist', options.dir, 'tsc');\n // Remove baseUrl and rootDir from the tsconfig.lib.json\n if (tree.exists(join(options.dir, 'tsconfig.lib.json'))) {\n updateJson(tree, join(options.dir, 'tsconfig.lib.json'), (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n baseUrl: undefined,\n rootDir: '.',\n outDir: distDir,\n tsBuildInfoFile: join(distDir, 'tsconfig.lib.tsbuildinfo'),\n // @nx/js configures the lib for ESM (module `nodenext`). CommonJS\n // projects use `node16`, which honours the workspace's\n // `type: commonjs`, emits CommonJS and resolves extensionless relative\n // imports. (Plain `commonjs`/`node` is deprecated in TypeScript 6.)\n ...(esm ? {} : { module: 'node16', moduleResolution: 'node16' }),\n },\n }));\n }\n // Update root project tsconfig\n updateJson(tree, 'tsconfig.base.json', (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n // baseUrl is deprecated in TypeScript 6 — use ./ prefix in paths instead\n baseUrl: undefined,\n rootDir: '.',\n paths: {\n ...tsConfig.compilerOptions?.paths,\n [options.fullyQualifiedName]: [\n `./${joinPathFragments(options.dir, 'src', 'index.ts')}`,\n ],\n },\n },\n }));\n if (tree.exists('tsconfig.json')) {\n updateJson(tree, 'tsconfig.json', (tsConfig) => ({\n ...tsConfig,\n // Add project references, deduplicating and preserving existing order\n references: mergeTsReferences(tsConfig.references, [\n { path: `./${options.dir}` },\n ]),\n }));\n }\n // Every project carries a minimal private package.json so the workspace\n // follows the standard npm package layout (see ensureProjectPackageJson).\n ensureProjectPackageJson(tree, {\n dir: options.dir,\n fullyQualifiedName: options.fullyQualifiedName,\n esm,\n });\n\n await configureBiomeLint(tree, options);\n await configureVitest(\n tree,\n options,\n forDependencies<typeof VITEST_DEPENDENCIES>(declaration),\n );\n\n // If license checking is configured, make this project's lint target depend\n // on the root license-check target. No-op if there's no license-check target\n // (i.e. the license generator hasn't run); the license generator wires up\n // existing projects itself, so this works regardless of generator order.\n addLicenseCheckToLintTarget(tree, options.fullyQualifiedName);\n};\n"],"names":["joinPathFragments","logger","updateJson","join","relative","addLicenseCheckToLintTarget","AWS_NX_PLUGIN_CONFIG_FILE_NAME","forDependencies","isEsmWorkspace","ensureProjectPackageJson","configureBiomeLint","configureVitest","mergeTsReferences","existing","toAdd","references","existingPaths","Set","map","ref","path","has","push","add","configureTsProject","tree","options","declaration","exists","warn","esm","dir","tsConfig","compilerOptions","module","undefined","outDirToRootRelativePath","root","distDir","baseUrl","rootDir","outDir","tsBuildInfoFile","moduleResolution","paths","fullyQualifiedName"],"mappings":"AAAA;;;CAGC,GACD,SAASA,iBAAiB,EAAEC,MAAM,EAAaC,UAAU,QAAQ,aAAa;AAC9E,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AACtC,SAASC,2BAA2B,QAAQ,0BAA0B;AACtE,SAASC,8BAA8B,QAAQ,8BAA8B;AAC7E,SAEEC,eAAe,QAEV,uCAAuC;AAC9C,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,wBAAwB,QAAQ,sCAAsC;AAC/E,SAASC,kBAAkB,QAAQ,aAAa;AAEhD,SAASC,eAAe,QAAkC,cAAc;AAMxE;;;;CAIC,GACD,OAAO,MAAMC,oBAAoB,CAC/BC,UACAC;IAEA,MAAMC,aAAa;WAAKF,YAAY,EAAE;KAAE;IACxC,MAAMG,gBAAgB,IAAIC,IAAIF,WAAWG,GAAG,CAAC,CAACC,MAAQA,IAAIC,IAAI;IAC9D,KAAK,MAAMD,OAAOL,MAAO;QACvB,IAAI,CAACE,cAAcK,GAAG,CAACF,IAAIC,IAAI,GAAG;YAChCL,WAAWO,IAAI,CAACH;YAChBH,cAAcO,GAAG,CAACJ,IAAIC,IAAI;QAC5B;IACF;IACA,OAAOL;AACT,EAAE;AAEF;;CAEC,GACD,OAAO,MAAMS,qBAAqB,OAChCC,MACAC,SACAC;IAEA,uEAAuE;IACvE,kEAAkE;IAClE,IAAI,CAACF,KAAKG,MAAM,CAACtB,iCAAiC;QAChDL,OAAO4B,IAAI,CACT,CAAC,sBAAsB,EAAEvB,+BAA+B,8HAA8H,CAAC;IAE3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AE;wBAC5B,CAAC,EAAE,EAAE7C,kBAAkB0B,QAAQK,GAAG,EAAE,OAAO,aAAa;qBACzD;gBACH;YACF;QACF,CAAA;IACA,IAAIN,KAAKG,MAAM,CAAC,kBAAkB;QAChC1B,WAAWuB,MAAM,iBAAiB,CAACO,WAAc,CAAA;gBAC/C,GAAGA,QAAQ;gBACX,sEAAsE;gBACtEjB,YAAYH,kBAAkBoB,SAASjB,UAAU,EAAE;oBACjD;wBAAEK,MAAM,CAAC,EAAE,EAAEM,QAAQK,GAAG,EAAE;oBAAC;iBAC5B;YACH,CAAA;IACF;IACA,wEAAwE;IACxE,0EAA0E;IAC1EtB,yBAAyBgB,MAAM;QAC7BM,KAAKL,QAAQK,GAAG;QAChBc,oBAAoBnB,QAAQmB,kBAAkB;QAC9Cf;IACF;IAEA,MAAMpB,mBAAmBe,MAAMC;IAC/B,MAAMf,gBACJc,MACAC,SACAnB,gBAA4CoB;IAG9C,4EAA4E;IAC5E,6EAA6E;IAC7E,0EAA0E;IAC1E,yEAAyE;IACzEtB,4BAA4BoB,MAAMC,QAAQmB,kBAAkB;AAC9D,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/ts-project-utils.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { joinPathFragments, logger, type Tree, updateJson } from '@nx/devkit';\nimport { join, relative } from 'path';\nimport { addLicenseCheckToLintTarget } from '../../license/config.js';\nimport { addTsDependencies } from '../../utils/add-dependencies.js';\nimport { AWS_NX_PLUGIN_CONFIG_FILE_NAME } from '../../utils/config/utils.js';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from '../../utils/declared-dependencies.js';\nimport { isEsmWorkspace } from '../../utils/module-format.js';\nimport { ensureProjectPackageJson } from '../../utils/project-package-json.js';\nimport type { ITsDepVersion } from '../../utils/versions.js';\nimport { configureBiomeLint } from './biome.js';\nimport type { ConfigureProjectOptions } from './types.js';\nimport { configureVitest, type VITEST_DEPENDENCIES } from './vitest.js';\n\ninterface TsConfigReference {\n path: string;\n}\n\n/**\n * Dependencies a caller must declare to configure a TypeScript project.\n *\n * `@nx/js` writes `types: ['node']` into every project's `tsconfig.lib.json`, so\n * the types must be declared for `tsc` to resolve them. Declared twice: on the\n * project whose tsconfig names them, and at the root, which `@nx/js` seeded until\n * Nx 23.2 stopped.\n */\nexport const TS_PROJECT_DEPENDENCIES = [\n { name: '@types/node', dev: true },\n { name: '@types/node', dev: true, root: true },\n] as const satisfies readonly {\n name: ITsDepVersion;\n dev?: boolean;\n root?: boolean;\n}[];\n\n/**\n * Merges new TypeScript project references into existing ones, deduplicating by\n * path and preserving the order of existing references so re-running a\n * generator neither duplicates nor reorders references.\n */\nexport const mergeTsReferences = (\n existing: TsConfigReference[] | undefined,\n toAdd: TsConfigReference[],\n): TsConfigReference[] => {\n const references = [...(existing ?? [])];\n const existingPaths = new Set(references.map((ref) => ref.path));\n for (const ref of toAdd) {\n if (!existingPaths.has(ref.path)) {\n references.push(ref);\n existingPaths.add(ref.path);\n }\n }\n return references;\n};\n\n/**\n * Updates typescript projects\n */\nexport const configureTsProject = async <const D extends DependencyDeclaration>(\n tree: Tree,\n options: ConfigureProjectOptions,\n declaration: D &\n MustDeclare<typeof VITEST_DEPENDENCIES, D> &\n MustDeclare<typeof TS_PROJECT_DEPENDENCIES, D>,\n) => {\n // Point users at init when the workspace hasn't been configured, since\n // lint/format targets and workspace dependency sync depend on it.\n if (!tree.exists(AWS_NX_PLUGIN_CONFIG_FILE_NAME)) {\n logger.warn(\n `This workspace has no ${AWS_NX_PLUGIN_CONFIG_FILE_NAME} — run 'nx g @aws/nx-plugin:init' (or 'nx add @aws/nx-plugin') to configure linting, formatting and workspace dependency sync.`,\n );\n }\n\n // When the caller doesn't specify a module format, infer it from the\n // workspace root package.json (defaulting to ESM for a fresh workspace).\n const esm = options.esm ?? isEsmWorkspace(tree);\n\n // Remove a conflicting `module: commonjs` from the project tsconfig.json\n // (CommonJS is configured on tsconfig.lib.json below when needed).\n updateJson(tree, join(options.dir, 'tsconfig.json'), (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n module:\n tsConfig.compilerOptions?.module === 'commonjs'\n ? undefined\n : tsConfig.compilerOptions?.module,\n },\n }));\n const outDirToRootRelativePath = relative(\n join(tree.root, options.dir),\n tree.root,\n );\n const distDir = join(outDirToRootRelativePath, 'dist', options.dir, 'tsc');\n // Remove baseUrl and rootDir from the tsconfig.lib.json\n if (tree.exists(join(options.dir, 'tsconfig.lib.json'))) {\n updateJson(tree, join(options.dir, 'tsconfig.lib.json'), (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n baseUrl: undefined,\n rootDir: '.',\n outDir: distDir,\n tsBuildInfoFile: join(distDir, 'tsconfig.lib.tsbuildinfo'),\n // @nx/js configures the lib for ESM (module `nodenext`). CommonJS\n // projects use `node16`, which honours the workspace's\n // `type: commonjs`, emits CommonJS and resolves extensionless relative\n // imports. (Plain `commonjs`/`node` is deprecated in TypeScript 6.)\n ...(esm ? {} : { module: 'node16', moduleResolution: 'node16' }),\n },\n }));\n }\n // Update root project tsconfig\n updateJson(tree, 'tsconfig.base.json', (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n // baseUrl is deprecated in TypeScript 6 — use ./ prefix in paths instead\n baseUrl: undefined,\n rootDir: '.',\n paths: {\n ...tsConfig.compilerOptions?.paths,\n [options.fullyQualifiedName]: [\n `./${joinPathFragments(options.dir, 'src', 'index.ts')}`,\n ],\n },\n },\n }));\n if (tree.exists('tsconfig.json')) {\n updateJson(tree, 'tsconfig.json', (tsConfig) => ({\n ...tsConfig,\n // Add project references, deduplicating and preserving existing order\n references: mergeTsReferences(tsConfig.references, [\n { path: `./${options.dir}` },\n ]),\n }));\n }\n // Every project carries a minimal private package.json so the workspace\n // follows the standard npm package layout (see ensureProjectPackageJson).\n ensureProjectPackageJson(tree, {\n dir: options.dir,\n fullyQualifiedName: options.fullyQualifiedName,\n esm,\n });\n\n // From this helper's constant, not the caller's declaration, which marks these\n // `ownedElsewhere` because the install happens here.\n addTsDependencies(\n tree,\n { ts: [...TS_PROJECT_DEPENDENCIES], py: [] },\n { projectRoot: options.dir },\n );\n\n await configureBiomeLint(tree, options);\n await configureVitest(\n tree,\n options,\n forDependencies<typeof VITEST_DEPENDENCIES>(declaration),\n );\n\n // If license checking is configured, make this project's lint target depend\n // on the root license-check target. No-op if there's no license-check target\n // (i.e. the license generator hasn't run); the license generator wires up\n // existing projects itself, so this works regardless of generator order.\n addLicenseCheckToLintTarget(tree, options.fullyQualifiedName);\n};\n"],"names":["joinPathFragments","logger","updateJson","join","relative","addLicenseCheckToLintTarget","addTsDependencies","AWS_NX_PLUGIN_CONFIG_FILE_NAME","forDependencies","isEsmWorkspace","ensureProjectPackageJson","configureBiomeLint","configureVitest","TS_PROJECT_DEPENDENCIES","name","dev","root","mergeTsReferences","existing","toAdd","references","existingPaths","Set","map","ref","path","has","push","add","configureTsProject","tree","options","declaration","exists","warn","esm","dir","tsConfig","compilerOptions","module","undefined","outDirToRootRelativePath","distDir","baseUrl","rootDir","outDir","tsBuildInfoFile","moduleResolution","paths","fullyQualifiedName","ts","py","projectRoot"],"mappings":"AAAA;;;CAGC,GACD,SAASA,iBAAiB,EAAEC,MAAM,EAAaC,UAAU,QAAQ,aAAa;AAC9E,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AACtC,SAASC,2BAA2B,QAAQ,0BAA0B;AACtE,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,SAASC,8BAA8B,QAAQ,8BAA8B;AAC7E,SAEEC,eAAe,QAEV,uCAAuC;AAC9C,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,wBAAwB,QAAQ,sCAAsC;AAE/E,SAASC,kBAAkB,QAAQ,aAAa;AAEhD,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B,QAAQkB,kBAAkB;QAC9Cd;IACF;IAEA,+EAA+E;IAC/E,qDAAqD;IACrD7B,kBACEwB,MACA;QAAEoB,IAAI;eAAIrC;SAAwB;QAAEsC,IAAI,EAAE;IAAC,GAC3C;QAAEC,aAAarB,QAAQK,GAAG;IAAC;IAG7B,MAAMzB,mBAAmBmB,MAAMC;IAC/B,MAAMnB,gBACJkB,MACAC,SACAvB,gBAA4CwB;IAG9C,4EAA4E;IAC5E,6EAA6E;IAC7E,0EAA0E;IAC1E,yEAAyE;IACzE3B,4BAA4ByB,MAAMC,QAAQkB,kBAAkB;AAC9D,EAAE"}
|
package/src/ts/lib/vitest.d.ts
CHANGED
|
@@ -23,5 +23,11 @@ export declare const VITEST_DEPENDENCIES: readonly [{
|
|
|
23
23
|
readonly name: "vitest";
|
|
24
24
|
}, {
|
|
25
25
|
readonly name: "@vitest/coverage-v8";
|
|
26
|
+
}, {
|
|
27
|
+
readonly name: "jsdom";
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "@nx/vitest";
|
|
30
|
+
readonly dev: true;
|
|
31
|
+
readonly root: true;
|
|
26
32
|
}];
|
|
27
33
|
export declare const configureVitest: <const D extends DependencyDeclaration>(tree: Tree, options: ConfigureProjectOptions, declaration: D & MustDeclare<typeof VITEST_DEPENDENCIES, D>) => Promise<void>;
|
package/src/ts/lib/vitest.js
CHANGED
|
@@ -57,6 +57,19 @@ const readGritPattern = (name)=>readFileSync(join(import.meta.dirname, 'grit', `
|
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
name: '@vitest/coverage-v8'
|
|
60
|
+
},
|
|
61
|
+
// `@nx/vitest` writes `environment: 'jsdom'` into the config it generates.
|
|
62
|
+
{
|
|
63
|
+
name: 'jsdom'
|
|
64
|
+
},
|
|
65
|
+
// Registered in nx.json as an inferred-target plugin, so it must resolve when
|
|
66
|
+
// Nx builds the project graph. `@nx/js` installed it until Nx 23.2, which now
|
|
67
|
+
// only reaches for it transiently while its generator runs. Like the other nx
|
|
68
|
+
// packages it upgrades through `packageJsonUpdates`, not the version sync.
|
|
69
|
+
{
|
|
70
|
+
name: '@nx/vitest',
|
|
71
|
+
dev: true,
|
|
72
|
+
root: true
|
|
60
73
|
}
|
|
61
74
|
];
|
|
62
75
|
export const configureVitest = async (tree, options, declaration)=>{
|
|
@@ -93,7 +106,9 @@ export const configureVitest = async (tree, options, declaration)=>{
|
|
|
93
106
|
addDependenciesToPackageJson(tree, {}, withVersions(forDependencies(declaration), [
|
|
94
107
|
'vite',
|
|
95
108
|
'vitest',
|
|
96
|
-
'@vitest/coverage-v8'
|
|
109
|
+
'@vitest/coverage-v8',
|
|
110
|
+
'jsdom',
|
|
111
|
+
'@nx/vitest'
|
|
97
112
|
]));
|
|
98
113
|
};
|
|
99
114
|
|
package/src/ts/lib/vitest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/vitest.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 readNxJson,\n type Tree,\n updateNxJson,\n} from '@nx/devkit';\nimport { readFileSync } from 'fs';\nimport { join, relative } from 'path';\nimport { applyGritQL } from '../../utils/ast.js';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from '../../utils/declared-dependencies.js';\nimport { addDependenciesToPackageJson } from '../../utils/dependencies.js';\nimport { type ITsDepVersion, withVersions } from '../../utils/versions.js';\nimport type { ConfigureProjectOptions } from './types.js';\n\nconst readGritPattern = (name: string): string =>\n readFileSync(\n join(import.meta.dirname, 'grit', `${name}.grit`),\n 'utf-8',\n ).trim();\n\n/**\n * Resolve the config's `root` from `import.meta.dirname`.\n *\n * `@nx/js` writes `root: __dirname`, which Vite's native config loader does not\n * provide — it warns today and will reject once `configLoader: 'native'` becomes\n * the default. Scoped with `some` to a direct property of the object the config\n * factory returns, so a nested `root` (a `test.alias` entry, say) is untouched.\n */\nconst ROOT_IMPORT_META_DIRNAME = `\\`defineConfig(() => ({ $props }))\\` where {\n $props <: some \\`root: __dirname\\` as $root,\n $root => \\`root: import.meta.dirname\\`\n}`;\n\n/** The `reportsDirectory` `@nx/vitest` writes, resolved against the project root. */\nexport const GENERATED_REPORTS_DIRECTORY = './test-output/vitest/coverage';\n\n/**\n * The coverage directory for a project, as a path relative to the project root\n * (vitest resolves `reportsDirectory` against the config's `root`).\n *\n * Coverage lands under the workspace's `dist` rather than inside the project, so\n * the HTML reporter's vendored assets are neither formatted by the `format`\n * target nor counted as an input to the project's own tasks.\n */\nexport const getCoverageReportsDirectory = (dir: string): string =>\n joinPathFragments(\n relative(join('/', dir), '/'),\n 'dist',\n dir,\n 'test-output/vitest/coverage',\n );\n\n/**\n * Point coverage at the project's `dist` directory.\n *\n * `@nx/vitest` writes `reportsDirectory: './test-output/vitest/coverage'`, which\n * resolves inside the project. Coverage is off by default, so the directory is\n * dormant until someone runs `vitest --coverage` — at which point the HTML\n * reporter's bundled third-party scripts land in the project, where the `format`\n * target reformats them (failing the build from then on) and the `default` named\n * input counts them, so no task in the project can ever be cached again.\n *\n * Anchored to the exact literal `@nx/vitest` generates, and scoped to the\n * `coverage` block of the config's own `test` object, so a directory the user has\n * repointed is left alone.\n */\nconst coverageReportsDirectoryPattern = (dir: string): string =>\n `\\`test: { $props }\\` where {\n $props <: within \\`defineConfig($_)\\`,\n $props <: some \\`coverage: { $cov }\\`,\n $cov <: some \\`reportsDirectory: '${GENERATED_REPORTS_DIRECTORY}'\\` as $reportsDirectory,\n $reportsDirectory => \\`reportsDirectory: '${getCoverageReportsDirectory(dir)}'\\`\n}`;\n\n/** Dependencies a caller must declare to configure vitest. */\nexport const VITEST_DEPENDENCIES = [\n { name: 'vite' },\n { name: 'vitest' },\n { name: '@vitest/coverage-v8' },\n] as const satisfies readonly {
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/vitest.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 readNxJson,\n type Tree,\n updateNxJson,\n} from '@nx/devkit';\nimport { readFileSync } from 'fs';\nimport { join, relative } from 'path';\nimport { applyGritQL } from '../../utils/ast.js';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from '../../utils/declared-dependencies.js';\nimport { addDependenciesToPackageJson } from '../../utils/dependencies.js';\nimport { type ITsDepVersion, withVersions } from '../../utils/versions.js';\nimport type { ConfigureProjectOptions } from './types.js';\n\nconst readGritPattern = (name: string): string =>\n readFileSync(\n join(import.meta.dirname, 'grit', `${name}.grit`),\n 'utf-8',\n ).trim();\n\n/**\n * Resolve the config's `root` from `import.meta.dirname`.\n *\n * `@nx/js` writes `root: __dirname`, which Vite's native config loader does not\n * provide — it warns today and will reject once `configLoader: 'native'` becomes\n * the default. Scoped with `some` to a direct property of the object the config\n * factory returns, so a nested `root` (a `test.alias` entry, say) is untouched.\n */\nconst ROOT_IMPORT_META_DIRNAME = `\\`defineConfig(() => ({ $props }))\\` where {\n $props <: some \\`root: __dirname\\` as $root,\n $root => \\`root: import.meta.dirname\\`\n}`;\n\n/** The `reportsDirectory` `@nx/vitest` writes, resolved against the project root. */\nexport const GENERATED_REPORTS_DIRECTORY = './test-output/vitest/coverage';\n\n/**\n * The coverage directory for a project, as a path relative to the project root\n * (vitest resolves `reportsDirectory` against the config's `root`).\n *\n * Coverage lands under the workspace's `dist` rather than inside the project, so\n * the HTML reporter's vendored assets are neither formatted by the `format`\n * target nor counted as an input to the project's own tasks.\n */\nexport const getCoverageReportsDirectory = (dir: string): string =>\n joinPathFragments(\n relative(join('/', dir), '/'),\n 'dist',\n dir,\n 'test-output/vitest/coverage',\n );\n\n/**\n * Point coverage at the project's `dist` directory.\n *\n * `@nx/vitest` writes `reportsDirectory: './test-output/vitest/coverage'`, which\n * resolves inside the project. Coverage is off by default, so the directory is\n * dormant until someone runs `vitest --coverage` — at which point the HTML\n * reporter's bundled third-party scripts land in the project, where the `format`\n * target reformats them (failing the build from then on) and the `default` named\n * input counts them, so no task in the project can ever be cached again.\n *\n * Anchored to the exact literal `@nx/vitest` generates, and scoped to the\n * `coverage` block of the config's own `test` object, so a directory the user has\n * repointed is left alone.\n */\nconst coverageReportsDirectoryPattern = (dir: string): string =>\n `\\`test: { $props }\\` where {\n $props <: within \\`defineConfig($_)\\`,\n $props <: some \\`coverage: { $cov }\\`,\n $cov <: some \\`reportsDirectory: '${GENERATED_REPORTS_DIRECTORY}'\\` as $reportsDirectory,\n $reportsDirectory => \\`reportsDirectory: '${getCoverageReportsDirectory(dir)}'\\`\n}`;\n\n/** Dependencies a caller must declare to configure vitest. */\nexport const VITEST_DEPENDENCIES = [\n { name: 'vite' },\n { name: 'vitest' },\n { name: '@vitest/coverage-v8' },\n // `@nx/vitest` writes `environment: 'jsdom'` into the config it generates.\n { name: 'jsdom' },\n // Registered in nx.json as an inferred-target plugin, so it must resolve when\n // Nx builds the project graph. `@nx/js` installed it until Nx 23.2, which now\n // only reaches for it transiently while its generator runs. Like the other nx\n // packages it upgrades through `packageJsonUpdates`, not the version sync.\n { name: '@nx/vitest', dev: true, root: true },\n] as const satisfies readonly {\n name: ITsDepVersion;\n dev?: boolean;\n root?: boolean;\n}[];\n\nexport const configureVitest = async <const D extends DependencyDeclaration>(\n tree: Tree,\n options: ConfigureProjectOptions,\n declaration: D & MustDeclare<typeof VITEST_DEPENDENCIES, D>,\n) => {\n // Find vitest.config.mts or vite.config.mts\n const configPath = [\n join(options.dir, 'vitest.config.mts'),\n join(options.dir, 'vite.config.mts'),\n ].find((config) => tree.exists(config));\n\n if (configPath) {\n await applyGritQL(\n tree,\n configPath,\n readGritPattern('vitest-pass-with-no-tests'),\n );\n\n await applyGritQL(tree, configPath, ROOT_IMPORT_META_DIRNAME);\n\n await applyGritQL(\n tree,\n configPath,\n coverageReportsDirectoryPattern(options.dir),\n );\n\n const nxJson = readNxJson(tree);\n updateNxJson(tree, {\n ...nxJson,\n targetDefaults: {\n ...(nxJson.targetDefaults ?? {}),\n '@nx/vitest:test': {\n cache: true,\n inputs: ['default', '^production'],\n configurations: {\n 'update-snapshot': {\n args: '--update',\n },\n },\n ...nxJson.targetDefaults['@nx/vitest:test'],\n },\n },\n });\n }\n\n addDependenciesToPackageJson(\n tree,\n {},\n withVersions(forDependencies<typeof VITEST_DEPENDENCIES>(declaration), [\n 'vite',\n 'vitest',\n '@vitest/coverage-v8',\n 'jsdom',\n '@nx/vitest',\n ]),\n );\n};\n"],"names":["joinPathFragments","readNxJson","updateNxJson","readFileSync","join","relative","applyGritQL","forDependencies","addDependenciesToPackageJson","withVersions","readGritPattern","name","dirname","trim","ROOT_IMPORT_META_DIRNAME","GENERATED_REPORTS_DIRECTORY","getCoverageReportsDirectory","dir","coverageReportsDirectoryPattern","VITEST_DEPENDENCIES","dev","root","configureVitest","tree","options","declaration","configPath","find","config","exists","nxJson","targetDefaults","cache","inputs","configurations","args"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,EACjBC,UAAU,EAEVC,YAAY,QACP,aAAa;AACpB,SAASC,YAAY,QAAQ,KAAK;AAClC,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AACtC,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAEEC,eAAe,QAEV,uCAAuC;AAC9C,SAASC,4BAA4B,QAAQ,8BAA8B;AAC3E,SAA6BC,YAAY,QAAQ,0BAA0B;AAG3E,MAAMC,kBAAkB,CAACC,OACvBR,aACEC,KAAK,YAAYQ,OAAO,EAAE,QAAQ,GAAGD,KAAK,KAAK,CAAC,GAChD,SACAE,IAAI;AAER;;;;;;;CAOC,GACD,MAAMC,2BAA2B,CAAC;;;CAGjC,CAAC;AAEF,mFAAmF,GACnF,OAAO,MAAMC,8BAA8B,gCAAgC;AAE3E;;;;;;;CAOC,GACD,OAAO,MAAMC,8BAA8B,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CkB,cAAc;QACrE;QACA;QACA;QACA;QACA;KACD;AAEL,EAAE"}
|
|
@@ -81,6 +81,27 @@ export declare const DEPENDENCIES: import("../../../utils/declared-dependencies.
|
|
|
81
81
|
readonly name: "@vitest/coverage-v8";
|
|
82
82
|
} & {
|
|
83
83
|
versionOnly: true;
|
|
84
|
+
}, {
|
|
85
|
+
readonly name: "jsdom";
|
|
86
|
+
} & {
|
|
87
|
+
versionOnly: true;
|
|
88
|
+
}, {
|
|
89
|
+
readonly name: "@nx/vitest";
|
|
90
|
+
readonly dev: true;
|
|
91
|
+
readonly root: true;
|
|
92
|
+
} & {
|
|
93
|
+
versionOnly: true;
|
|
94
|
+
}, {
|
|
95
|
+
readonly name: "@types/node";
|
|
96
|
+
readonly dev: true;
|
|
97
|
+
} & {
|
|
98
|
+
versionOnly: true;
|
|
99
|
+
}, {
|
|
100
|
+
readonly name: "@types/node";
|
|
101
|
+
readonly dev: true;
|
|
102
|
+
readonly root: true;
|
|
103
|
+
} & {
|
|
104
|
+
versionOnly: true;
|
|
84
105
|
}], readonly import("../../../utils/declared-dependencies.js").DeclaredPyDependency<"ruff" | "a2a-sdk" | "ag-ui-langgraph" | "ag-ui-protocol" | "ag-ui-strands" | "aiosqlite" | "aws-lambda-powertools" | "aws-lambda-powertools[tracer]" | "aws-lambda-powertools[parser]" | "aws-opentelemetry-distro" | "bedrock-agentcore" | "boto3" | "checkov" | "fastapi" | "fastapi[standard]" | "httpx" | "langchain" | "langchain-aws" | "langchain-mcp-adapters" | "langgraph" | "langgraph-checkpoint-aws" | "langgraph-checkpoint-sqlite" | "mcp" | "pip-check-updates" | "pip-licenses" | "strands-agents" | "strands-agents[a2a]" | "strands-agents-tools" | "ty" | "pynamodb" | "uvicorn" | "sqlmodel" | "alembic" | "aiomysql" | "asyncpg" | "greenlet", AgUiMetadata>[]>;
|
|
85
106
|
export type AgUiAuth = 'iam' | 'cognito' | 'none';
|
|
86
107
|
export type AgUiTheme = 'cloudscape' | 'shadcn' | 'default';
|
|
@@ -1058,8 +1058,6 @@ vitest.config.*.timestamp*
|
|
|
1058
1058
|
runtime-config.json"
|
|
1059
1059
|
`;
|
|
1060
1060
|
|
|
1061
|
-
exports[`react-website generator > Tanstack router integration > should generate website with no router correctly > .prettierrc 1`] = `"{"singleQuote":true}"`;
|
|
1062
|
-
|
|
1063
1061
|
exports[`react-website generator > Tanstack router integration > should generate website with no router correctly > biome.json 1`] = `
|
|
1064
1062
|
"{
|
|
1065
1063
|
"$schema": "https://biomejs.dev/schemas/2.5.11/schema.json",
|
|
@@ -1243,11 +1241,11 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
1243
1241
|
"name": "@proj/source",
|
|
1244
1242
|
"dependencies": {},
|
|
1245
1243
|
"devDependencies": {
|
|
1246
|
-
"@nx/js": "23.
|
|
1244
|
+
"@nx/js": "23.2.0",
|
|
1247
1245
|
"@nx/react": "catalog:",
|
|
1248
|
-
"@nx/vite": "23.
|
|
1249
|
-
"@nx/vitest": "
|
|
1250
|
-
"@nx/web": "23.
|
|
1246
|
+
"@nx/vite": "23.2.0",
|
|
1247
|
+
"@nx/vitest": "catalog:",
|
|
1248
|
+
"@nx/web": "23.2.0",
|
|
1251
1249
|
"@swc/helpers": "~0.5.18",
|
|
1252
1250
|
"@tailwindcss/vite": "catalog:",
|
|
1253
1251
|
"@testing-library/dom": "10.4.0",
|
|
@@ -1259,7 +1257,7 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
1259
1257
|
"@vitest/coverage-v8": "catalog:",
|
|
1260
1258
|
"@vitest/ui": "catalog:",
|
|
1261
1259
|
"jiti": "2.4.2",
|
|
1262
|
-
"jsdom": "
|
|
1260
|
+
"jsdom": "catalog:",
|
|
1263
1261
|
"typescript": "~6.0.3",
|
|
1264
1262
|
"vite": "catalog:",
|
|
1265
1263
|
"vitest": "catalog:"
|
|
@@ -2327,19 +2325,21 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
2327
2325
|
- test-app
|
|
2328
2326
|
- packages/common/*
|
|
2329
2327
|
catalog:
|
|
2328
|
+
'@types/node': 26.4.0
|
|
2330
2329
|
vite: 8.2.2
|
|
2331
2330
|
vitest: 4.1.11
|
|
2332
2331
|
'@vitest/coverage-v8': 4.1.11
|
|
2332
|
+
jsdom: 27.4.0
|
|
2333
|
+
'@nx/vitest': 23.2.0
|
|
2333
2334
|
constructs: 10.8.1
|
|
2334
2335
|
aws-cdk-lib: 2.267.0
|
|
2335
|
-
'@types/node': 26.4.0
|
|
2336
2336
|
react: 19.2.8
|
|
2337
2337
|
react-dom: 19.2.8
|
|
2338
2338
|
'@cloudscape-design/components': 3.0.1356
|
|
2339
2339
|
'@cloudscape-design/board-components': 3.0.221
|
|
2340
2340
|
'@cloudscape-design/global-styles': 1.0.67
|
|
2341
2341
|
tailwindcss: 4.3.3
|
|
2342
|
-
'@nx/react': 23.
|
|
2342
|
+
'@nx/react': 23.2.0
|
|
2343
2343
|
'@vitest/ui': 4.1.11
|
|
2344
2344
|
'@tailwindcss/vite': 4.3.3
|
|
2345
2345
|
"
|
|
@@ -2429,7 +2429,9 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
2429
2429
|
"react-dom": "catalog:",
|
|
2430
2430
|
"tailwindcss": "catalog:"
|
|
2431
2431
|
},
|
|
2432
|
-
"devDependencies": {
|
|
2432
|
+
"devDependencies": {
|
|
2433
|
+
"@types/node": "catalog:"
|
|
2434
|
+
}
|
|
2433
2435
|
}
|
|
2434
2436
|
"
|
|
2435
2437
|
`;
|
|
@@ -2908,7 +2910,7 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
2908
2910
|
"
|
|
2909
2911
|
`;
|
|
2910
2912
|
|
|
2911
|
-
exports[`react-website generator > Tanstack router integration > should generate website with no router correctly > vitest.config.
|
|
2913
|
+
exports[`react-website generator > Tanstack router integration > should generate website with no router correctly > vitest.config.mts 1`] = `
|
|
2912
2914
|
"import { defineConfig } from 'vitest/config';
|
|
2913
2915
|
|
|
2914
2916
|
export default defineConfig({
|
|
@@ -2932,8 +2934,6 @@ vitest.config.*.timestamp*
|
|
|
2932
2934
|
runtime-config.json"
|
|
2933
2935
|
`;
|
|
2934
2936
|
|
|
2935
|
-
exports[`react-website generator > Tanstack router integration > should generate website with router correctly > .prettierrc 1`] = `"{"singleQuote":true}"`;
|
|
2936
|
-
|
|
2937
2937
|
exports[`react-website generator > Tanstack router integration > should generate website with router correctly > biome.json 1`] = `
|
|
2938
2938
|
"{
|
|
2939
2939
|
"$schema": "https://biomejs.dev/schemas/2.5.11/schema.json",
|
|
@@ -3117,11 +3117,11 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
3117
3117
|
"name": "@proj/source",
|
|
3118
3118
|
"dependencies": {},
|
|
3119
3119
|
"devDependencies": {
|
|
3120
|
-
"@nx/js": "23.
|
|
3120
|
+
"@nx/js": "23.2.0",
|
|
3121
3121
|
"@nx/react": "catalog:",
|
|
3122
|
-
"@nx/vite": "23.
|
|
3123
|
-
"@nx/vitest": "
|
|
3124
|
-
"@nx/web": "23.
|
|
3122
|
+
"@nx/vite": "23.2.0",
|
|
3123
|
+
"@nx/vitest": "catalog:",
|
|
3124
|
+
"@nx/web": "23.2.0",
|
|
3125
3125
|
"@swc/helpers": "~0.5.18",
|
|
3126
3126
|
"@tailwindcss/vite": "catalog:",
|
|
3127
3127
|
"@tanstack/router-generator": "catalog:",
|
|
@@ -3137,7 +3137,7 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
3137
3137
|
"@vitest/coverage-v8": "catalog:",
|
|
3138
3138
|
"@vitest/ui": "catalog:",
|
|
3139
3139
|
"jiti": "2.4.2",
|
|
3140
|
-
"jsdom": "
|
|
3140
|
+
"jsdom": "catalog:",
|
|
3141
3141
|
"typescript": "~6.0.3",
|
|
3142
3142
|
"vite": "catalog:",
|
|
3143
3143
|
"vitest": "catalog:"
|
|
@@ -4205,12 +4205,14 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
4205
4205
|
- test-app
|
|
4206
4206
|
- packages/common/*
|
|
4207
4207
|
catalog:
|
|
4208
|
+
'@types/node': 26.4.0
|
|
4208
4209
|
vite: 8.2.2
|
|
4209
4210
|
vitest: 4.1.11
|
|
4210
4211
|
'@vitest/coverage-v8': 4.1.11
|
|
4212
|
+
jsdom: 27.4.0
|
|
4213
|
+
'@nx/vitest': 23.2.0
|
|
4211
4214
|
constructs: 10.8.1
|
|
4212
4215
|
aws-cdk-lib: 2.267.0
|
|
4213
|
-
'@types/node': 26.4.0
|
|
4214
4216
|
react: 19.2.8
|
|
4215
4217
|
react-dom: 19.2.8
|
|
4216
4218
|
'@cloudscape-design/components': 3.0.1356
|
|
@@ -4218,7 +4220,7 @@ catalog:
|
|
|
4218
4220
|
'@cloudscape-design/global-styles': 1.0.67
|
|
4219
4221
|
tailwindcss: 4.3.3
|
|
4220
4222
|
'@tanstack/react-router': 1.170.32
|
|
4221
|
-
'@nx/react': 23.
|
|
4223
|
+
'@nx/react': 23.2.0
|
|
4222
4224
|
'@vitest/ui': 4.1.11
|
|
4223
4225
|
'@tailwindcss/vite': 4.3.3
|
|
4224
4226
|
'@tanstack/router-plugin': 1.168.35
|
|
@@ -4313,7 +4315,9 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
4313
4315
|
"react-dom": "catalog:",
|
|
4314
4316
|
"tailwindcss": "catalog:"
|
|
4315
4317
|
},
|
|
4316
|
-
"devDependencies": {
|
|
4318
|
+
"devDependencies": {
|
|
4319
|
+
"@types/node": "catalog:"
|
|
4320
|
+
}
|
|
4317
4321
|
}
|
|
4318
4322
|
"
|
|
4319
4323
|
`;
|
|
@@ -4985,7 +4989,7 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
4985
4989
|
"
|
|
4986
4990
|
`;
|
|
4987
4991
|
|
|
4988
|
-
exports[`react-website generator > Tanstack router integration > should generate website with router correctly > vitest.config.
|
|
4992
|
+
exports[`react-website generator > Tanstack router integration > should generate website with router correctly > vitest.config.mts 1`] = `
|
|
4989
4993
|
"import { defineConfig } from 'vitest/config';
|
|
4990
4994
|
|
|
4991
4995
|
export default defineConfig({
|
|
@@ -72,6 +72,17 @@ export declare const DEPENDENCIES: import("../../../utils/declared-dependencies.
|
|
|
72
72
|
}, {
|
|
73
73
|
readonly name: "express";
|
|
74
74
|
readonly versionOnly: true;
|
|
75
|
+
}, {
|
|
76
|
+
readonly name: "@types/node";
|
|
77
|
+
readonly dev: true;
|
|
78
|
+
} & {
|
|
79
|
+
versionOnly: true;
|
|
80
|
+
}, {
|
|
81
|
+
readonly name: "@types/node";
|
|
82
|
+
readonly dev: true;
|
|
83
|
+
readonly root: true;
|
|
84
|
+
} & {
|
|
85
|
+
versionOnly: true;
|
|
75
86
|
}, {
|
|
76
87
|
readonly name: "react";
|
|
77
88
|
} & {
|
|
@@ -116,6 +127,27 @@ export declare const DEPENDENCIES: import("../../../utils/declared-dependencies.
|
|
|
116
127
|
readonly name: "@vitest/coverage-v8";
|
|
117
128
|
} & {
|
|
118
129
|
versionOnly: true;
|
|
130
|
+
}, {
|
|
131
|
+
readonly name: "jsdom";
|
|
132
|
+
} & {
|
|
133
|
+
versionOnly: true;
|
|
134
|
+
}, {
|
|
135
|
+
readonly name: "@nx/vitest";
|
|
136
|
+
readonly dev: true;
|
|
137
|
+
readonly root: true;
|
|
138
|
+
} & {
|
|
139
|
+
versionOnly: true;
|
|
140
|
+
}, {
|
|
141
|
+
readonly name: "@types/node";
|
|
142
|
+
readonly dev: true;
|
|
143
|
+
} & {
|
|
144
|
+
versionOnly: true;
|
|
145
|
+
}, {
|
|
146
|
+
readonly name: "@types/node";
|
|
147
|
+
readonly dev: true;
|
|
148
|
+
readonly root: true;
|
|
149
|
+
} & {
|
|
150
|
+
versionOnly: true;
|
|
119
151
|
}, {
|
|
120
152
|
readonly name: "vite";
|
|
121
153
|
} & {
|
|
@@ -128,6 +160,16 @@ export declare const DEPENDENCIES: import("../../../utils/declared-dependencies.
|
|
|
128
160
|
readonly name: "@vitest/coverage-v8";
|
|
129
161
|
} & {
|
|
130
162
|
versionOnly: true;
|
|
163
|
+
}, {
|
|
164
|
+
readonly name: "jsdom";
|
|
165
|
+
} & {
|
|
166
|
+
versionOnly: true;
|
|
167
|
+
}, {
|
|
168
|
+
readonly name: "@nx/vitest";
|
|
169
|
+
readonly dev: true;
|
|
170
|
+
readonly root: true;
|
|
171
|
+
} & {
|
|
172
|
+
versionOnly: true;
|
|
131
173
|
}, {
|
|
132
174
|
readonly name: "constructs";
|
|
133
175
|
readonly when: (m: IacMetadata) => boolean;
|
|
@@ -23,7 +23,7 @@ import { PACKAGES_DIR, SHARED_SHADCN_DIR, TERRAFORM_WEBSITE_RUNTIME_CONFIG_FILE
|
|
|
23
23
|
import { addSharedShadcnDependency, SHADCN_DEPENDENCIES, sharedShadcnGenerator } from "../../../utils/shared-shadcn.js";
|
|
24
24
|
import { withVersions } from "../../../utils/versions.js";
|
|
25
25
|
import { addWebsiteInfra, WEBSITE_CONSTRUCTS_PY_DEPENDENCIES } from "../../../utils/website-constructs/website-constructs.js";
|
|
26
|
-
import { configureTsProject } from "../../lib/ts-project-utils.js";
|
|
26
|
+
import { configureTsProject, TS_PROJECT_DEPENDENCIES } from "../../lib/ts-project-utils.js";
|
|
27
27
|
import { VITEST_DEPENDENCIES } from "../../lib/vitest.js";
|
|
28
28
|
// Each entry names the branch it belongs to, so the same declaration drives both
|
|
29
29
|
// adding and the version sync.
|
|
@@ -108,6 +108,7 @@ export const DEPENDENCIES = declareDependencies()({
|
|
|
108
108
|
name: 'express',
|
|
109
109
|
versionOnly: true
|
|
110
110
|
},
|
|
111
|
+
...ownedElsewhere(TS_PROJECT_DEPENDENCIES),
|
|
111
112
|
...ownedElsewhere(SHADCN_DEPENDENCIES),
|
|
112
113
|
...ownedElsewhere(VITEST_DEPENDENCIES),
|
|
113
114
|
...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES)
|