FSHSP-228 fix(schematics): refuse another Angular major, keep project versions, handle inline type imports - #162
Merged
Merged
Conversation
… versions, handle inline type imports On an Angular 20 project, ng add copied the kit's peerDependencies over the project's versions: core, common, forms, router and platform-browser moved to ^22 while compiler-cli, build and cli stayed on 20, and npm stopped on ERESOLVE with @angular-devkit/build-angular@^22. - ng-add, add and update check the project's Angular major first and stop before writing anything, printing the ng update steps to run. - A declared dependency keeps its range; a missing Angular package takes the project's @angular/core range. - The import rewrite read `type UiIconSize` as a symbol name, so copying ui-input-date failed since 0.11.0. The inline modifier is now skipped for the lookup and kept in the rewritten import. - First schematics tests (pnpm schematics:test, run in PR checks), one of them rendering every kit unit so an unmapped import fails here, not at the consumer's install.
4 tasks
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.
Jira: FSHSP-228. Reported after publishing 0.12.0; ships in 0.12.1.
Problems
ng addon an Angular 20 project: the kit'speerDependencies(^22.0.0) were copied over the project's versions.core,common,forms,router,platform-browsermoved to 22 whilecompiler-cli,buildandclistayed on 20, and npm stopped on ERESOLVE (@angular-devkit/build-angular@^22vs@angular/compiler-cli@^20), leaving a half-migratedpackage.json.ui-input-datefailed since 0.11.0: "import(s) du kit non réadressé(s) … (symbole type UiIconSize)". The import rewrite read the inlinetypemodifier (import { UiIcon, type UiIconSize }) as part of the symbol name.Fix
ng-add,addandupdatecheck the project's Angular major first (utils/angular-version.ts) and stop before writing anything, printing theng updatesteps, one major at a time.ensureDependency: a declared dependency keeps its range; a missing@angular/*package takes the project's@angular/corerange (framework packages peer each other at the exact version).symbolNameskips the inlinetypemodifier for the lookup; the rewritten import keeps it.pnpm schematics:test(99 tests), run inLint, types & docs. One renders every kit unit, so an unmapped import fails here instead of at a consumer's install.[Unreleased].Test plan
pnpm schematics:test: 99 passed. With thetypefix reverted, it fails exactly onui-input-date(and thesymbolNamecases)package.jsonandangular.jsonunchanged, no file createdng-add --skip-components(with install) OK, Angular ranges untouched;add --allthenng buildandbuild-storybookOKnpm install @4sh/ui-kit@0.12.0+ng buildOKpnpm schematics:build,pnpm docs:config:check, Prettier🤖 Generated with Claude Code