Repository navigation
feat: migrate to Nx 24 - #90
Merged
Merged
Conversation
- 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.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
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.
This was referenced Nov 25, 2026
…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.
This was referenced Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
nx,@nx/angular,@nx/devkit,@nx/eslint,@nx/eslint-plugin,@nx/express,@nx/js,@nx/plugin,@nx/web,@nx/workspace@nx/vitestnx-cloudtypescript^5.8.0 || ^6.0.0)vitest/@vitest/coverage-v8/vite@nx/vitest24 still accepts vitest 3 and vite 7;nx migrateproposed no bump)package-lock.jsongets about 550 entries smaller, mostly because@nx/angular/@nx/web24 no longer pull in webpack, rspack or module federation.Versions the generators install
@nativescript/core,@nativescript/types@nativescript/ios@nativescript/android@nativescript/webpack@nativescript/tailwind/tailwindcssholdpolicy: 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: setsaffected.legacy: trueinnx.json.@nx/eslint:remove-deprecated-executors: Nx 24 removes@nx/eslint:lint. It registers@nx/eslint/pluginand drops the@nx/eslint:linttarget default. Two manual follow-ups:exclude: ["packages/nx/src/generators/*/files*/**"]to the plugin registration. Without it, thepackage.jsonfiles in the generator templates get picked up as unnamed projects and the project graph fails to build.lintoverride frompackages/nx/project.json. Its shell-globargsmade eslint exit with "No files matching". The inferredeslint .lints a superset of the old patterns with the same result.migrations.jsonand the generatedtools/ai-migrations/prompts are not committed.Plugin changes
application: lint setup. Nx 24 turnseslintFilePatternsinto an expliciteslint apps/<app>/**/*.{ts,spec.ts}command target. That fails on every freshly generated app, which has no spec files. Generated apps now use the inferredeslint .target, with flat-configignoresfor**/platforms,**/hooksand**/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).prepare/build/etc. without-cused to crash withERR_USE_AFTER_CLOSEwhen 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--platformor--silent(which already defaults to iOS). Both helpers moved to module scope so they can be unit tested.application: vanillatsconfig.app.jsonlistedsrc/main.ts, which doesn't exist; it now points atsrc/app.ts. The spec now checks that every file intsconfig.app.jsonexists, for both frameworks.application: tailwind dependencies. Both templates shiptailwind.config.jsand anapp.csswith@tailwinddirectives, but only the Angular app added@nativescript/tailwindandtailwindcssto the rootpackage.json. Every app now gets them, soprepareworks without installing them by hand.application: Angular template under TypeScript 6. TypeScript 6 turnsstricton by default, so the generated Angular app failed its webpack build:getItem()returned a possibly undefinedfind()result asItem, and the detail component usedsignal<Item>(null). Both are now typedItem | undefined(the template already reads them with?.).libraryspec: Nx 24's@nx/jslibrary generator no longer defaultslinterto eslint when called programmatically (the CLI schema default is stilleslint). The spec now passeslinter: 'eslint'and asserts the inferred plugin setup.lintcalled the removednx workspace-lint, sonpm run lintfailed.affected:apps,affected:libs,helpandworkspace-generatoralso called commands that no longer exist. They now usenx run-many -t lint,nx show projects --affected --type app|lib,nx affected -t <target>,nx graph [--affected]andnx --help.start(nx serve) is gone because no project has aservetarget.packages/nx/migrations.json. Existing user@nx/eslint:linttargets are converted by Nx's own@nx/eslintmigration.Peer range: kept at
>=23.0.0The 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
applicationandlibrarygenerators ran,cleanran, and the generated app's lint passed. Every Nx API the plugin imports exists in both 23 and 24.Merge of
mainmain(#87's release workflow plus the bot's22.0.1-next.0version commit) is merged in.nx.jsonkeeps this branch's Nx 24 settings and takesreleaseand thenx-release-publishtarget default frommain. The lockfile is this branch's Nx 24 lockfile;npm installagainst the mergedpackage.jsonleaves it unchanged. With Nx 24,npx nx release --helpworks andnpx nx release major --dry-run --skip-publishresolves, versions, previews the changelog, commits and tags without errors.Verification
origin/mainbefore this PR, Nx 23.1.0)npm run build(nx prepare nx)npm testnpm run lintbroken (workspace-lint);nx lint nx: 0 errors, 48 warningsnpm run lint: 0 errors, 47 warningstsc -p packages/nx/tsconfig.spec.json --noEmitnpm cifrom the lockfileEnd-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) andnx g @nativescript/nx:library: OK. The rootpackage.jsongets@nativescript/core ~9.1.0,@nativescript/types ~9.1.0and the tailwind packages.nx run-many -t lintover both apps and the library: OK, 0 errors.tsc -p apps/nativescript-demo/tsconfig.app.json --noEmit: OK.build: OK.nx run nativescript-demo:clean: OK.nx run nativescript-demo:prepare --platform=iosand--platform=android, with no-cand no TTY: OK. The executor logs "Continuing with no configuration", andnsreports "Project successfully prepared".nx run nativescript-ngapp:prepare --platform=iosand--platform=android(the Angular app, under TypeScript 6 defaults): OK.preparewith no--platformand no TTY fails with the new--platformerror.build/debug/run/test(they need signing or a device/simulator). They sharecommonExecutorwithprepare/clean.Still open
The executors still deep-merge the raw project.json
optionsover the options Nx resolved, so a CLI override like--noHmr=falseis ignored for keys already set inoptions(use a named configuration). This is unchanged from Nx 23.Release
packages/nx/package.jsonis set to24.0.0-next.0.nx releasereads 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:main(nx release version prerelease --preid next --git-commit --git-push) gives 24.0.0-next.1.workflow_dispatchwithrelease-type: major(nx release major --skip-publish) gives 24.0.0 and tag24.0.0. This also holds after the bot bumps the file to24.0.0-next.1.Order of operations:
mainauto-publishes24.0.0-next.1to thenextdist-tag. That needs the npm trusted publisher for@nativescript/nxfixed first: the run for chore: ci workflow #87 pushed its version commit and then failednpm publishwithENEEDAUTH. The trusted-publisher entry must nameNativeScript/nx, workflowsecure_nx_release.ymland environmentnpm-publish.workflow_dispatchofsecure_nx_release.ymlwithrelease-type: majorpublishes24.0.0tolatest.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.