Skip to content

feat(nx): update to Nx 23#201

Merged
tbinna merged 1 commit into
mainfrom
nx-23
Jun 26, 2026
Merged

feat(nx): update to Nx 23#201
tbinna merged 1 commit into
mainfrom
nx-23

Conversation

@tbinna

@tbinna tbinna commented Jun 26, 2026

Copy link
Copy Markdown
Member

BREAKING CHANGE: requires Nx 23

Closes #200 #163

Summary by CodeRabbit

  • New Features
    • Improved Forge app generation to better honor the user’s plugin choice, including more precise webpack plugin wiring.
    • Updated Nx Forge package peer requirement to Nx 23 (next major range).
  • Bug Fixes
    • Prevented child Nx processes from inheriting plugin inference settings, reducing unexpected behavior during tasks/tests.
    • Improved cache correctness by expanding lint task inputs.
  • Documentation
    • Added a guide for overriding Forge manifest dependency versions.
    • Updated getting-started instructions to reflect Nx 23.
  • Chores
    • Refreshed workspace tooling/dependency versions and updated CI/docs build tooling.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@tbinna, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 43 minutes and 46 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1485bab9-71d8-474e-a518-9f0d87698723

📥 Commits

Reviewing files that changed from the base of the PR and between 51a4ef8 and 55462cb.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (34)
  • .github/workflows/build-docs.yml
  • .github/workflows/ci-main.yml
  • .github/workflows/ci-pr.yml
  • .github/workflows/deploy-docs.yml
  • .github/workflows/release.yml
  • .gitignore
  • .prettierignore
  • docs/.vitepress/config.mts
  • docs/concepts/plugin-concepts.md
  • docs/guides/adding-a-custom-ui-module.md
  • docs/guides/adding-a-ui-kit-module.md
  • docs/guides/getting-started.md
  • docs/guides/migrating-to-package-executor.md
  • docs/guides/overriding-plugin-dependencies.md
  • e2e/nx-forge-e2e/jest.config.js
  • e2e/nx-forge-e2e/src/application.generator.spec.ts
  • e2e/nx-forge-e2e/src/basic-setup.spec.ts
  • e2e/nx-forge-e2e/src/utils/async-commands.ts
  • e2e/nx-forge-e2e/src/utils/cleanup-registered-forge-app.ts
  • e2e/nx-forge-e2e/src/utils/test-workspace.ts
  • nx.json
  • package.json
  • packages/nx-forge/package.json
  • packages/nx-forge/src/executors/tunnel/executor.ts
  • packages/nx-forge/src/generators/application/generator.spec.ts
  • packages/nx-forge/src/generators/application/generator.ts
  • packages/nx-forge/src/generators/application/lib/add-app-files.ts
  • packages/nx-forge/src/generators/application/lib/add-project-dependencies.ts
  • packages/nx-forge/src/generators/application/lib/add-project.ts
  • packages/nx-forge/src/generators/application/lib/normalize-options.ts
  • packages/nx-forge/src/generators/application/schema.d.ts
  • packages/nx-forge/src/graph/create-nodes.ts
  • packages/nx-forge/src/migrations/update-3-0-0-webpack-config-setup/update-3-0-0-webpack-config-setup.ts
  • pnpm-workspace.yaml
📝 Walkthrough

Walkthrough

Nx 23 support updates workspace metadata, workflows, generator behavior, devkit compatibility imports, e2e command handling, and documentation. It also adds the new plugin dependency override guide and refreshes package and ignore settings.

Changes

Nx 23 support

Layer / File(s) Summary
Workspace config and catalogs
pnpm-workspace.yaml, nx.json, package.json, packages/nx-forge/package.json, .gitignore, .prettierignore
Workspace ignores, task defaults, catalog versions, package manager metadata, and package dependency declarations are updated for the Nx 23 toolchain.
Workflow Node and env updates
.github/workflows/build-docs.yml, .github/workflows/ci-main.yml, .github/workflows/ci-pr.yml, .github/workflows/deploy-docs.yml, .github/workflows/release.yml
GitHub Actions workflows switch Node setup steps to the LTS track and source the Forge email value from workflow variables in the E2E env files.
Application generator behavior
packages/nx-forge/src/generators/application/schema.d.ts, packages/nx-forge/src/generators/application/lib/normalize-options.ts, packages/nx-forge/src/generators/application/lib/add-project.ts, packages/nx-forge/src/generators/application/lib/add-app-files.ts, packages/nx-forge/src/generators/application/lib/add-project-dependencies.ts, packages/nx-forge/src/generators/application/generator.ts, packages/nx-forge/src/generators/application/generator.spec.ts
Application generator normalization, project wiring, dependency resolution, webpack plugin options, and snapshot expectations are updated to respect explicit addPlugin and remove standaloneConfig.
Nx devkit compatibility
packages/nx-forge/src/graph/create-nodes.ts, packages/nx-forge/src/executors/tunnel/executor.ts, packages/nx-forge/src/migrations/update-3-0-0-webpack-config-setup/update-3-0-0-webpack-config-setup.ts
Graph node types, executor imports, and the webpack-config migration are updated to Nx 23 devkit API paths and types.
E2E command environment
e2e/nx-forge-e2e/src/utils/test-workspace.ts
Child process environments are cloned and NX_ADD_PLUGINS is removed before spawning commands in e2e helpers.
E2E command results and assertions
e2e/nx-forge-e2e/src/utils/async-commands.ts, e2e/nx-forge-e2e/src/utils/cleanup-registered-forge-app.ts, e2e/nx-forge-e2e/src/basic-setup.spec.ts, e2e/nx-forge-e2e/src/application.generator.spec.ts
Async command helpers return richer command results, format failures consistently, and the e2e specs use shared assertions and improved failure diagnostics.
Documentation updates
docs/.vitepress/config.mts, docs/concepts/plugin-concepts.md, docs/guides/adding-a-custom-ui-module.md, docs/guides/adding-a-ui-kit-module.md, docs/guides/getting-started.md, docs/guides/migrating-to-package-executor.md, docs/guides/overriding-plugin-dependencies.md
The VitePress sidebar and Forge guides are updated, including the new plugin dependency override guide and revised Nx 23 wording in existing docs.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • toolsplus/nx-forge#196: Also changes webpack-related generator and e2e expectations around generated build output.
  • toolsplus/nx-forge#197: Also changes the e2e/nx-forge-e2e async command helpers and spawned-process handling.
  • toolsplus/nx-forge#198: Also changes e2e/nx-forge-e2e/src/utils/test-workspace.ts command invocation behavior.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: upgrading the project to Nx 23.
Linked Issues check ✅ Passed The PR updates Nx packages and related integration points to 23.x, matching the issue’s request to support Nx 23.
Out of Scope Changes check ✅ Passed The changes are cohesive around the Nx 23 upgrade, with supporting workflow, docs, and test updates; no unrelated work is evident.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/nx-forge/src/generators/application/lib/add-project-dependencies.ts (1)

15-26: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

getLatestPackageVersion throws on network failure, defeating the 'latest' fallback and adding a network call with no timeout.

The function rethrows on any fetch/parse error, so a transient registry hiccup aborts the whole generator. Yet addProjectDependencies (Lines 47-57) is written to warn and fall back to 'latest' when a version is missing — that fallback path is unreachable for network errors because they throw first. Additionally, fetch has no timeout, so a slow/unreachable registry can hang the generator indefinitely.

Decide on one contract: if the intent is graceful degradation, return undefined on failure (and add a timeout); the existing warn-and-fallback in the caller will handle it.

🛡️ Suggested change to align with fallback intent + add a timeout
 async function getLatestPackageVersion(
   pkg: string
 ): Promise<string | undefined> {
   try {
-    const response = await fetch(`https://registry.npmjs.org/${pkg}`);
+    const response = await fetch(`https://registry.npmjs.org/${pkg}`, {
+      signal: AbortSignal.timeout(10_000),
+    });
+    if (!response.ok) {
+      logger.error(`Failed to fetch latest version of ${pkg}: ${response.status}`);
+      return undefined;
+    }
     const json = await response.json();
     return json?.['dist-tags']?.['latest'];
   } catch (error) {
     logger.error(`Failed to fetch latest version of ${pkg}: ${error}`);
-    throw new Error(`Failed to fetch latest version of ${pkg}`);
+    return undefined;
   }
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/nx-forge/src/generators/application/lib/add-project-dependencies.ts`
around lines 15 - 26, getLatestPackageVersion currently throws on fetch/parse
failures, which prevents addProjectDependencies from using its existing
warn-and-fallback-to-'latest' path. Update getLatestPackageVersion to return
undefined on network or JSON errors instead of rethrowing, and add a timeout to
the fetch call so a slow npm registry does not hang the generator. Keep the
logging in getLatestPackageVersion, and make sure the caller in
addProjectDependencies continues to handle missing versions gracefully.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/nx-forge/src/executors/tunnel/executor.ts`:
- Line 2: The tunnel executor currently imports combineAsyncIterables from the
internal `@nx/devkit/internal` entry point, which creates a brittle dependency on
Nx internals. Update the executor in executor.ts to stop using that internal
import and instead use a local helper or a documented public API equivalent,
keeping the change confined to the combineAsyncIterables usage in the tunnel
executor logic.

In `@packages/nx-forge/src/generators/application/generator.ts`:
- Line 19: The application generator currently imports logShowProjectCommand
from an unsupported internal Nx API, which breaks compatibility for nx >=23 <24.
Update the generator in application/generator.ts to stop using
`@nx/devkit/internal` and either replace logShowProjectCommand with a supported
public devkit API or remove the call entirely; keep the change localized to the
generator’s import and the place where the command is used.

In
`@packages/nx-forge/src/generators/application/lib/add-project-dependencies.ts`:
- Line 12: The import from the Nx internal subpath is broken in Nx 23 because
`@nx/js/internal` does not export `esbuildVersion`, `tsLibVersion`, or
`typesNodeVersion`. Update `add-project-dependencies` to stop relying on that
internal import and source those version constants from a supported export or
local definition, keeping the same symbols used by the dependency logic. Ensure
the references in this generator still resolve at runtime without importing from
`@nx/js/internal`.

In `@packages/nx-forge/src/generators/application/lib/add-project.ts`:
- Line 9: The import for addBuildTargetDefaults is using an unsupported internal
Nx entrypoint, which can break when the generator loads in Nx 23. Update
add-project.ts to import addBuildTargetDefaults from the supported public Nx
devkit export used elsewhere in the codebase, and keep the rest of the generator
logic unchanged so the symbol still resolves correctly.

In `@packages/nx-forge/src/generators/application/lib/normalize-options.ts`:
- Line 3: The import in normalize-options.ts is using an unsupported internal Nx
entrypoint that does not actually export determineProjectNameAndRootOptions.
Update the normalizeOptions-related code to import
determineProjectNameAndRootOptions from the supported public Nx devkit location
instead of `@nx/devkit/internal`, and make sure any references in the generator
still resolve through the existing normalize-options flow.

In
`@packages/nx-forge/src/migrations/update-3-0-0-webpack-config-setup/update-3-0-0-webpack-config-setup.ts`:
- Line 7: The migration script currently imports forEachExecutorOptions from the
internal Nx path, which should be switched to the public devkit API. Update the
import in update-3-0-0-webpack-config-setup.ts to use `@nx/devkit` instead of
`@nx/devkit/internal`, keeping the rest of the migration logic unchanged.

---

Outside diff comments:
In
`@packages/nx-forge/src/generators/application/lib/add-project-dependencies.ts`:
- Around line 15-26: getLatestPackageVersion currently throws on fetch/parse
failures, which prevents addProjectDependencies from using its existing
warn-and-fallback-to-'latest' path. Update getLatestPackageVersion to return
undefined on network or JSON errors instead of rethrowing, and add a timeout to
the fetch call so a slow npm registry does not hang the generator. Keep the
logging in getLatestPackageVersion, and make sure the caller in
addProjectDependencies continues to handle missing versions gracefully.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5e58f22c-e70b-4b1f-9e2d-dfea33f8314a

📥 Commits

Reviewing files that changed from the base of the PR and between 466cb1a and b760589.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • .gitignore
  • .prettierignore
  • e2e/nx-forge-e2e/src/utils/async-commands.ts
  • e2e/nx-forge-e2e/src/utils/test-workspace.ts
  • nx.json
  • package.json
  • packages/nx-forge/package.json
  • packages/nx-forge/src/executors/tunnel/executor.ts
  • packages/nx-forge/src/generators/application/generator.spec.ts
  • packages/nx-forge/src/generators/application/generator.ts
  • packages/nx-forge/src/generators/application/lib/add-app-files.ts
  • packages/nx-forge/src/generators/application/lib/add-project-dependencies.ts
  • packages/nx-forge/src/generators/application/lib/add-project.ts
  • packages/nx-forge/src/generators/application/lib/normalize-options.ts
  • packages/nx-forge/src/generators/application/schema.d.ts
  • packages/nx-forge/src/graph/create-nodes.ts
  • packages/nx-forge/src/migrations/update-3-0-0-webpack-config-setup/update-3-0-0-webpack-config-setup.ts
  • pnpm-workspace.yaml
💤 Files with no reviewable changes (1)
  • packages/nx-forge/src/generators/application/schema.d.ts

Comment thread packages/nx-forge/src/executors/tunnel/executor.ts
Comment thread packages/nx-forge/src/generators/application/generator.ts
Comment thread packages/nx-forge/src/generators/application/lib/add-project.ts
@tbinna tbinna force-pushed the nx-23 branch 4 times, most recently from 97bcce0 to 41e3a1b Compare June 26, 2026 04:27
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

@tbinna tbinna force-pushed the nx-23 branch 4 times, most recently from d5ab3b9 to 8e4aaa6 Compare June 26, 2026 08:25
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

@tbinna tbinna force-pushed the nx-23 branch 3 times, most recently from a42f6d2 to 51a4ef8 Compare June 26, 2026 09:37
BREAKING CHANGE: requires Nx 23

Closes #200 #163
@tbinna

tbinna commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai we keep the internal imports because these imports are not part of the public API.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@tbinna Understood — thanks for the clarification. If those Nx utilities aren’t exposed via the public API, keeping the internal imports here makes sense. I’m withdrawing that concern.

(・×・)


✏️ Learnings added
Learnt from: tbinna
URL: https://github.com/toolsplus/nx-forge/pull/201

Timestamp: 2026-06-26T09:55:11.607Z
Learning: In the `toolsplus/nx-forge` repository, imports from internal Nx entrypoints such as `nx/devkit/internal` or `nx/js/internal` may be intentional in files under `packages/nx-forge` when the required Nx utilities are not available through the public API, so these should not be flagged by default in future reviews.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@tbinna tbinna self-assigned this Jun 26, 2026
@tbinna tbinna merged commit 072e4dd into main Jun 26, 2026
7 checks passed
@tbinna tbinna deleted the nx-23 branch June 26, 2026 10:05
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 8.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Nx 23

1 participant