@aws/nx-plugin 1.0.0-rc.53 → 1.0.0-rc.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/migrations.json +50 -0
- package/package.json +1 -1
- package/src/agentcore-gateway/gateway-connection/generator.js +3 -1
- package/src/agentcore-gateway/gateway-connection/generator.js.map +1 -1
- package/src/agentcore-gateway/generator.d.ts +49 -1
- package/src/agentcore-gateway/generator.js +55 -22
- package/src/agentcore-gateway/generator.js.map +1 -1
- package/src/agentcore-gateway/mcp-connection/generator.js +3 -1
- package/src/agentcore-gateway/mcp-connection/generator.js.map +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +2 -0
- package/src/infra/app/generator.d.ts +43 -0
- package/src/infra/app/generator.js +47 -18
- package/src/infra/app/generator.js.map +1 -1
- package/src/init/generator.d.ts +13 -0
- package/src/init/generator.js +14 -3
- package/src/init/generator.js.map +1 -1
- package/src/migrations/latest/backfill-generator-metadata/migration.d.ts +96 -0
- package/src/migrations/latest/backfill-generator-metadata/migration.js +670 -0
- package/src/migrations/latest/backfill-generator-metadata/migration.js.map +1 -0
- package/src/migrations/latest/order-access-log-delivery-after-bucket-policy/migration.d.ts +6 -0
- package/src/migrations/latest/order-access-log-delivery-after-bucket-policy/migration.js +94 -0
- package/src/migrations/latest/order-access-log-delivery-after-bucket-policy/migration.js.map +1 -0
- package/src/preset/generator.d.ts +13 -0
- package/src/preset/generator.js +12 -3
- package/src/preset/generator.js.map +1 -1
- package/src/py/agent/a2a-connection/generator.d.ts +24 -0
- package/src/py/agent/a2a-connection/generator.js +49 -20
- package/src/py/agent/a2a-connection/generator.js.map +1 -1
- package/src/py/agent/gateway-connection/generator.d.ts +23 -0
- package/src/py/agent/gateway-connection/generator.js +45 -11
- package/src/py/agent/gateway-connection/generator.js.map +1 -1
- package/src/py/agent/generator.d.ts +146 -1
- package/src/py/agent/generator.js +173 -76
- package/src/py/agent/generator.js.map +1 -1
- package/src/py/agent/mcp-connection/generator.d.ts +23 -0
- package/src/py/agent/mcp-connection/generator.js +45 -11
- package/src/py/agent/mcp-connection/generator.js.map +1 -1
- package/src/py/agent/react-connection/generator.d.ts +146 -0
- package/src/py/agent/react-connection/generator.js +27 -4
- package/src/py/agent/react-connection/generator.js.map +1 -1
- package/src/py/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +18 -0
- package/src/py/dynamodb/agent-connection/generator.js +7 -1
- package/src/py/dynamodb/agent-connection/generator.js.map +1 -1
- package/src/py/dynamodb/fast-api-connection/__snapshots__/generator.spec.ts.snap +9 -0
- package/src/py/dynamodb/fast-api-connection/generator.js +3 -1
- package/src/py/dynamodb/fast-api-connection/generator.js.map +1 -1
- package/src/py/dynamodb/generator.d.ts +29 -0
- package/src/py/dynamodb/generator.js +32 -12
- package/src/py/dynamodb/generator.js.map +1 -1
- package/src/py/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +18 -0
- package/src/py/dynamodb/mcp-server-connection/generator.js +7 -1
- package/src/py/dynamodb/mcp-server-connection/generator.js.map +1 -1
- package/src/py/fast-api/generator.d.ts +63 -0
- package/src/py/fast-api/generator.js +58 -23
- package/src/py/fast-api/generator.js.map +1 -1
- package/src/py/fast-api/react/generator.d.ts +16 -1
- package/src/py/fast-api/react/generator.js +15 -3
- package/src/py/fast-api/react/generator.js.map +1 -1
- package/src/py/lambda-function/generator.d.ts +21 -0
- package/src/py/lambda-function/generator.js +29 -10
- package/src/py/lambda-function/generator.js.map +1 -1
- package/src/py/mcp-server/generator.d.ts +60 -0
- package/src/py/mcp-server/generator.js +62 -25
- package/src/py/mcp-server/generator.js.map +1 -1
- package/src/py/project/generator.d.ts +13 -0
- package/src/py/project/generator.js +29 -10
- package/src/py/project/generator.js.map +1 -1
- package/src/py/rdb/agent-connection/__snapshots__/generator.spec.ts.snap +19 -0
- package/src/py/rdb/agent-connection/generator.js +7 -1
- package/src/py/rdb/agent-connection/generator.js.map +1 -1
- package/src/py/rdb/fast-api-connection/__snapshots__/generator.spec.ts.snap +7 -0
- package/src/py/rdb/fast-api-connection/generator.js +3 -1
- package/src/py/rdb/fast-api-connection/generator.js.map +1 -1
- package/src/py/rdb/generator.d.ts +89 -0
- package/src/py/rdb/generator.js +88 -40
- package/src/py/rdb/generator.js.map +1 -1
- package/src/py/rdb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +18 -0
- package/src/py/rdb/mcp-server-connection/generator.js +7 -1
- package/src/py/rdb/mcp-server-connection/generator.js.map +1 -1
- package/src/smithy/project/generator.d.ts +7 -0
- package/src/smithy/project/generator.js +8 -2
- package/src/smithy/project/generator.js.map +1 -1
- package/src/smithy/react-connection/generator.d.ts +15 -0
- package/src/smithy/react-connection/generator.js +17 -3
- package/src/smithy/react-connection/generator.js.map +1 -1
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +1 -0
- package/src/smithy/ts/api/generator.d.ts +79 -0
- package/src/smithy/ts/api/generator.js +77 -33
- package/src/smithy/ts/api/generator.js.map +1 -1
- package/src/terraform/project/generator.d.ts +50 -0
- package/src/terraform/project/generator.js +63 -17
- package/src/terraform/project/generator.js.map +1 -1
- package/src/trpc/backend/generator.d.ts +84 -0
- package/src/trpc/backend/generator.js +98 -38
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/trpc/react/generator.d.ts +37 -0
- package/src/trpc/react/generator.js +63 -26
- package/src/trpc/react/generator.js.map +1 -1
- package/src/ts/agent/a2a-connection/generator.d.ts +46 -0
- package/src/ts/agent/a2a-connection/generator.js +53 -16
- package/src/ts/agent/a2a-connection/generator.js.map +1 -1
- package/src/ts/agent/gateway-connection/generator.d.ts +37 -0
- package/src/ts/agent/gateway-connection/generator.js +41 -14
- package/src/ts/agent/gateway-connection/generator.js.map +1 -1
- package/src/ts/agent/generator.d.ts +162 -0
- package/src/ts/agent/generator.js +166 -75
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/generator.d.ts +37 -0
- package/src/ts/agent/mcp-connection/generator.js +41 -14
- package/src/ts/agent/mcp-connection/generator.js.map +1 -1
- package/src/ts/agent/react-connection/generator.d.ts +186 -0
- package/src/ts/agent/react-connection/generator.js +70 -21
- package/src/ts/agent/react-connection/generator.js.map +1 -1
- package/src/ts/astro-docs/generator.d.ts +38 -0
- package/src/ts/astro-docs/generator.js +58 -19
- package/src/ts/astro-docs/generator.js.map +1 -1
- package/src/ts/dcr-proxy/generator.d.ts +24 -0
- package/src/ts/dcr-proxy/generator.js +31 -14
- package/src/ts/dcr-proxy/generator.js.map +1 -1
- package/src/ts/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +18 -0
- package/src/ts/dynamodb/agent-connection/generator.js +7 -1
- package/src/ts/dynamodb/agent-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/generator.d.ts +41 -0
- package/src/ts/dynamodb/generator.js +47 -20
- package/src/ts/dynamodb/generator.js.map +1 -1
- package/src/ts/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +18 -0
- package/src/ts/dynamodb/mcp-server-connection/generator.js +7 -1
- package/src/ts/dynamodb/mcp-server-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/smithy-connection/__snapshots__/generator.spec.ts.snap +9 -0
- package/src/ts/dynamodb/smithy-connection/generator.js +3 -1
- package/src/ts/dynamodb/smithy-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/trpc-connection/__snapshots__/generator.spec.ts.snap +9 -0
- package/src/ts/dynamodb/trpc-connection/generator.js +3 -1
- package/src/ts/dynamodb/trpc-connection/generator.js.map +1 -1
- package/src/ts/lambda-function/generator.d.ts +38 -0
- package/src/ts/lambda-function/generator.js +49 -20
- package/src/ts/lambda-function/generator.js.map +1 -1
- package/src/ts/lib/generator.d.ts +7 -0
- package/src/ts/lib/generator.js +8 -1
- package/src/ts/lib/generator.js.map +1 -1
- package/src/ts/lib/ts-project-utils.d.ts +3 -1
- package/src/ts/lib/ts-project-utils.js +3 -2
- package/src/ts/lib/ts-project-utils.js.map +1 -1
- package/src/ts/lib/vitest.d.ts +10 -1
- package/src/ts/lib/vitest.js +14 -2
- package/src/ts/lib/vitest.js.map +1 -1
- package/src/ts/mcp-server/generator.d.ts +71 -0
- package/src/ts/mcp-server/generator.js +73 -36
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/nx-generator/generator.d.ts +3 -0
- package/src/ts/nx-generator/generator.js +8 -2
- package/src/ts/nx-generator/generator.js.map +1 -1
- package/src/ts/nx-migration/generator.d.ts +3 -0
- package/src/ts/nx-migration/generator.js +8 -2
- package/src/ts/nx-migration/generator.js.map +1 -1
- package/src/ts/nx-plugin/generator.d.ts +3 -0
- package/src/ts/nx-plugin/generator.js +8 -2
- package/src/ts/nx-plugin/generator.js.map +1 -1
- package/src/ts/nx-plugin/utils.d.ts +7 -2
- package/src/ts/nx-plugin/utils.js +10 -4
- package/src/ts/nx-plugin/utils.js.map +1 -1
- package/src/ts/rdb/agent-connection/__snapshots__/generator.spec.ts.snap +10 -0
- package/src/ts/rdb/agent-connection/generator.js +8 -1
- package/src/ts/rdb/agent-connection/generator.js.map +1 -1
- package/src/ts/rdb/generator.d.ts +101 -0
- package/src/ts/rdb/generator.js +93 -41
- package/src/ts/rdb/generator.js.map +1 -1
- package/src/ts/rdb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +10 -0
- package/src/ts/rdb/mcp-server-connection/generator.js +8 -1
- package/src/ts/rdb/mcp-server-connection/generator.js.map +1 -1
- package/src/ts/rdb/smithy-connection/__snapshots__/generator.spec.ts.snap +9 -0
- package/src/ts/rdb/smithy-connection/generator.js +4 -1
- package/src/ts/rdb/smithy-connection/generator.js.map +1 -1
- package/src/ts/rdb/trpc-connection/__snapshots__/generator.spec.ts.snap +9 -0
- package/src/ts/rdb/trpc-connection/generator.js +3 -1
- package/src/ts/rdb/trpc-connection/generator.js.map +1 -1
- package/src/ts/react-website/agui/generator.d.ts +86 -0
- package/src/ts/react-website/agui/generator.js +63 -28
- package/src/ts/react-website/agui/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +20 -2
- package/src/ts/react-website/app/generator.d.ts +136 -1
- package/src/ts/react-website/app/generator.js +109 -40
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/generator.d.ts +19 -0
- package/src/ts/react-website/cognito-auth/generator.js +21 -9
- package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
- package/src/utils/add-dependencies.d.ts +38 -0
- package/src/utils/add-dependencies.js +83 -0
- package/src/utils/add-dependencies.js.map +1 -0
- package/src/utils/agent-connection/agent-connection.d.ts +27 -6
- package/src/utils/agent-connection/agent-connection.js +47 -18
- package/src/utils/agent-connection/agent-connection.js.map +1 -1
- package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +19 -1
- package/src/utils/agent-core-constructs/agent-core-constructs.js +26 -6
- package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
- package/src/utils/api-constructs/api-constructs.d.ts +21 -2
- package/src/utils/api-constructs/api-constructs.js +26 -5
- package/src/utils/api-constructs/api-constructs.js.map +1 -1
- package/src/utils/bundle/bundle.d.ts +6 -1
- package/src/utils/bundle/bundle.js +8 -2
- package/src/utils/bundle/bundle.js.map +1 -1
- package/src/utils/commands.d.ts +5 -4
- package/src/utils/commands.js +2 -6
- package/src/utils/commands.js.map +1 -1
- package/src/utils/connection/open-api/react.d.ts +18 -1
- package/src/utils/connection/open-api/react.js +27 -3
- package/src/utils/connection/open-api/react.js.map +1 -1
- package/src/utils/declared-dependencies.d.ts +140 -0
- package/src/utils/declared-dependencies.js +64 -0
- package/src/utils/declared-dependencies.js.map +1 -0
- package/src/utils/docker.d.ts +10 -1
- package/src/utils/docker.js +7 -3
- package/src/utils/docker.js.map +1 -1
- package/src/utils/fs.d.ts +15 -4
- package/src/utils/fs.js +26 -13
- package/src/utils/fs.js.map +1 -1
- package/src/utils/init.d.ts +14 -1
- package/src/utils/init.js +25 -7
- package/src/utils/init.js.map +1 -1
- package/src/utils/migration-versions.d.ts +15 -1
- package/src/utils/migration-versions.js +53 -7
- package/src/utils/migration-versions.js.map +1 -1
- package/src/utils/nx.d.ts +18 -0
- package/src/utils/nx.js +4 -0
- package/src/utils/nx.js.map +1 -1
- package/src/utils/py.d.ts +3 -2
- package/src/utils/py.js +10 -10
- package/src/utils/py.js.map +1 -1
- package/src/utils/shared-constructs-constants.d.ts +39 -4
- package/src/utils/shared-constructs-constants.js +29 -0
- package/src/utils/shared-constructs-constants.js.map +1 -1
- package/src/utils/shared-constructs.d.ts +4 -1
- package/src/utils/shared-constructs.js +5 -4
- package/src/utils/shared-constructs.js.map +1 -1
- package/src/utils/shared-dynamodb-scripts.d.ts +8 -1
- package/src/utils/shared-dynamodb-scripts.js +11 -3
- package/src/utils/shared-dynamodb-scripts.js.map +1 -1
- package/src/utils/shared-infra-scripts.d.ts +16 -1
- package/src/utils/shared-infra-scripts.js +18 -3
- package/src/utils/shared-infra-scripts.js.map +1 -1
- package/src/utils/shared-rdb-scripts.d.ts +12 -1
- package/src/utils/shared-rdb-scripts.js +17 -3
- package/src/utils/shared-rdb-scripts.js.map +1 -1
- package/src/utils/shared-shadcn.d.ts +26 -1
- package/src/utils/shared-shadcn.js +31 -14
- package/src/utils/shared-shadcn.js.map +1 -1
- package/src/utils/version-upgrade-migration/migration.d.ts +14 -0
- package/src/utils/version-upgrade-migration/migration.js +16 -0
- package/src/utils/version-upgrade-migration/migration.js.map +1 -0
- package/src/utils/version-upgrade-migration/nx-package-updates.d.ts +35 -0
- package/src/utils/version-upgrade-migration/nx-package-updates.js +42 -0
- package/src/utils/version-upgrade-migration/nx-package-updates.js.map +1 -0
- package/src/utils/version-upgrade-migration/owned-dependencies.d.ts +50 -0
- package/src/utils/version-upgrade-migration/owned-dependencies.js +98 -0
- package/src/utils/version-upgrade-migration/owned-dependencies.js.map +1 -0
- package/src/utils/version-upgrade-migration/register.d.ts +18 -0
- package/src/utils/version-upgrade-migration/register.js +33 -0
- package/src/utils/version-upgrade-migration/register.js.map +1 -0
- package/src/utils/version-upgrade-migration/sync-metrics-version.d.ts +13 -0
- package/src/utils/version-upgrade-migration/sync-metrics-version.js +33 -0
- package/src/utils/version-upgrade-migration/sync-metrics-version.js.map +1 -0
- package/src/utils/version-upgrade-migration/sync-vended-versions.d.ts +10 -0
- package/src/utils/version-upgrade-migration/sync-vended-versions.js +504 -0
- package/src/utils/version-upgrade-migration/sync-vended-versions.js.map +1 -0
- package/src/utils/version-upgrade-migration/vended-upgrade.d.ts +14 -0
- package/src/utils/version-upgrade-migration/vended-upgrade.js +40 -0
- package/src/utils/version-upgrade-migration/vended-upgrade.js.map +1 -0
- package/src/utils/versions.d.ts +25 -5
- package/src/utils/versions.js +46 -4
- package/src/utils/versions.js.map +1 -1
- package/src/utils/website-constructs/files/cdk/core/static-website.ts.template +4 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import type { MigrationReturnObject, Tree } from '@nx/devkit';
|
|
6
|
+
/**
|
|
7
|
+
* Syncs the workspace's vended versions to those the installed plugin vends.
|
|
8
|
+
*
|
|
9
|
+
* Registered `everyMigration`, so it runs on every upgrade and last in the run:
|
|
10
|
+
* versions come from the installed plugin's own tables, so there is nothing
|
|
11
|
+
* release-specific to register, and running after the code migrations lets them
|
|
12
|
+
* add dependencies this then brings up to date.
|
|
13
|
+
*/
|
|
14
|
+
export default function migration(tree: Tree): Promise<MigrationReturnObject>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/ import { syncVendedVersions } from "./sync-vended-versions.js";
|
|
5
|
+
/**
|
|
6
|
+
* Syncs the workspace's vended versions to those the installed plugin vends.
|
|
7
|
+
*
|
|
8
|
+
* Registered `everyMigration`, so it runs on every upgrade and last in the run:
|
|
9
|
+
* versions come from the installed plugin's own tables, so there is nothing
|
|
10
|
+
* release-specific to register, and running after the code migrations lets them
|
|
11
|
+
* add dependencies this then brings up to date.
|
|
12
|
+
*/ export default async function migration(tree) {
|
|
13
|
+
return syncVendedVersions(tree);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/version-upgrade-migration/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { MigrationReturnObject, Tree } from '@nx/devkit';\nimport { syncVendedVersions } from './sync-vended-versions';\n\n/**\n * Syncs the workspace's vended versions to those the installed plugin vends.\n *\n * Registered `everyMigration`, so it runs on every upgrade and last in the run:\n * versions come from the installed plugin's own tables, so there is nothing\n * release-specific to register, and running after the code migrations lets them\n * add dependencies this then brings up to date.\n */\nexport default async function migration(\n tree: Tree,\n): Promise<MigrationReturnObject> {\n return syncVendedVersions(tree);\n}\n"],"names":["syncVendedVersions","migration","tree"],"mappings":"AAAA;;;CAGC,GAED,SAASA,kBAAkB,QAAQ,4BAAyB;AAE5D;;;;;;;CAOC,GACD,eAAe,eAAeC,UAC5BC,IAAU;IAEV,OAAOF,mBAAmBE;AAC5B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `packageJsonUpdates` for the nx packages a generated workspace pins.
|
|
3
|
+
*
|
|
4
|
+
* A migration cannot bump these: `nx migrate` builds its migration list from the
|
|
5
|
+
* packages it is itself bumping, so an nx version only rewritten by our migration
|
|
6
|
+
* silently skips Nx's own migrations for that hop. Declaring the bump here pulls
|
|
7
|
+
* them in.
|
|
8
|
+
*
|
|
9
|
+
* It also keeps every nx pin moving together. A workspace nx even a patch apart
|
|
10
|
+
* from the plugin's `@nx/*` packages hoists a second nested nx, and the two
|
|
11
|
+
* deadlock `nx sync`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const NX_PACKAGE_UPDATES_NAME = "nx-packages";
|
|
14
|
+
export declare const isNxPackage: (name: string) => boolean;
|
|
15
|
+
/** Indexed to satisfy the open shape `migrations.json` entries carry. */
|
|
16
|
+
export interface PackageJsonUpdate extends Record<string, unknown> {
|
|
17
|
+
version: string;
|
|
18
|
+
packages: Record<string, {
|
|
19
|
+
version: string;
|
|
20
|
+
alwaysAddToPackageJson: false;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
export type PackageJsonUpdates = Record<string, PackageJsonUpdate>;
|
|
24
|
+
/**
|
|
25
|
+
* `alwaysAddToPackageJson: false` so only packages already present are updated.
|
|
26
|
+
*
|
|
27
|
+
* Keyed by directory rather than version, because the key has to exist before
|
|
28
|
+
* the version does: an entry is written under `latest` and only re-keyed to
|
|
29
|
+
* `v<version>` once a release claims it. One release's entry stays behind as the
|
|
30
|
+
* next is written, so a workspace several releases behind gets each nx bump in
|
|
31
|
+
* turn — hence `<dir>-<name>`, which keeps every release's entry distinct.
|
|
32
|
+
*
|
|
33
|
+
* @param version version `nx migrate` gates the bump on
|
|
34
|
+
*/
|
|
35
|
+
export declare const nxPackageJsonUpdates: (dir: string, version: string, nxVersion?: string) => PackageJsonUpdates;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/ import { migrationKey } from "../migration-versions.js";
|
|
5
|
+
import { NX_PACKAGES, NX_VERSION } from "../versions.js";
|
|
6
|
+
/**
|
|
7
|
+
* `packageJsonUpdates` for the nx packages a generated workspace pins.
|
|
8
|
+
*
|
|
9
|
+
* A migration cannot bump these: `nx migrate` builds its migration list from the
|
|
10
|
+
* packages it is itself bumping, so an nx version only rewritten by our migration
|
|
11
|
+
* silently skips Nx's own migrations for that hop. Declaring the bump here pulls
|
|
12
|
+
* them in.
|
|
13
|
+
*
|
|
14
|
+
* It also keeps every nx pin moving together. A workspace nx even a patch apart
|
|
15
|
+
* from the plugin's `@nx/*` packages hoists a second nested nx, and the two
|
|
16
|
+
* deadlock `nx sync`.
|
|
17
|
+
*/ export const NX_PACKAGE_UPDATES_NAME = 'nx-packages';
|
|
18
|
+
export const isNxPackage = (name)=>NX_PACKAGES.includes(name);
|
|
19
|
+
/**
|
|
20
|
+
* `alwaysAddToPackageJson: false` so only packages already present are updated.
|
|
21
|
+
*
|
|
22
|
+
* Keyed by directory rather than version, because the key has to exist before
|
|
23
|
+
* the version does: an entry is written under `latest` and only re-keyed to
|
|
24
|
+
* `v<version>` once a release claims it. One release's entry stays behind as the
|
|
25
|
+
* next is written, so a workspace several releases behind gets each nx bump in
|
|
26
|
+
* turn — hence `<dir>-<name>`, which keeps every release's entry distinct.
|
|
27
|
+
*
|
|
28
|
+
* @param version version `nx migrate` gates the bump on
|
|
29
|
+
*/ export const nxPackageJsonUpdates = (dir, version, nxVersion = NX_VERSION)=>({
|
|
30
|
+
[migrationKey(dir, NX_PACKAGE_UPDATES_NAME)]: {
|
|
31
|
+
version,
|
|
32
|
+
packages: Object.fromEntries(NX_PACKAGES.map((name)=>[
|
|
33
|
+
name,
|
|
34
|
+
{
|
|
35
|
+
version: nxVersion,
|
|
36
|
+
alwaysAddToPackageJson: false
|
|
37
|
+
}
|
|
38
|
+
]))
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=nx-package-updates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/version-upgrade-migration/nx-package-updates.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { migrationKey } from '../migration-versions';\nimport { NX_PACKAGES, NX_VERSION } from '../versions';\n\n/**\n * `packageJsonUpdates` for the nx packages a generated workspace pins.\n *\n * A migration cannot bump these: `nx migrate` builds its migration list from the\n * packages it is itself bumping, so an nx version only rewritten by our migration\n * silently skips Nx's own migrations for that hop. Declaring the bump here pulls\n * them in.\n *\n * It also keeps every nx pin moving together. A workspace nx even a patch apart\n * from the plugin's `@nx/*` packages hoists a second nested nx, and the two\n * deadlock `nx sync`.\n */\n\nexport const NX_PACKAGE_UPDATES_NAME = 'nx-packages';\n\nexport const isNxPackage = (name: string): boolean =>\n (NX_PACKAGES as readonly string[]).includes(name);\n\n/** Indexed to satisfy the open shape `migrations.json` entries carry. */\nexport interface PackageJsonUpdate extends Record<string, unknown> {\n version: string;\n packages: Record<string, { version: string; alwaysAddToPackageJson: false }>;\n}\n\nexport type PackageJsonUpdates = Record<string, PackageJsonUpdate>;\n\n/**\n * `alwaysAddToPackageJson: false` so only packages already present are updated.\n *\n * Keyed by directory rather than version, because the key has to exist before\n * the version does: an entry is written under `latest` and only re-keyed to\n * `v<version>` once a release claims it. One release's entry stays behind as the\n * next is written, so a workspace several releases behind gets each nx bump in\n * turn — hence `<dir>-<name>`, which keeps every release's entry distinct.\n *\n * @param version version `nx migrate` gates the bump on\n */\nexport const nxPackageJsonUpdates = (\n dir: string,\n version: string,\n nxVersion: string = NX_VERSION,\n): PackageJsonUpdates => ({\n [migrationKey(dir, NX_PACKAGE_UPDATES_NAME)]: {\n version,\n packages: Object.fromEntries(\n NX_PACKAGES.map((name) => [\n name,\n { version: nxVersion, alwaysAddToPackageJson: false as const },\n ]),\n ),\n },\n});\n"],"names":["migrationKey","NX_PACKAGES","NX_VERSION","NX_PACKAGE_UPDATES_NAME","isNxPackage","name","includes","nxPackageJsonUpdates","dir","version","nxVersion","packages","Object","fromEntries","map","alwaysAddToPackageJson"],"mappings":"AAAA;;;CAGC,GACD,SAASA,YAAY,QAAQ,2BAAwB;AACrD,SAASC,WAAW,EAAEC,UAAU,QAAQ,iBAAc;AAEtD;;;;;;;;;;;CAWC,GAED,OAAO,MAAMC,0BAA0B,cAAc;AAErD,OAAO,MAAMC,cAAc,CAACC,OAC1B,AAACJ,YAAkCK,QAAQ,CAACD,MAAM;AAUpD;;;;;;;;;;CAUC,GACD,OAAO,MAAME,uBAAuB,CAClCC,KACAC,SACAC,YAAoBR,UAAU,GACN,CAAA;QACxB,CAACF,aAAaQ,KAAKL,yBAAyB,EAAE;YAC5CM;YACAE,UAAUC,OAAOC,WAAW,CAC1BZ,YAAYa,GAAG,CAAC,CAACT,OAAS;oBACxBA;oBACA;wBAAEI,SAASC;wBAAWK,wBAAwB;oBAAe;iBAC9D;QAEL;IACF,CAAA,EAAG"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type Tree } from '@nx/devkit';
|
|
2
|
+
import { type DependencyMetadata } from '../declared-dependencies';
|
|
3
|
+
/** Directory holding `generators.json`, which maps ids to their modules. */
|
|
4
|
+
export declare const PLUGIN_ROOT: string;
|
|
5
|
+
/**
|
|
6
|
+
* Which vended dependencies this workspace's generators are responsible for.
|
|
7
|
+
*
|
|
8
|
+
* Only these are synced, so a package the user added themselves keeps the version
|
|
9
|
+
* they chose. Ownership is derived from the generators the workspace has run and
|
|
10
|
+
* the dependencies each declares — nothing extra is recorded in the workspace.
|
|
11
|
+
*/
|
|
12
|
+
export interface OwnedDependencies {
|
|
13
|
+
readonly ts: ReadonlySet<string>;
|
|
14
|
+
readonly py: ReadonlySet<string>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* One recorded run of a generator, with the metadata it wrote.
|
|
18
|
+
*
|
|
19
|
+
* The metadata carries the values the generator's dependency conditions read, so
|
|
20
|
+
* a declaration filters down to the branch this occurrence actually took.
|
|
21
|
+
*/
|
|
22
|
+
export interface GeneratorOccurrence {
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly metadata: DependencyMetadata;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Every recorded run of a generator in this workspace, from the metadata
|
|
28
|
+
* generators record on the projects (and components) they create.
|
|
29
|
+
*
|
|
30
|
+
* A generator appears once per project or component it created, since each may
|
|
31
|
+
* have been run with different options.
|
|
32
|
+
*
|
|
33
|
+
* `init` creates no project, so its config file stands in for it.
|
|
34
|
+
*/
|
|
35
|
+
export declare const generatorOccurrences: (tree: Tree) => readonly GeneratorOccurrence[];
|
|
36
|
+
/** Generator ids this workspace has run. */
|
|
37
|
+
export declare const generatorsRun: (tree: Tree) => ReadonlySet<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Union of the dependencies declared by the generators this workspace has run,
|
|
40
|
+
* narrowed per occurrence to those whose conditions its recorded metadata
|
|
41
|
+
* satisfies — a project generated with one protocol does not own another's
|
|
42
|
+
* packages.
|
|
43
|
+
*
|
|
44
|
+
* A `versionOnly` entry is owned like any other: it is declared precisely so the
|
|
45
|
+
* sync keeps its pinned version current wherever the workspace already holds it.
|
|
46
|
+
*
|
|
47
|
+
* Each generator module exports its declaration, so reading one is an import
|
|
48
|
+
* rather than a run — the generators themselves are never invoked.
|
|
49
|
+
*/
|
|
50
|
+
export declare const ownedDependencies: (tree: Tree) => Promise<OwnedDependencies>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/ import * as path from "node:path";
|
|
5
|
+
import { getProjects } from "@nx/devkit";
|
|
6
|
+
import { AWS_NX_PLUGIN_CONFIG_FILE_NAME } from "../config/utils.js";
|
|
7
|
+
import { ownedDependencyEntries } from "../declared-dependencies.js";
|
|
8
|
+
import { buildGeneratorInfoList } from "../generators.js";
|
|
9
|
+
/** Directory holding `generators.json`, which maps ids to their modules. */ export const PLUGIN_ROOT = path.resolve(import.meta.dirname, '..', '..', '..');
|
|
10
|
+
/**
|
|
11
|
+
* Every recorded run of a generator in this workspace, from the metadata
|
|
12
|
+
* generators record on the projects (and components) they create.
|
|
13
|
+
*
|
|
14
|
+
* A generator appears once per project or component it created, since each may
|
|
15
|
+
* have been run with different options.
|
|
16
|
+
*
|
|
17
|
+
* `init` creates no project, so its config file stands in for it.
|
|
18
|
+
*/ export const generatorOccurrences = (tree)=>{
|
|
19
|
+
const occurrences = [];
|
|
20
|
+
if (tree.exists(AWS_NX_PLUGIN_CONFIG_FILE_NAME)) {
|
|
21
|
+
occurrences.push({
|
|
22
|
+
id: 'init',
|
|
23
|
+
metadata: {}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
for (const [, project] of getProjects(tree)){
|
|
27
|
+
const metadata = project.metadata;
|
|
28
|
+
if (metadata?.generator) {
|
|
29
|
+
const { components, ...ownMetadata } = metadata;
|
|
30
|
+
occurrences.push({
|
|
31
|
+
id: metadata.generator,
|
|
32
|
+
metadata: ownMetadata
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
for (const component of metadata?.components ?? []){
|
|
36
|
+
if (component.generator) {
|
|
37
|
+
occurrences.push({
|
|
38
|
+
id: component.generator,
|
|
39
|
+
metadata: component
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return occurrences;
|
|
45
|
+
};
|
|
46
|
+
/** Generator ids this workspace has run. */ export const generatorsRun = (tree)=>new Set(generatorOccurrences(tree).map((occurrence)=>occurrence.id));
|
|
47
|
+
/**
|
|
48
|
+
* Union of the dependencies declared by the generators this workspace has run,
|
|
49
|
+
* narrowed per occurrence to those whose conditions its recorded metadata
|
|
50
|
+
* satisfies — a project generated with one protocol does not own another's
|
|
51
|
+
* packages.
|
|
52
|
+
*
|
|
53
|
+
* A `versionOnly` entry is owned like any other: it is declared precisely so the
|
|
54
|
+
* sync keeps its pinned version current wherever the workspace already holds it.
|
|
55
|
+
*
|
|
56
|
+
* Each generator module exports its declaration, so reading one is an import
|
|
57
|
+
* rather than a run — the generators themselves are never invoked.
|
|
58
|
+
*/ export const ownedDependencies = async (tree)=>{
|
|
59
|
+
const occurrences = generatorOccurrences(tree);
|
|
60
|
+
const ts = new Set();
|
|
61
|
+
const py = new Set();
|
|
62
|
+
for (const info of buildGeneratorInfoList(PLUGIN_ROOT)){
|
|
63
|
+
const matching = occurrences.filter((occurrence)=>occurrence.id === info.id);
|
|
64
|
+
if (matching.length === 0) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const declaration = await readDeclaration(info.resolvedFactoryPath);
|
|
68
|
+
if (!declaration) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
for (const { metadata } of matching){
|
|
72
|
+
for (const entry of ownedDependencyEntries(declaration.ts, metadata)){
|
|
73
|
+
ts.add(entry.name);
|
|
74
|
+
}
|
|
75
|
+
for (const entry of ownedDependencyEntries(declaration.py, metadata)){
|
|
76
|
+
py.add(entry.name);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
ts,
|
|
82
|
+
py
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* A generator's `DEPENDENCIES`, or undefined when it declares none.
|
|
87
|
+
* A generator that fails to load must not fail the upgrade, so its dependencies
|
|
88
|
+
* are treated as unowned and left as they are.
|
|
89
|
+
*/ const readDeclaration = async (factoryPath)=>{
|
|
90
|
+
try {
|
|
91
|
+
const module = await import(`${factoryPath}.js`);
|
|
92
|
+
return module.DEPENDENCIES;
|
|
93
|
+
} catch {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
//# sourceMappingURL=owned-dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/version-upgrade-migration/owned-dependencies.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport * as path from 'node:path';\nimport { getProjects, type Tree } from '@nx/devkit';\nimport { AWS_NX_PLUGIN_CONFIG_FILE_NAME } from '../config/utils';\nimport {\n type DependencyDeclaration,\n type DependencyMetadata,\n ownedDependencyEntries,\n} from '../declared-dependencies';\nimport { buildGeneratorInfoList } from '../generators';\n\n/** Directory holding `generators.json`, which maps ids to their modules. */\nexport const PLUGIN_ROOT = path.resolve(import.meta.dirname, '..', '..', '..');\n\n/**\n * Which vended dependencies this workspace's generators are responsible for.\n *\n * Only these are synced, so a package the user added themselves keeps the version\n * they chose. Ownership is derived from the generators the workspace has run and\n * the dependencies each declares — nothing extra is recorded in the workspace.\n */\nexport interface OwnedDependencies {\n readonly ts: ReadonlySet<string>;\n readonly py: ReadonlySet<string>;\n}\n\n/**\n * One recorded run of a generator, with the metadata it wrote.\n *\n * The metadata carries the values the generator's dependency conditions read, so\n * a declaration filters down to the branch this occurrence actually took.\n */\nexport interface GeneratorOccurrence {\n readonly id: string;\n readonly metadata: DependencyMetadata;\n}\n\n/**\n * Every recorded run of a generator in this workspace, from the metadata\n * generators record on the projects (and components) they create.\n *\n * A generator appears once per project or component it created, since each may\n * have been run with different options.\n *\n * `init` creates no project, so its config file stands in for it.\n */\nexport const generatorOccurrences = (\n tree: Tree,\n): readonly GeneratorOccurrence[] => {\n const occurrences: GeneratorOccurrence[] = [];\n if (tree.exists(AWS_NX_PLUGIN_CONFIG_FILE_NAME)) {\n occurrences.push({ id: 'init', metadata: {} });\n }\n for (const [, project] of getProjects(tree)) {\n const metadata = project.metadata as\n | {\n generator?: string;\n components?: ({ generator?: string } & DependencyMetadata)[];\n }\n | undefined;\n if (metadata?.generator) {\n const { components, ...ownMetadata } = metadata;\n occurrences.push({ id: metadata.generator, metadata: ownMetadata });\n }\n for (const component of metadata?.components ?? []) {\n if (component.generator) {\n occurrences.push({ id: component.generator, metadata: component });\n }\n }\n }\n return occurrences;\n};\n\n/** Generator ids this workspace has run. */\nexport const generatorsRun = (tree: Tree): ReadonlySet<string> =>\n new Set(generatorOccurrences(tree).map((occurrence) => occurrence.id));\n\n/**\n * Union of the dependencies declared by the generators this workspace has run,\n * narrowed per occurrence to those whose conditions its recorded metadata\n * satisfies — a project generated with one protocol does not own another's\n * packages.\n *\n * A `versionOnly` entry is owned like any other: it is declared precisely so the\n * sync keeps its pinned version current wherever the workspace already holds it.\n *\n * Each generator module exports its declaration, so reading one is an import\n * rather than a run — the generators themselves are never invoked.\n */\nexport const ownedDependencies = async (\n tree: Tree,\n): Promise<OwnedDependencies> => {\n const occurrences = generatorOccurrences(tree);\n const ts = new Set<string>();\n const py = new Set<string>();\n\n for (const info of buildGeneratorInfoList(PLUGIN_ROOT)) {\n const matching = occurrences.filter(\n (occurrence) => occurrence.id === info.id,\n );\n if (matching.length === 0) {\n continue;\n }\n const declaration = await readDeclaration(info.resolvedFactoryPath);\n if (!declaration) {\n continue;\n }\n for (const { metadata } of matching) {\n for (const entry of ownedDependencyEntries(declaration.ts, metadata)) {\n ts.add(entry.name as string);\n }\n for (const entry of ownedDependencyEntries(declaration.py, metadata)) {\n py.add(entry.name as string);\n }\n }\n }\n\n return { ts, py };\n};\n\n/**\n * A generator's `DEPENDENCIES`, or undefined when it declares none.\n * A generator that fails to load must not fail the upgrade, so its dependencies\n * are treated as unowned and left as they are.\n */\nconst readDeclaration = async (\n factoryPath: string,\n): Promise<DependencyDeclaration | undefined> => {\n try {\n const module = await import(`${factoryPath}.js`);\n return module.DEPENDENCIES;\n } catch {\n return undefined;\n }\n};\n"],"names":["path","getProjects","AWS_NX_PLUGIN_CONFIG_FILE_NAME","ownedDependencyEntries","buildGeneratorInfoList","PLUGIN_ROOT","resolve","dirname","generatorOccurrences","tree","occurrences","exists","push","id","metadata","project","generator","components","ownMetadata","component","generatorsRun","Set","map","occurrence","ownedDependencies","ts","py","info","matching","filter","length","declaration","readDeclaration","resolvedFactoryPath","entry","add","name","factoryPath","module","DEPENDENCIES","undefined"],"mappings":"AAAA;;;CAGC,GACD,YAAYA,UAAU,YAAY;AAClC,SAASC,WAAW,QAAmB,aAAa;AACpD,SAASC,8BAA8B,QAAQ,qBAAkB;AACjE,SAGEC,sBAAsB,QACjB,8BAA2B;AAClC,SAASC,sBAAsB,QAAQ,mBAAgB;AAEvD,0EAA0E,GAC1E,OAAO,MAAMC,cAAcL,KAAKM,OAAO,CAAC,YAAYC,OAAO,EAAE,MAAM,MAAM,MAAM;AAyB/E;;;;;;;;CAQC,GACD,OAAO,MAAMC,uBAAuB,CAClCC;IAEA,MAAMC,cAAqC,EAAE;IAC7C,IAAID,KAAKE,MAAM,CAACT,iCAAiC;QAC/CQ,YAAYE,IAAI,CAAC;YAAEC,IAAI;YAAQC,UAAU,CAAC;QAAE;IAC9C;IACA,KAAK,MAAM,GAAGC,QAAQ,IAAId,YAAYQ,MAAO;QAC3C,MAAMK,WAAWC,QAAQD,QAAQ;QAMjC,IAAIA,UAAUE,WAAW;YACvB,MAAM,EAAEC,UAAU,EAAE,GAAGC,aAAa,GAAGJ;YACvCJ,YAAYE,IAAI,CAAC;gBAAEC,IAAIC,SAASE,SAAS;gBAAEF,UAAUI;YAAY;QACnE;QACA,KAAK,MAAMC,aAAaL,UAAUG,cAAc,EAAE,CAAE;YAClD,IAAIE,UAAUH,SAAS,EAAE;gBACvBN,YAAYE,IAAI,CAAC;oBAAEC,IAAIM,UAAUH,SAAS;oBAAEF,UAAUK;gBAAU;YAClE;QACF;IACF;IACA,OAAOT;AACT,EAAE;AAEF,0CAA0C,GAC1C,OAAO,MAAMU,gBAAgB,CAACX,OAC5B,IAAIY,IAAIb,qBAAqBC,MAAMa,GAAG,CAAC,CAACC,aAAeA,WAAWV,EAAE,GAAG;AAEzE;;;;;;;;;;;CAWC,GACD,OAAO,MAAMW,oBAAoB,OAC/Bf;IAEA,MAAMC,cAAcF,qBAAqBC;IACzC,MAAMgB,KAAK,IAAIJ;IACf,MAAMK,KAAK,IAAIL;IAEf,KAAK,MAAMM,QAAQvB,uBAAuBC,aAAc;QACtD,MAAMuB,WAAWlB,YAAYmB,MAAM,CACjC,CAACN,aAAeA,WAAWV,EAAE,KAAKc,KAAKd,EAAE;QAE3C,IAAIe,SAASE,MAAM,KAAK,GAAG;YACzB;QACF;QACA,MAAMC,cAAc,MAAMC,gBAAgBL,KAAKM,mBAAmB;QAClE,IAAI,CAACF,aAAa;YAChB;QACF;QACA,KAAK,MAAM,EAAEjB,QAAQ,EAAE,IAAIc,SAAU;YACnC,KAAK,MAAMM,SAAS/B,uBAAuB4B,YAAYN,EAAE,EAAEX,UAAW;gBACpEW,GAAGU,GAAG,CAACD,MAAME,IAAI;YACnB;YACA,KAAK,MAAMF,SAAS/B,uBAAuB4B,YAAYL,EAAE,EAAEZ,UAAW;gBACpEY,GAAGS,GAAG,CAACD,MAAME,IAAI;YACnB;QACF;IACF;IAEA,OAAO;QAAEX;QAAIC;IAAG;AAClB,EAAE;AAEF;;;;CAIC,GACD,MAAMM,kBAAkB,OACtBK;IAEA,IAAI;QACF,MAAMC,SAAS,MAAM,MAAM,CAAC,GAAGD,YAAY,GAAG,CAAC;QAC/C,OAAOC,OAAOC,YAAY;IAC5B,EAAE,OAAM;QACN,OAAOC;IACT;AACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { type Tree } from '@nx/devkit';
|
|
6
|
+
/**
|
|
7
|
+
* Register the nx bump a version update needs, in `migrations.json`. Call only
|
|
8
|
+
* when an nx package actually moved.
|
|
9
|
+
*
|
|
10
|
+
* The version sync migration itself is a committed `everyMigration` entry, so
|
|
11
|
+
* only the nx packages need registering per update: they go through
|
|
12
|
+
* `packageJsonUpdates` rather than a migration (see `nx-package-updates.ts`).
|
|
13
|
+
*
|
|
14
|
+
* Idempotent: re-running before a release claims the entry refreshes it in place.
|
|
15
|
+
*
|
|
16
|
+
* @returns paths written, for the update report
|
|
17
|
+
*/
|
|
18
|
+
export declare const registerNxPackageUpdates: (tree: Tree) => string[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/ import { updateJson } from "@nx/devkit";
|
|
5
|
+
import { LATEST_MIGRATIONS_DIR } from "../migration-versions.js";
|
|
6
|
+
import { nxPackageJsonUpdates } from "./nx-package-updates.js";
|
|
7
|
+
const MIGRATIONS_JSON_PATH = 'packages/nx-plugin/migrations.json';
|
|
8
|
+
/**
|
|
9
|
+
* Register the nx bump a version update needs, in `migrations.json`. Call only
|
|
10
|
+
* when an nx package actually moved.
|
|
11
|
+
*
|
|
12
|
+
* The version sync migration itself is a committed `everyMigration` entry, so
|
|
13
|
+
* only the nx packages need registering per update: they go through
|
|
14
|
+
* `packageJsonUpdates` rather than a migration (see `nx-package-updates.ts`).
|
|
15
|
+
*
|
|
16
|
+
* Idempotent: re-running before a release claims the entry refreshes it in place.
|
|
17
|
+
*
|
|
18
|
+
* @returns paths written, for the update report
|
|
19
|
+
*/ export const registerNxPackageUpdates = (tree)=>{
|
|
20
|
+
updateJson(tree, MIGRATIONS_JSON_PATH, (migrations)=>({
|
|
21
|
+
...migrations,
|
|
22
|
+
// Recorded under `latest` until stamping resolves the version it ships with.
|
|
23
|
+
packageJsonUpdates: {
|
|
24
|
+
...migrations.packageJsonUpdates,
|
|
25
|
+
...nxPackageJsonUpdates(LATEST_MIGRATIONS_DIR, LATEST_MIGRATIONS_DIR)
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
return [
|
|
29
|
+
MIGRATIONS_JSON_PATH
|
|
30
|
+
];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/version-upgrade-migration/register.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { type Tree, updateJson } from '@nx/devkit';\nimport {\n LATEST_MIGRATIONS_DIR,\n type MigrationsJson,\n} from '../migration-versions';\nimport { nxPackageJsonUpdates } from './nx-package-updates';\n\nconst MIGRATIONS_JSON_PATH = 'packages/nx-plugin/migrations.json';\n\n/**\n * Register the nx bump a version update needs, in `migrations.json`. Call only\n * when an nx package actually moved.\n *\n * The version sync migration itself is a committed `everyMigration` entry, so\n * only the nx packages need registering per update: they go through\n * `packageJsonUpdates` rather than a migration (see `nx-package-updates.ts`).\n *\n * Idempotent: re-running before a release claims the entry refreshes it in place.\n *\n * @returns paths written, for the update report\n */\nexport const registerNxPackageUpdates = (tree: Tree): string[] => {\n updateJson<MigrationsJson>(tree, MIGRATIONS_JSON_PATH, (migrations) => ({\n ...migrations,\n // Recorded under `latest` until stamping resolves the version it ships with.\n packageJsonUpdates: {\n ...migrations.packageJsonUpdates,\n ...nxPackageJsonUpdates(LATEST_MIGRATIONS_DIR, LATEST_MIGRATIONS_DIR),\n },\n }));\n\n return [MIGRATIONS_JSON_PATH];\n};\n"],"names":["updateJson","LATEST_MIGRATIONS_DIR","nxPackageJsonUpdates","MIGRATIONS_JSON_PATH","registerNxPackageUpdates","tree","migrations","packageJsonUpdates"],"mappings":"AAAA;;;CAGC,GACD,SAAoBA,UAAU,QAAQ,aAAa;AACnD,SACEC,qBAAqB,QAEhB,2BAAwB;AAC/B,SAASC,oBAAoB,QAAQ,0BAAuB;AAE5D,MAAMC,uBAAuB;AAE7B;;;;;;;;;;;CAWC,GACD,OAAO,MAAMC,2BAA2B,CAACC;IACvCL,WAA2BK,MAAMF,sBAAsB,CAACG,aAAgB,CAAA;YACtE,GAAGA,UAAU;YACb,6EAA6E;YAC7EC,oBAAoB;gBAClB,GAAGD,WAAWC,kBAAkB;gBAChC,GAAGL,qBAAqBD,uBAAuBA,sBAAsB;YACvE;QACF,CAAA;IAEA,OAAO;QAACE;KAAqB;AAC/B,EAAE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import type { Tree } from '@nx/devkit';
|
|
6
|
+
/**
|
|
7
|
+
* Sync the plugin version the metrics files report, so usage is attributed to
|
|
8
|
+
* the release the workspace actually runs. The metric id and tags are owned by
|
|
9
|
+
* the generators and left alone.
|
|
10
|
+
*
|
|
11
|
+
* @returns the metrics files that changed
|
|
12
|
+
*/
|
|
13
|
+
export declare const syncMetricsVersion: (tree: Tree) => Promise<string[]>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/ import { applyGritQL } from "../ast.js";
|
|
5
|
+
import { METRICS_ASPECT_FILE_PATH, TERRAFORM_METRICS_FILE_PATH } from "../metrics.js";
|
|
6
|
+
import { getPackageVersion } from "../nx.js";
|
|
7
|
+
/**
|
|
8
|
+
* Sync the plugin version the metrics files report, so usage is attributed to
|
|
9
|
+
* the release the workspace actually runs. The metric id and tags are owned by
|
|
10
|
+
* the generators and left alone.
|
|
11
|
+
*
|
|
12
|
+
* @returns the metrics files that changed
|
|
13
|
+
*/ export const syncMetricsVersion = async (tree)=>{
|
|
14
|
+
const version = getPackageVersion();
|
|
15
|
+
const updated = [];
|
|
16
|
+
if (tree.exists(METRICS_ASPECT_FILE_PATH)) {
|
|
17
|
+
const changed = await applyGritQL(tree, METRICS_ASPECT_FILE_PATH, `\`const version = $old\` => \`const version = '${version}'\`` + ' where { $old <: within `class MetricsAspect implements $_ { $_ }` }');
|
|
18
|
+
if (changed) {
|
|
19
|
+
updated.push(METRICS_ASPECT_FILE_PATH);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (tree.exists(TERRAFORM_METRICS_FILE_PATH)) {
|
|
23
|
+
// GritQL's HCL grammar rejects `within locals { ... }`, so the match is
|
|
24
|
+
// narrowed to a string value to skip interpolated mentions.
|
|
25
|
+
const changed = await applyGritQL(tree, TERRAFORM_METRICS_FILE_PATH, `\`metric_version = $old\` => \`metric_version = "${version}"\`` + ' where { $old <: string() }');
|
|
26
|
+
if (changed) {
|
|
27
|
+
updated.push(TERRAFORM_METRICS_FILE_PATH);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return updated;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=sync-metrics-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/version-upgrade-migration/sync-metrics-version.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { Tree } from '@nx/devkit';\nimport { applyGritQL } from '../ast';\nimport {\n METRICS_ASPECT_FILE_PATH,\n TERRAFORM_METRICS_FILE_PATH,\n} from '../metrics';\nimport { getPackageVersion } from '../nx';\n\n/**\n * Sync the plugin version the metrics files report, so usage is attributed to\n * the release the workspace actually runs. The metric id and tags are owned by\n * the generators and left alone.\n *\n * @returns the metrics files that changed\n */\nexport const syncMetricsVersion = async (tree: Tree): Promise<string[]> => {\n const version = getPackageVersion();\n const updated: string[] = [];\n\n if (tree.exists(METRICS_ASPECT_FILE_PATH)) {\n const changed = await applyGritQL(\n tree,\n METRICS_ASPECT_FILE_PATH,\n `\\`const version = $old\\` => \\`const version = '${version}'\\`` +\n ' where { $old <: within `class MetricsAspect implements $_ { $_ }` }',\n );\n if (changed) {\n updated.push(METRICS_ASPECT_FILE_PATH);\n }\n }\n\n if (tree.exists(TERRAFORM_METRICS_FILE_PATH)) {\n // GritQL's HCL grammar rejects `within locals { ... }`, so the match is\n // narrowed to a string value to skip interpolated mentions.\n const changed = await applyGritQL(\n tree,\n TERRAFORM_METRICS_FILE_PATH,\n `\\`metric_version = $old\\` => \\`metric_version = \"${version}\"\\`` +\n ' where { $old <: string() }',\n );\n if (changed) {\n updated.push(TERRAFORM_METRICS_FILE_PATH);\n }\n }\n\n return updated;\n};\n"],"names":["applyGritQL","METRICS_ASPECT_FILE_PATH","TERRAFORM_METRICS_FILE_PATH","getPackageVersion","syncMetricsVersion","tree","version","updated","exists","changed","push"],"mappings":"AAAA;;;CAGC,GAED,SAASA,WAAW,QAAQ,YAAS;AACrC,SACEC,wBAAwB,EACxBC,2BAA2B,QACtB,gBAAa;AACpB,SAASC,iBAAiB,QAAQ,WAAQ;AAE1C;;;;;;CAMC,GACD,OAAO,MAAMC,qBAAqB,OAAOC;IACvC,MAAMC,UAAUH;IAChB,MAAMI,UAAoB,EAAE;IAE5B,IAAIF,KAAKG,MAAM,CAACP,2BAA2B;QACzC,MAAMQ,UAAU,MAAMT,YACpBK,MACAJ,0BACA,CAAC,+CAA+C,EAAEK,QAAQ,GAAG,CAAC,GAC5D;QAEJ,IAAIG,SAAS;YACXF,QAAQG,IAAI,CAACT;QACf;IACF;IAEA,IAAII,KAAKG,MAAM,CAACN,8BAA8B;QAC5C,wEAAwE;QACxE,4DAA4D;QAC5D,MAAMO,UAAU,MAAMT,YACpBK,MACAH,6BACA,CAAC,iDAAiD,EAAEI,QAAQ,GAAG,CAAC,GAC9D;QAEJ,IAAIG,SAAS;YACXF,QAAQG,IAAI,CAACR;QACf;IACF;IAEA,OAAOK;AACT,EAAE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { type MigrationReturnObject, type Tree } from '@nx/devkit';
|
|
6
|
+
/**
|
|
7
|
+
* Sync the versions this release vends, for the dependencies the workspace's
|
|
8
|
+
* generators own.
|
|
9
|
+
*/
|
|
10
|
+
export declare const syncVendedVersions: (tree: Tree) => Promise<MigrationReturnObject>;
|