Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(@angular/build): add ng-packagr builder to the package #29270

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

clydin
Copy link
Member

@clydin clydin commented Jan 7, 2025

To support migration to the @angular/build package which contains the
application builder that is used by all new projects, the ng-packagr
builder used to build Angular libraries is also now available within this
package. This removes the need for projects that are using the application
builder but also would like to build a library from having to install the
Webpack related @angular-devkit/build-angular package. This can result
in a significant reduction in overall Node.js packages installed within the
project.

@clydin clydin added the target: minor This PR is targeted for the next minor release label Jan 7, 2025
@pweyrich
Copy link

pweyrich commented Jan 7, 2025

Could this be called the library builder (@angular/build:library) instead?
In my opinion, this would perfectly complement the application builder.

@clydin
Copy link
Member Author

clydin commented Jan 7, 2025

There will be a library builder in the future but it will effectively be a rewrite that will leverage the compilation internals of the application builder.
The goal with this PR is to remove the need to install a large amount of transitive Webpack related dependencies just to build a library.

@pweyrich
Copy link

pweyrich commented Jan 7, 2025

There will be a library builder in the future but it will effectively be rewrite that will leverage the compilation internals of the application builder.
The goal with this PR is to remove the need to install a large amount of transitive Webpack related dependencies just to build a library.

Got it. Thanks for elaborating on this.
Looking forward!

@clydin clydin marked this pull request as ready for review January 7, 2025 23:53
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jan 8, 2025
Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple of questions.

  1. Do you intend to remove the implementation from build-angular?
  2. Should we move the spec files?
  3. Should we export the builder from https://github.com/angular/angular-cli/blob/328854c99b706d78cbb0440102a71fe91eb3a481/packages/angular/build/src/index.ts?

@alan-agius4 alan-agius4 removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Jan 8, 2025
@clydin clydin force-pushed the ng-packagr-build-package branch 2 times, most recently from e24994e to b25747b Compare January 8, 2025 16:10
clydin added 3 commits January 8, 2025 11:20
To support migration to the `@angular/build` package which contains the
`application` builder that is used by all new projects, the `ng-packagr`
builder used to build Angular libraries is also now available within this
package. This removes the need for projects that are using the application
builder but also would like to build a library from having to install the
Webpack related `@angular-devkit/build-angular` package.  This can result
in a significant reduction in overall Node.js packages installed within the
project.
…neration schematic

The newly introduced `ng-packagr` builder within the `@angular/build` package
is now used when generating a new library with `ng generate library`. This
builder provides the same functionality as the `ng-packagr` builder found
within the `@angular-devkit/build-angular` package but removes the need for
projects to install `@angular-devkit/build-angular` if using the `application`
builder from `@angular/build`.
…kagr builder package

The `use-application-builder` update migration will now attempt to migrate
the `ng-packagr` builder to use the `@angular/build` package if no other
`@angular-devkit/build-angular` usage is present.
@clydin clydin force-pushed the ng-packagr-build-package branch from b25747b to 8b161bf Compare January 8, 2025 16:20
@jkrems
Copy link
Contributor

jkrems commented Jan 8, 2025

Is this ready to be merged for today's rc?

@clydin clydin added the action: merge The PR is ready for merge by the caretaker label Jan 8, 2025
@clydin
Copy link
Member Author

clydin commented Jan 8, 2025

LGTM, just a couple of questions.

  1. Do you intend to remove the implementation from build-angular?
  2. Should we move the spec files?
  3. Should we export the builder from https://github.com/angular/angular-cli/blob/328854c99b706d78cbb0440102a71fe91eb3a481/packages/angular/build/src/index.ts?
  1. Yes, I plan on doing this in a followup refactor PR.
  2. Same as above since the existing spec file is using the old test setup.
  3. Added to this PR.

@clydin clydin merged commit 88431b7 into angular:main Jan 8, 2025
30 of 31 checks passed
@clydin clydin deleted the ng-packagr-build-package branch January 8, 2025 17:21
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: @angular/build 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.

4 participants