Skip to content

feat(@schematics/angular): add use-library-builder migration to migrate from ng-packagr - #34232

Open
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:feat/use-library-builder-migration
Open

alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:feat/use-library-builder-migration

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

Adds an optional migration for v22.3.0 to migrate library projects from ng-packagr to the @angular/build:library builder.

The migration:

  • Discovers and converts primary and secondary entry points into the library package.json exports map.
  • Migrates assets and style preprocessor options from ng-package.json.
  • Configures compilationMode: 'full' and declarationMap: true for the development configuration.
  • Deletes ng-package.json files and removes ngPackage from package.json.
  • Removes ng-packagr dependency and ensures @angular/build is present when no other ng-packagr targets remain.

@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: @schematics/angular labels Oct 1, 2026
@alan-agius4
alan-agius4 force-pushed the feat/use-library-builder-migration branch 2 times, most recently from f08895d to 8a5e256 Compare October 1, 2026 12:05
@alan-agius4 alan-agius4 added the target: minor This PR is targeted for the next minor release label Oct 1, 2026
@alan-agius4
alan-agius4 force-pushed the feat/use-library-builder-migration branch 2 times, most recently from dd4e9fb to c6c9faf Compare October 1, 2026 12:51
@alan-agius4
alan-agius4 requested a review from clydin October 2, 2026 08:48
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 2, 2026
@alan-agius4
alan-agius4 marked this pull request as ready for review October 2, 2026 08:48

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a new migration schematic, use-library-builder, designed to transition Angular library projects from the legacy ng-packagr builder to the new @angular/build:library builder. The migration handles transferring target options, discovering and mapping secondary entry points to package.json exports, and cleaning up obsolete configuration files and dependencies. Feedback on the implementation suggests refactoring a while loop in the directory traversal logic to avoid assignment within the loop condition, which improves code readability and prevents potential linter warnings.

Comment thread packages/schematics/angular/migrations/use-library-builder/migration.ts Outdated
@alan-agius4
alan-agius4 force-pushed the feat/use-library-builder-migration branch 3 times, most recently from a040fd7 to 8ac844b Compare October 2, 2026 09:05
…te from ng-packagr

Adds an optional migration for v22.3.0 to migrate library projects from
ng-packagr to the @angular/build:library builder.

The migration:
- Discovers and converts primary and secondary entry points into the library package.json exports map.
- Migrates assets and style preprocessor options from ng-package.json.
- Configures compilationMode: 'full' and declarationMap: true for the development configuration.
- Deletes ng-package.json files and removes ngPackage from package.json.
- Removes ng-packagr dependency and ensures @angular/build is present when no other ng-packagr targets remain.
@alan-agius4
alan-agius4 force-pushed the feat/use-library-builder-migration branch from 8ac844b to 0788bdb Compare October 2, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @schematics/angular detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant