Skip to content

feat: migrate to Nx 24 - #90

Merged
NathanWalker merged 11 commits into
mainfrom
feat/nx-24
Nov 25, 2026
Merged

NathanWalker merged 11 commits into
mainfrom
feat/nx-24

Conversation

@NathanWalker

@NathanWalker NathanWalker commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Moves the workspace and the plugin to Nx 24.0.7 and keeps TypeScript on 6.0.3. It follows the pattern of #86. It also fixes several generator and executor problems found while testing end to end, and generates NativeScript 9.1 apps.

Version changes (root devDependencies)

package before after
nx, @nx/angular, @nx/devkit, @nx/eslint, @nx/eslint-plugin, @nx/express, @nx/js, @nx/plugin, @nx/web, @nx/workspace 23.1.0 24.0.7
@nx/vitest ^23.1.0 24.0.7
nx-cloud 19.1.3 19.1.5
typescript 6.0.3 6.0.3 (unchanged; Nx 24 peers ^5.8.0 || ^6.0.0)
vitest / @vitest/coverage-v8 / vite ^3.2.7 / ^3.2.7 / ^7.3.6 unchanged (@nx/vitest 24 still accepts vitest 3 and vite 7; nx migrate proposed no bump)

package-lock.json gets about 550 entries smaller, mostly because @nx/angular/@nx/web 24 no longer pull in webpack, rspack or module federation.

Versions the generators install

package before after
@nativescript/core, @nativescript/types ~9.0.0 ~9.1.0 (npm latest 9.1.4)
@nativescript/ios ~9.0.0 ~9.1.0 (latest 9.1.1)
@nativescript/android ~9.0.0 ~9.1.0 (latest 9.1.2)
@nativescript/webpack ~5.0.0 unchanged (latest 5.0.42)
@nativescript/tailwind / tailwindcss ^2.1.0 / ~3.4.0 unchanged (hold policy: tailwind 4 would be a separate change)

These were applied with npm run update-versions -- --write.

Migrations run (nx migrate 24.0.7, 14 steps, all applied, none unresolved)

  • nx:24-0-0-enable-legacy-affected: sets affected.legacy: true in nx.json.
  • @nx/eslint:remove-deprecated-executors: Nx 24 removes @nx/eslint:lint. It registers @nx/eslint/plugin and drops the @nx/eslint:lint target default. Two manual follow-ups:
    • Added exclude: ["packages/nx/src/generators/*/files*/**"] to the plugin registration. Without it, the package.json files in the generator templates get picked up as unnamed projects and the project graph fails to build.
    • Removed the converted lint override from packages/nx/project.json. Its shell-glob args made eslint exit with "No files matching". The inferred eslint . lints a superset of the old patterns with the same result.
  • The other 12 migrations made no changes.
  • The root migrations.json and the generated tools/ai-migrations/ prompts are not committed.

Plugin changes

  • application: lint setup. Nx 24 turns eslintFilePatterns into an explicit eslint apps/<app>/**/*.{ts,spec.ts} command target. That fails on every freshly generated app, which has no spec files. Generated apps now use the inferred eslint . target, with flat-config ignores for **/platforms, **/hooks and **/references.d.ts.
  • library: lint setup. The generated eslint config now ignores **/references.d.ts. Its triple-slash references failed @typescript-eslint/triple-slash-reference, so a new library didn't lint clean (on Nx 23 as well).
  • Executors: no TTY. prepare/build/etc. without -c used to crash with ERR_USE_AFTER_CLOSE when stdin wasn't a TTY, because of the "No configuration was provided" prompt. Without a TTY they now continue with no configuration and log the existing warning. That is the same as answering "No" interactively, and the same as Nx's own behavior without -c. A missing platform has no sensible default, so without a TTY it fails with an error pointing at --platform or --silent (which already defaults to iOS). Both helpers moved to module scope so they can be unit tested.
  • application: vanilla tsconfig.app.json listed src/main.ts, which doesn't exist; it now points at src/app.ts. The spec now checks that every file in tsconfig.app.json exists, for both frameworks.
  • application: tailwind dependencies. Both templates ship tailwind.config.js and an app.css with @tailwind directives, but only the Angular app added @nativescript/tailwind and tailwindcss to the root package.json. Every app now gets them, so prepare works without installing them by hand.
  • application: Angular template under TypeScript 6. TypeScript 6 turns strict on by default, so the generated Angular app failed its webpack build: getItem() returned a possibly undefined find() result as Item, and the detail component used signal<Item>(null). Both are now typed Item | undefined (the template already reads them with ?.).
  • library spec: Nx 24's @nx/js library generator no longer defaults linter to eslint when called programmatically (the CLI schema default is still eslint). The spec now passes linter: 'eslint' and asserts the inferred plugin setup.
  • Root scripts: lint called the removed nx workspace-lint, so npm run lint failed. affected:apps, affected:libs, help and workspace-generator also called commands that no longer exist. They now use nx run-many -t lint, nx show projects --affected --type app|lib, nx affected -t <target>, nx graph [--affected] and nx --help. start (nx serve) is gone because no project has a serve target.
  • No changes to executor options or schemas, and no entry in packages/nx/migrations.json. Existing user @nx/eslint:lint targets are converted by Nx's own @nx/eslint migration.

Peer range: kept at >=23.0.0

The built plugin still works on Nx 23. I installed this branch's tarball into a scratch Nx 23.1.0 + TS 6.0.3 workspace. There the application and library generators ran, clean ran, and the generated app's lint passed. Every Nx API the plugin imports exists in both 23 and 24.

Merge of main

main (#87's release workflow plus the bot's 22.0.1-next.0 version commit) is merged in. nx.json keeps this branch's Nx 24 settings and takes release and the nx-release-publish target default from main. The lockfile is this branch's Nx 24 lockfile; npm install against the merged package.json leaves it unchanged. With Nx 24, npx nx release --help works and npx nx release major --dry-run --skip-publish resolves, versions, previews the changelog, commits and tags without errors.

Verification

check baseline (origin/main before this PR, Nx 23.1.0) this branch (Nx 24.0.7)
npm run build (nx prepare nx) pass pass
npm test 4 files, 18 tests pass 5 files, 26 tests pass
lint npm run lint broken (workspace-lint); nx lint nx: 0 errors, 48 warnings npm run lint: 0 errors, 47 warnings
tsc -p packages/nx/tsconfig.spec.json --noEmit pass pass
npm ci from the lockfile n/a pass

End-to-end check with the packed tarball, in a fresh scratch Nx 24.0.7 workspace (TS 6.0.3, NativeScript CLI 9.1.2, nothing installed by hand):

  • nx g @nativescript/nx:app (vanilla and angular) and nx g @nativescript/nx:library: OK. The root package.json gets @nativescript/core ~9.1.0, @nativescript/types ~9.1.0 and the tailwind packages.
  • nx run-many -t lint over both apps and the library: OK, 0 errors.
  • tsc -p apps/nativescript-demo/tsconfig.app.json --noEmit: OK.
  • Library build: OK.
  • nx run nativescript-demo:clean: OK.
  • nx run nativescript-demo:prepare --platform=ios and --platform=android, with no -c and no TTY: OK. The executor logs "Continuing with no configuration", and ns reports "Project successfully prepared".
  • nx run nativescript-ngapp:prepare --platform=ios and --platform=android (the Angular app, under TypeScript 6 defaults): OK.
  • prepare with no --platform and no TTY fails with the new --platform error.
  • Not run: build/debug/run/test (they need signing or a device/simulator). They share commonExecutor with prepare/clean.

Still open

The executors still deep-merge the raw project.json options over the options Nx resolved, so a CLI override like --noHmr=false is ignored for keys already set in options (use a named configuration). This is unchanged from Nx 23.

Release

packages/nx/package.json is set to 24.0.0-next.0. nx release reads the current version from that file (Nx 24 defaults to the manifest on disk; git tags are only used with conventional commits). Dry runs on this branch:

  • The automatic release on a push to main (nx release version prerelease --preid next --git-commit --git-push) gives 24.0.0-next.1.
  • The manual workflow_dispatch with release-type: major (nx release major --skip-publish) gives 24.0.0 and tag 24.0.0. This also holds after the bot bumps the file to 24.0.0-next.1.

Order of operations:

  1. When this merges, the push to main auto-publishes 24.0.0-next.1 to the next dist-tag. That needs the npm trusted publisher for @nativescript/nx fixed first: the run for chore: ci workflow #87 pushed its version commit and then failed npm publish with ENEEDAUTH. The trusted-publisher entry must name NativeScript/nx, workflow secure_nx_release.yml and environment npm-publish.
  2. Then the manual workflow_dispatch of secure_nx_release.yml with release-type: major publishes 24.0.0 to latest.

Downstream

The NativeScript monorepo's Nx 24 + TS 6 PR, stacked on NativeScript/NativeScript#11588, temporarily pins @nativescript/nx@23.0.0-rc.0. It will move to the stable release that includes this.

- nx and @nx/* 23.1.0 -> 24.0.7, nx-cloud 19.1.3 -> 19.1.5; typescript stays 6.0.3, vitest stays 3.2.x
- nx migrate: set affected.legacy, convert the removed @nx/eslint:lint executor to the @nx/eslint/plugin inferred target
- exclude generator template dirs from @nx/eslint/plugin so their package.json files are not picked up as projects
- library spec: Nx 24 lint is inferred via @nx/eslint/plugin instead of an explicit executor target
Nx 24 turns eslintFilePatterns into an explicit `eslint <glob>` command that fails on the brace pattern when no spec files exist. Let @nx/eslint/plugin infer `eslint .` and add flat-config ignores for platforms/, hooks/ and references.d.ts instead.
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 610ef5a6-157e-45f7-91a7-e382db20da2e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

The triple-slash references in references.d.ts fail @typescript-eslint/triple-slash-reference, so a freshly generated library did not lint clean.
Without a TTY, the configuration and platform prompts crashed with ERR_USE_AFTER_CLOSE. A missing configuration now falls back to no configuration, the same as answering "No" interactively and the same as Nx's own behavior without -c, and logs the existing warning. A missing platform has no sensible default, so it fails with an error pointing at --platform or --silent (which already defaults to iOS).
workspace-lint, workspace-generator, affected:apps, affected:libs and help no longer exist, so npm run lint failed. Use run-many/affected -t, show projects and graph, including for the affected:<target> and dep-graph aliases that still work. Drop start (no project has a serve target).
The vanilla template has no src/main.ts; its entry is src/app.ts.
Both app templates ship tailwind.config.js and an app.css with tailwind directives, but only the Angular app added @nativescript/tailwind and tailwindcss to the root package.json, so a vanilla app failed to prepare.
@nativescript/core, types, ios and android ~9.0.0 -> ~9.1.0 (latest 9.1.4 / 9.1.4 / 9.1.1 / 9.1.2). @nativescript/webpack ~5.0.0 is already current; @nativescript/tailwind stays on the 2.x line with tailwindcss 3.
nx.json keeps the Nx 24 eslint plugin and affected.legacy settings and takes the release config and nx-release-publish target default from main. package-lock.json is this branch's Nx 24 lockfile; npm install against the merged package.json leaves it unchanged.
nx release reads the current version from packages/nx/package.json, so a prerelease bump on main yields 24.0.0-next.N and a manual major release yields 24.0.0.
…6 strict defaults

TypeScript 6 enables strict by default, so getItem() returning a possibly undefined find() result and signal<Item>(null) failed the generated app's webpack build.
@NathanWalker
NathanWalker merged commit 97152e1 into main Nov 25, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant