Skip to content

fix(@schematics/angular): migrate ng-packagr glob string assets in use-library-builder - #34406

Open
MeAkib wants to merge 5 commits into
angular:mainfrom
MeAkib:fix/use-library-builder-glob-assets
Open

MeAkib wants to merge 5 commits into
angular:mainfrom
MeAkib:fix/use-library-builder-glob-assets

Conversation

@MeAkib

@MeAkib MeAkib commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

ng-packagr treats an assets string that is neither a file nor a directory as a glob relative to
the package root. The migration copied every string as a path, and the library builder treats such
a path as a directory, so glob assets like docs/**/*.md copied nothing after the migration.

Migrate strings that are neither a file nor a directory to { glob, input, output } objects, as
ng-packagr resolves them.

…e-library-builder

ng-packagr treats an `assets` string that is neither a file nor a directory as a glob relative to
the package root. The migration copied every string as a path, and the library builder treats such
a path as a directory, so glob assets like `docs/**/*.md` copied nothing after the migration.

Migrate strings that are neither a file nor a directory to `{ glob, input, output }` objects, as
ng-packagr resolves them.

@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 updates the use-library-builder migration schematic to correctly identify and migrate ng-packagr glob string assets into glob objects, since the library builder only accepts files and directories. It also adds corresponding unit tests to verify this behavior. The review feedback suggests adding a guard to check if the resolved asset path points outside the workspace root (e.g., starting with ..) to prevent potential schematic crashes when calling tree.exists or tree.getDir.

@MeAkib
MeAkib force-pushed the fix/use-library-builder-glob-assets branch from 75e49d3 to 76929e6 Compare October 19, 2026 18:56
Comment thread packages/schematics/angular/migrations/use-library-builder/migration.ts Outdated
Comment thread packages/schematics/angular/migrations/use-library-builder/migration_spec.ts Outdated
@alan-agius4 alan-agius4 added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews target: minor This PR is targeted for the next minor release labels Oct 19, 2026
MeAkib and others added 2 commits October 20, 2026 10:13
…s in use-library-builder

Co-authored-by: Alan Agius <alan.agius4@gmail.com>
…s in use-library-builder

Co-authored-by: Alan Agius <alan.agius4@gmail.com>
@MeAkib
MeAkib force-pushed the fix/use-library-builder-glob-assets branch from 5ff79ee to c39ccd0 Compare October 20, 2026 04:53
@alan-agius4 alan-agius4 removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Oct 20, 2026

@alan-agius4 alan-agius4 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @schematics/angular target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants