@zukhruf/nx 0.8.116 → 0.8.117

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/README.md CHANGED
@@ -837,20 +837,21 @@ npx nx migrate @zukhruf/nx@latest
837
837
  npx nx migrate --run-migrations
838
838
  ```
839
839
 
840
- `nx migrate` moves every published @zukhruf package with `@zukhruf/nx` (`packageGroup`), and nothing runs the migrations otherwise. Each one adds only what is missing, writes what the generators write now, and logs the step to take by hand where a file lost the shape that the generator wrote. `packageJsonUpdates` in `migrations.json` move each third-party peer that the generators install to its pin in `versions.ts`, in the root package.json of a repo that has it, so a narrower peer range does not stop npm, and `move-peers-in-project-manifests` moves the same packages in each project's package.json that declares them, so the root and the apps install one copy. [ADR 0017](./docs/adr/0017-nx-migrations-bring-a-change-of-generated-output-to-the-repos-that-ran-the-generator-before.md) has the rules.
841
-
842
- | Migration | Version | Brings |
843
- | --------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
844
- | `add-portless-proxy-env` | 0.8.40 | `PORTLESS_UNPRIVILEGED=1` and `PORTLESS_HTTPS=1` in `targetDefaults.portless` (#4768) |
845
- | `add-local-postgres` | 0.8.40 | the root `compose.dev.yml`, `up` and `down` of each db package, the local `CONNECTION_STRING`, and `^up` in its backend serve (ADR 0012 decisions 16 and 17) |
846
- | `node-env-production` | 0.8.40 | the NODE_ENV configuration of ADR 0016 (nx.json defaults, target env, the web exceptions, `.env.example`, the workflow env, `ALLOWED_ORIGINS`), and a log of each NODE_ENV read in source |
847
- | `add-prisma-client-inputs` | 0.8.40 | `...` and `{ "dependentTasksOutputFiles": "**/*.ts" }` in the `inputs` of `targetDefaults.typecheck` and `.build` of a repo with `@zukhruf/nx/prisma`, so a schema change rebuilds the db package (#4826); since 0.8.60 it writes the rule of ADR 0019 |
848
- | `add-migrate-check` | 0.8.44 | `migrate:check` in `targetDefaults.typecheck.dependsOn` of a repo with `@zukhruf/nx/prisma`, so the typecheck of a db package fails when its migrations do not build its schema (#4937, ADR 0018) |
849
- | `add-generated-source-defaults` | 0.8.60 | the rule of ADR 0019 in a repo whose `nx.json` lists the three plugins of `init`; removes the `dependsOn: ["^sdk"]` of a web `test` target; logs each other target that hides the rule (#5219) |
850
- | `add-sdk-build-edges` | 0.8.69 | `build-deps` in each node-app backend; `implicitDependencies` on the backend, `dependsOn: ["^build-deps"]` and the inputs of ADR 0021 in its client's `sdk`; when either file is not the one `node-app` wrote, or the client has no stub, changes neither and logs both edits (#5102) |
851
- | `rename-eslint-react-config` | 0.8.66 | `zukhruf.configs['shadcn']` for `zukhruf.configs['react']` or `.react` (whatever the default import of `@zukhruf/eslint` is called) and `'zukhruf/shadcn'` for `'zukhruf/react'` in an `extends` array, in each `eslint.config.*`; `@zukhruf/eslint/react` stays; logs each edit (#5263, ADR 0017 decision 10) |
852
- | `move-peers-in-project-manifests` | 0.8.70 | the versions of `packageJsonUpdates` in each project's package.json that declares the package, in its section, never down, never into a project without it; logs each move (#5296, ADR 0017 decision 9) |
853
- | `type-check-config-files` | 0.8.116 | the `tsconfig.scripts.json` of ADR 0022 and its reference in each node-app and db package that has none; the `hooks` project and the `./.husky` reference when `.husky/project.json` is missing; deletes an `allowDefaultProject` block a generator wrote once a tsconfig covers its files; a file named by a block that stays gets no tsconfig, and each block no generator wrote is logged (#5649) |
840
+ `nx migrate` moves every published @zukhruf package with `@zukhruf/nx` (`packageGroup`) in the root package.json, `move-zukhruf-pins-in-project-manifests` moves the same packages in each project's package.json that pins them, and nothing runs the migrations otherwise. Each one adds only what is missing, writes what the generators write now, and logs the step to take by hand where a file lost the shape that the generator wrote. `packageJsonUpdates` in `migrations.json` move each third-party peer that the generators install to its pin in `versions.ts`, in the root package.json of a repo that has it, so a narrower peer range does not stop npm, and `move-peers-in-project-manifests` moves a project's pin of the same package to the version that `nx migrate` wrote in the root package.json, so the root and the apps install one copy. [ADR 0017](./docs/adr/0017-nx-migrations-bring-a-change-of-generated-output-to-the-repos-that-ran-the-generator-before.md) has the rules.
841
+
842
+ | Migration | Version | Brings |
843
+ | ---------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
844
+ | `add-portless-proxy-env` | 0.8.40 | `PORTLESS_UNPRIVILEGED=1` and `PORTLESS_HTTPS=1` in `targetDefaults.portless` (#4768) |
845
+ | `add-local-postgres` | 0.8.40 | the root `compose.dev.yml`, `up` and `down` of each db package, the local `CONNECTION_STRING`, and `^up` in its backend serve (ADR 0012 decisions 16 and 17) |
846
+ | `node-env-production` | 0.8.40 | the NODE_ENV configuration of ADR 0016 (nx.json defaults, target env, the web exceptions, `.env.example`, the workflow env, `ALLOWED_ORIGINS`), and a log of each NODE_ENV read in source |
847
+ | `add-prisma-client-inputs` | 0.8.40 | `...` and `{ "dependentTasksOutputFiles": "**/*.ts" }` in the `inputs` of `targetDefaults.typecheck` and `.build` of a repo with `@zukhruf/nx/prisma`, so a schema change rebuilds the db package (#4826); since 0.8.60 it writes the rule of ADR 0019 |
848
+ | `add-migrate-check` | 0.8.44 | `migrate:check` in `targetDefaults.typecheck.dependsOn` of a repo with `@zukhruf/nx/prisma`, so the typecheck of a db package fails when its migrations do not build its schema (#4937, ADR 0018) |
849
+ | `add-generated-source-defaults` | 0.8.60 | the rule of ADR 0019 in a repo whose `nx.json` lists the three plugins of `init`; removes the `dependsOn: ["^sdk"]` of a web `test` target; logs each other target that hides the rule (#5219) |
850
+ | `add-sdk-build-edges` | 0.8.69 | `build-deps` in each node-app backend; `implicitDependencies` on the backend, `dependsOn: ["^build-deps"]` and the inputs of ADR 0021 in its client's `sdk`; when either file is not the one `node-app` wrote, or the client has no stub, changes neither and logs both edits (#5102) |
851
+ | `rename-eslint-react-config` | 0.8.66 | `zukhruf.configs['shadcn']` for `zukhruf.configs['react']` or `.react` (whatever the default import of `@zukhruf/eslint` is called) and `'zukhruf/shadcn'` for `'zukhruf/react'` in an `extends` array, in each `eslint.config.*`; `@zukhruf/eslint/react` stays; logs each edit (#5263, ADR 0017 decision 10) |
852
+ | `move-peers-in-project-manifests` | 0.8.70 | an entry's version of `packageJsonUpdates` in each project's package.json that declares the package, only when the root package.json declares it at that version (an entry older than the installed @zukhruf/nx, or a package the root does not declare, moves nothing), in its section, never down, never into a project without it; logs each move and the npm install it needs (#5296, #5689, ADR 0017 decision 9) |
853
+ | `type-check-config-files` | 0.8.116 | the `tsconfig.scripts.json` of ADR 0022 and its reference in each node-app and db package that has none; the `hooks` project and the `./.husky` reference when `.husky/project.json` is missing; deletes an `allowDefaultProject` block a generator wrote once a tsconfig covers its files; a file named by a block that stays gets no tsconfig, and each block no generator wrote is logged (#5649) |
854
+ | `move-zukhruf-pins-in-project-manifests` | 0.8.117 | each `packageGroup` package that a project's package.json pins in `dependencies` or `devDependencies` moves to the root's `@zukhruf/nx` version, in the style of its pin; a peer range stays and is logged when it excludes that version; logs each move (#5688, ADR 0017 decision 11) |
854
855
 
855
856
  ## release
856
857
 
@@ -0,0 +1,15 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ /**
3
+ * #5688: `nx migrate @zukhruf/nx@<version>` moves `packageGroup` in the root
4
+ * package.json only (nx 24.0.6 migrate.js updatePackageJson, lines 1461-1497,
5
+ * which reads and writes `<root>/package.json` alone), so each project's
6
+ * package.json kept its @zukhruf pins and npm installed a second copy (Meddit
7
+ * at 0.8.116: @zukhruf/testing 0.8.116 at the root and 0.8.96 in
8
+ * packages/evidence-retrieval). Each package of `packageGroup` that a project
9
+ * pins in dependencies or devDependencies moves to the version nx migrate
10
+ * wrote for @zukhruf/nx in the root, in the style of its pin. A peer range is
11
+ * the contract of a published package, so it stays, and is logged when it
12
+ * excludes that version.
13
+ */
14
+ export default function moveZukhrufPinsInProjectManifests(tree: Tree): Promise<void>;
15
+ //# sourceMappingURL=move-zukhruf-pins-in-project-manifests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-zukhruf-pins-in-project-manifests.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-0-8-117/move-zukhruf-pins-in-project-manifests.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,IAAI,EAMV,MAAM,YAAY,CAAC;AAwBpB;;;;;;;;;;;GAWG;AACH,wBAA8B,iCAAiC,CAC7D,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,IAAI,CAAC,CA2Cf"}
@@ -0,0 +1,63 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { formatFiles, getProjects, joinPathFragments, logger, readJson, } from '@nx/devkit';
3
+ import { satisfies, validRange } from 'semver';
4
+ import { updateJsonIfChanged } from '../workspace.js';
5
+ const name = 'move-zukhruf-pins-in-project-manifests';
6
+ /** An exact, `^` or `~` pin of one version. nx migrate writes the exact form. */
7
+ const PIN = /^(?<style>[\^~]?)(?<version>\d+\.\d+\.\d+(?:-[\w.]+)?)$/;
8
+ /** The @zukhruf packages that `nx migrate @zukhruf/nx` moves with it: `packageGroup` of this package. */
9
+ function packageGroup() {
10
+ const manifest = JSON.parse(readFileSync(new URL('../../../package.json', import.meta.url), 'utf-8'));
11
+ return new Set(manifest['nx-migrations'].packageGroup);
12
+ }
13
+ /**
14
+ * #5688: `nx migrate @zukhruf/nx@<version>` moves `packageGroup` in the root
15
+ * package.json only (nx 24.0.6 migrate.js updatePackageJson, lines 1461-1497,
16
+ * which reads and writes `<root>/package.json` alone), so each project's
17
+ * package.json kept its @zukhruf pins and npm installed a second copy (Meddit
18
+ * at 0.8.116: @zukhruf/testing 0.8.116 at the root and 0.8.96 in
19
+ * packages/evidence-retrieval). Each package of `packageGroup` that a project
20
+ * pins in dependencies or devDependencies moves to the version nx migrate
21
+ * wrote for @zukhruf/nx in the root, in the style of its pin. A peer range is
22
+ * the contract of a published package, so it stays, and is logged when it
23
+ * excludes that version.
24
+ */
25
+ export default async function moveZukhrufPinsInProjectManifests(tree) {
26
+ const root = readJson(tree, 'package.json');
27
+ const rootPin = root.devDependencies?.['@zukhruf/nx'] ?? root.dependencies?.['@zukhruf/nx'];
28
+ const version = rootPin === undefined ? undefined : PIN.exec(rootPin)?.groups?.['version'];
29
+ if (version === undefined) {
30
+ logger.info(`${name}: package.json pins @zukhruf/nx at ${rootPin}, not at one version, so no project pin moves (#5688)`);
31
+ return;
32
+ }
33
+ const group = packageGroup();
34
+ for (const [, project] of getProjects(tree)) {
35
+ const path = joinPathFragments(project.root, 'package.json');
36
+ if (!tree.exists(path))
37
+ continue;
38
+ updateJsonIfChanged(tree, path, (manifest) => {
39
+ for (const pins of [manifest.dependencies, manifest.devDependencies]) {
40
+ if (pins === undefined)
41
+ continue;
42
+ for (const [pkg, pin] of Object.entries(pins)) {
43
+ const style = PIN.exec(pin)?.groups?.['style'];
44
+ // file:, workspace: and other non-version pins have no style and stay.
45
+ if (!group.has(pkg) || style === undefined)
46
+ continue;
47
+ const moved = `${style}${version}`;
48
+ if (pin === moved)
49
+ continue;
50
+ pins[pkg] = moved;
51
+ logger.info(`${name}: ${path} ${pkg} ${pin} -> ${moved} (#5688)`);
52
+ }
53
+ }
54
+ for (const [pkg, range] of Object.entries(manifest.peerDependencies ?? {}))
55
+ if (group.has(pkg) &&
56
+ validRange(range) !== null &&
57
+ !satisfies(version, range))
58
+ logger.info(`${name}: ${path} peerDependencies ${pkg} ${range} excludes ${version}: widen it by hand (#5688)`);
59
+ });
60
+ }
61
+ await formatFiles(tree);
62
+ }
63
+ //# sourceMappingURL=move-zukhruf-pins-in-project-manifests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-zukhruf-pins-in-project-manifests.js","sourceRoot":"","sources":["../../../src/migrations/update-0-8-117/move-zukhruf-pins-in-project-manifests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAEL,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,MAAM,EACN,QAAQ,GACT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,CACT,GAAG,IAAI,KAAK,IAAI,qBAAqB,GAAG,IAAI,KAAK,aAAa,OAAO,4BAA4B,CAClG,CAAC;QACR,CAAC,CAAC,CAAC;IACL,CAAC;IACD,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -3,10 +3,20 @@ import { type Tree } from '@nx/devkit';
3
3
  * #5296: `nx migrate` writes `packageJsonUpdates` in the root package.json
4
4
  * only (nx 24.0.6 migrate.js updatePackageJson), but the generators pin a peer
5
5
  * such as react in each app's own package.json too, so npm installs a second
6
- * copy for the app. Each project's package.json gets the same versions for the
7
- * packages it declares, and only those. Nx's addDependenciesToPackageJson moves
8
- * a package in the section that declares it and never moves a version down, so
9
- * the entries apply in any order and the newest wins.
6
+ * copy for the app. A project's package.json gets an entry's version of a
7
+ * package it declares only when the root package.json declares that package at
8
+ * that version, so the project and the root install one copy.
9
+ *
10
+ * #5689: Nx calls a migration with the tree alone (nx 24.0.6
11
+ * execute-migration.js runNxMigration, `fn(host, {})`) and records no starting
12
+ * version in migrations.json (migrate.js `{ ...migration, package, name }`), so
13
+ * the migration cannot read the window nx migrate ran. The root shows it: nx
14
+ * migrate writes an entry's version in the root only for a package the root
15
+ * declares and an entry no older than the installed @zukhruf/nx (migrate.js
16
+ * filterPackageJsonUpdates, shouldApplyPackageUpdate), so an entry older than
17
+ * the repo leaves the root on its own version and moves no project. Nx's
18
+ * addDependenciesToPackageJson moves a package in the section that declares it
19
+ * and never moves a version down.
10
20
  */
11
21
  export default function movePeersInProjectManifests(tree: Tree): Promise<void>;
12
22
  //# sourceMappingURL=move-peers-in-project-manifests.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"move-peers-in-project-manifests.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-0-8-70/move-peers-in-project-manifests.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,IAAI,EAOV,MAAM,YAAY,CAAC;AA4BpB;;;;;;;;GAQG;AACH,wBAA8B,2BAA2B,CACvD,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,IAAI,CAAC,CAiBf"}
1
+ {"version":3,"file":"move-peers-in-project-manifests.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-0-8-70/move-peers-in-project-manifests.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,IAAI,EAOV,MAAM,YAAY,CAAC;AA4BpB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAA8B,2BAA2B,CACvD,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,IAAI,CAAC,CAiCf"}
@@ -10,28 +10,49 @@ function packageJsonUpdates() {
10
10
  * #5296: `nx migrate` writes `packageJsonUpdates` in the root package.json
11
11
  * only (nx 24.0.6 migrate.js updatePackageJson), but the generators pin a peer
12
12
  * such as react in each app's own package.json too, so npm installs a second
13
- * copy for the app. Each project's package.json gets the same versions for the
14
- * packages it declares, and only those. Nx's addDependenciesToPackageJson moves
15
- * a package in the section that declares it and never moves a version down, so
16
- * the entries apply in any order and the newest wins.
13
+ * copy for the app. A project's package.json gets an entry's version of a
14
+ * package it declares only when the root package.json declares that package at
15
+ * that version, so the project and the root install one copy.
16
+ *
17
+ * #5689: Nx calls a migration with the tree alone (nx 24.0.6
18
+ * execute-migration.js runNxMigration, `fn(host, {})`) and records no starting
19
+ * version in migrations.json (migrate.js `{ ...migration, package, name }`), so
20
+ * the migration cannot read the window nx migrate ran. The root shows it: nx
21
+ * migrate writes an entry's version in the root only for a package the root
22
+ * declares and an entry no older than the installed @zukhruf/nx (migrate.js
23
+ * filterPackageJsonUpdates, shouldApplyPackageUpdate), so an entry older than
24
+ * the repo leaves the root on its own version and moves no project. Nx's
25
+ * addDependenciesToPackageJson moves a package in the section that declares it
26
+ * and never moves a version down.
17
27
  */
18
28
  export default async function movePeersInProjectManifests(tree) {
19
- const updates = packageJsonUpdates();
20
- for (const [, { root }] of getProjects(tree)) {
21
- const path = joinPathFragments(root, 'package.json');
29
+ const root = readJson(tree, 'package.json');
30
+ const updates = packageJsonUpdates().map((update) => writtenInRoot(root, update));
31
+ const moves = [...getProjects(tree).values()].flatMap(({ root: projectRoot }) => {
32
+ const path = joinPathFragments(projectRoot, 'package.json');
22
33
  if (!tree.exists(path))
23
- continue;
34
+ return [];
24
35
  const before = readJson(tree, path);
25
36
  for (const update of updates)
26
37
  addDependenciesToPackageJson(tree, declared(before, update), {}, path);
27
38
  const after = readJson(tree, path);
28
- for (const section of sections)
29
- for (const [name, version] of Object.entries(before[section] ?? {}))
30
- if (after[section]?.[name] !== version)
31
- logger.info(`move-peers-in-project-manifests: ${path} ${name} ${version} -> ${after[section]?.[name]} (#5296)`);
32
- }
39
+ return sections.flatMap((section) => Object.entries(before[section] ?? {})
40
+ .filter(([name, version]) => after[section]?.[name] !== version)
41
+ .map(([name, version]) => `${path} ${name} ${version} -> ${after[section]?.[name]}`));
42
+ });
43
+ for (const move of moves)
44
+ logger.info(`move-peers-in-project-manifests: ${move} (#5296)`);
45
+ // nx migrate reinstalls after a migration only when the root package.json
46
+ // changed (nx 24.0.6 execute-migration.js installDepsIfChanged,
47
+ // readPackageJsonDeps), so node_modules lags each project this moved.
48
+ if (moves.length > 0)
49
+ logger.info('move-peers-in-project-manifests: run npm install; nx migrate reinstalls only when the root package.json changes (#5689)');
33
50
  await formatFiles(tree);
34
51
  }
52
+ /** The packages of `update` that the root package.json declares at the entry's version, in either section. */
53
+ function writtenInRoot(root, update) {
54
+ return Object.fromEntries(Object.entries(update).filter(([name, version]) => sections.some((section) => root[section]?.[name] === version)));
55
+ }
35
56
  /** The packages of `update` that a manifest declares, in either section. */
36
57
  function declared(manifest, update) {
37
58
  return Object.fromEntries(Object.entries(update).filter(([name]) => sections.some((section) => manifest[section]?.[name] !== undefined)));
@@ -1 +1 @@
1
- {"version":3,"file":"move-peers-in-project-manifests.js","sourceRoot":"","sources":["../../../src/migrations/update-0-8-70/move-peers-in-project-manifests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,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M,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;QACzE,MAAM,KAAK,GAAG,QAAQ,CAAW,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7C,KAAK,MAAM,OAAO,IAAI,QAAQ;YAC5B,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;gBACjE,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,OAAO;oBACpC,MAAM,CAAC,IAAI,CACT,oCAAoC,IAAI,IAAI,IAAI,IAAI,OAAO,OAAO,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CACnG,CAAC;IACV,CAAC;IACD,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,4EAA4E;AAC5E,SAAS,QAAQ,CACf,QAAkB,EAClB,MAA8B;IAE9B,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CACvC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,CACpE,CACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"move-peers-in-project-manifests.js","sourceRoot":"","sources":["../../../src/migrations/update-0-8-70/move-peers-in-project-manifests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAEL,4BAA4B,EAC5B,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,MAAM,EACN,QAAQ,GACT,MAAM,YAAY,CAAC;AASpB,MAAM,QAAQ,GAAuB,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;AAEz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I,CAAC,KAAK,OAAO,CAAC,CAC9D,CACF,CAAC;AACJ,CAAC;AAED,4EAA4E;AAC5E,SAAS,QAAQ,CACf,QAAkB,EAClB,MAA8B;IAE9B,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CACvC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,CACpE,CACF,CAAC;AACJ,CAAC"}
package/migrations.json CHANGED
@@ -49,6 +49,11 @@
49
49
  "version": "0.8.116",
50
50
  "description": "tsc type-checks the config files and Git hooks that typed lint gave to its default project: each node-app and db package with no tsconfig.scripts.json gets the one node-app or prisma writes (sdk-it.config.ts or prisma.config.ts) and its reference in the project's tsconfig.json, .ts hooks with no .husky/project.json get the hooks project of init and the './.husky' reference of the root tsconfig.json, and an allowDefaultProject block a generator wrote is deleted once a tsconfig covers its files; a file that a block which stays names gets no tsconfig, because typed lint refuses a file both cover, and each block no generator wrote stays and is logged with its file and line (#5649, ADR 0022).",
51
51
  "implementation": "./dist/migrations/update-0-8-116/type-check-config-files.js"
52
+ },
53
+ "move-zukhruf-pins-in-project-manifests": {
54
+ "version": "0.8.117",
55
+ "description": "A @zukhruf package that nx migrate moves with @zukhruf/nx (packageGroup) moves in each project's package.json that pins it in dependencies or devDependencies too, to the version the root package.json now has for @zukhruf/nx and in the style of its pin (exact stays exact, ^ stays ^), because nx migrate writes the root package.json only; a peer range is left and logged when it excludes that version, and each move is logged (#5688).",
56
+ "implementation": "./dist/migrations/update-0-8-117/move-zukhruf-pins-in-project-manifests.js"
52
57
  }
53
58
  },
54
59
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zukhruf/nx",
3
- "version": "0.8.116",
3
+ "version": "0.8.117",
4
4
  "description": "The Nx part of the monorepo standard: inference plugins for format, test, lint, opentofu and prisma targets, and generators for the root files (preset, init), apps (node-app, react-app, pair, ui-package), a db package (prisma) and delivery (dokploy).",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -132,7 +132,7 @@
132
132
  "@nx/react": ">=24.0.6 <25.0.0",
133
133
  "@nx/vite": ">=24.0.6 <25.0.0",
134
134
  "@nx/vitest": ">=24.0.6 <25.0.0",
135
- "@zukhruf/testing": "^0.8.116",
135
+ "@zukhruf/testing": "^0.8.117",
136
136
  "nx": ">=24.0.6 <25.0.0",
137
137
  "prettier": "^3.0.0",
138
138
  "typescript": ">=5.8.0 <6.1.0"
@@ -154,13 +154,15 @@
154
154
  "optional": true
155
155
  }
156
156
  },
157
+ "dependencies": {
158
+ "semver": "^7.8.5"
159
+ },
157
160
  "devDependencies": {
158
161
  "@sdk-it/hono": "0.46.11",
159
- "@zukhruf/eslint": "^0.8.116",
160
- "@zukhruf/fs": "^0.8.116",
161
- "@zukhruf/testing": "^0.8.116",
162
+ "@zukhruf/eslint": "^0.8.117",
163
+ "@zukhruf/fs": "^0.8.117",
164
+ "@zukhruf/testing": "^0.8.117",
162
165
  "evlog": "2.35.1",
163
- "hono": "4.13.20",
164
- "semver": "^7.8.5"
166
+ "hono": "4.13.20"
165
167
  }
166
168
  }