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

chore(examples): add example for ng packagr #1902

Conversation

lukasholzer
Copy link
Collaborator

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

This example should demonstrate the usage of packaging an angular
library with the ng_package rule from @angular/bazel in combination with the ts_library rule in combination with the angular plugin.

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@lukasholzer lukasholzer marked this pull request as draft May 20, 2020 10:01
This example should demonstrate the usage of packaging an angular
library with the `ng_package` rule from @angular/bazel in combination
with the `ts_library`.
Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

that's interesting, from the description I assumed you were using the
load("@npm//ng-packagr:index.bzl", "ng_packagr")
rule here to leverage the normal tooling Angular developers rely on rather than the custom ng_package rule used only by Angular internal
/cc @alan-agius4

@alan-agius4
Copy link
Contributor

@alexeagle, I got the same impression.

I'd definitely recommend using load("@npm//ng-packagr:index.bzl", "ng_packagr") unless you really need more fine grain library builds.

@lukasholzer
Copy link
Collaborator Author

@alan-agius4 I did The steps suggested by the Bazel Angular Docs https://angular.github.io/bazel-builds/src/ng_package/ng_package.html#ng_package

So I've used the installed @angular/bazel package where the rule load("@npm_angular_bazel//:index.bzl", "ng_package") is coming from.

@alexeagle
Copy link
Collaborator

I think the Angular team is deprecating the @angular/bazel package (it was in Labs) so we'd rather not show users how to make new dependencies on it. The ng_package rule is likely to be removed from the public API. Instead we want everyone to use the supported mechanism which is the ng-packagr library.

@alexeagle
Copy link
Collaborator

It looks like we have an ng-packagr example already here
https://github.com/bazelbuild/rules_nodejs/blob/master/examples/angular_bazel_architect/angular.json#L139
so I think this can be closed?

@alexeagle alexeagle added the Can Close? We will close this in 30 days if there is no further activity label Jul 10, 2020
@lukasholzer
Copy link
Collaborator Author

@alexeagle It is an example with the architect – I think there should be an example without using the architect as the architect only allows incremental rebuilds per library and not as granular as it should be with bazel.

I'm not sure if the packagr is needed for the angular package format or if the same can be achieved with rollup? But I think there should be an example of creating an Angular publishable library (Angular Package Format) with the benefits of incremental builds.

@alan-agius4
Copy link
Contributor

@jbedard, was also looking to do something similar.

@alan-agius4
Copy link
Contributor

@alexeagle It is an example with the architect – I think there should be an example without using the architect as the architect only allows incremental rebuilds per library and not as granular as it should be with bazel.

This is that same for this PR, there is no different in using my-packagr directly via using the architect-cli.

@jbedard
Copy link
Collaborator

jbedard commented Jul 10, 2020

This seems to be @angular/bazel, not ng-packagr...?

@alan-agius4
Copy link
Contributor

Ohh, the title of this PR always confuses me 😓

@jbedard
Copy link
Collaborator

jbedard commented Jul 10, 2020

Ohh, the title of this PR always confuses me 😓

I agree :P

@alexeagle
Copy link
Collaborator

updated the title to explain - the issue is when we drop @angular/bazel you lose the ng_package rule and it would be nice to have a replacement

@jbedard
Copy link
Collaborator

jbedard commented Jul 10, 2020

I was trying ng-packagr but as a plain npm package it gets invoked quite differently then ng_package. I got ng_package working (thanks @gregmagolan !) by doing: angular/angular#37727 (comment)

@alexeagle
Copy link
Collaborator

Yeah given time constraints I think you should stick with @angular/bazel for now.
Other angular ecosystem projects like components and ngrx use it so there's no risk it disappears.

@alan-agius4
Copy link
Contributor

@alexeagle, actually it seems that NGRX are moving away from Bazel in favor of NX with ng-packagr.

@github-actions github-actions bot removed the Can Close? We will close this in 30 days if there is no further activity label Jan 23, 2021
@github-actions
Copy link

This Pull Request has been automatically marked as stale because it has not had any activity for 90 days. It will be closed if no further activity occurs in two weeks. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

@github-actions github-actions bot added the Can Close? We will close this in 30 days if there is no further activity label Jul 19, 2021
@github-actions
Copy link

github-actions bot commented Aug 4, 2021

This PR was automatically closed because it went two weeks without a reply since it was labeled "Can Close?"

@github-actions github-actions bot closed this Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Can Close? We will close this in 30 days if there is no further activity cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants