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

fix: @npm//foobar:foobar__files target no longer includes nested node_modules #1390

Merged
merged 2 commits into from
Nov 26, 2019

Conversation

gregmagolan
Copy link
Collaborator

@gregmagolan gregmagolan commented Nov 25, 2019

The expected behavior would be that @npm//foobar:foobar__files would just be the files in the package and not the nested node_modules that may or may not be there depending on the behavior of the package installer.

Pre-req for angular/angular#33927

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?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

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.

Wouldn't it be less breaking to keep foo__files containing the same things as today and have the new target be like foo__direct_files or foo__files_no_deps ?

@gregmagolan
Copy link
Collaborator Author

gregmagolan commented Nov 25, 2019

I thought about that but I think the current foo__files filegroup is wrong and anyone using it (which is probably no one) would not expect it to contain the nested node_modules.

What is in the nested node_modules will depend on how things are hoisted which will depend on which package manager was used (yarn/npm) and what other deps are in the package.json.

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.

In that case what prevents us from removing the foo__all_files semantics altogether? Do we still depend on that ourselves like the tests here suggest?

@gregmagolan
Copy link
Collaborator Author

gregmagolan commented Nov 25, 2019

The @npm//foo depends on @npm//foo:foo_all_files so that rules gets the transitive deps if they are not hoisted. If foo has a dep on bar and bar is hoisted then @npm//foo will also depend on @npm//bar:bar__contents.

@alexeagle
Copy link
Collaborator

do we have to expose both @npm//foo and @npm//foo:foo_all_files? seems like you're saying users should never reference the latter

@gregmagolan
Copy link
Collaborator Author

@npm//foo:foo__all_files and @npm//foo:foo__nested_node_modules could be private visibility.

@npm//foo:foo__files is useful to access the raw filegroup that is the npm package without any nested node_modules.

@gregmagolan gregmagolan force-pushed the npm_nested_node_modules branch 2 times, most recently from 39d2305 to 164ade9 Compare November 26, 2019 03:00
@gregmagolan gregmagolan merged commit a13f2b6 into bazel-contrib:master Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants