-
Notifications
You must be signed in to change notification settings - Fork 31
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
Thoughts for yarn-based redesign #19
Comments
Hi, @alexeagle! I'm currently working on a similar thing on our internal bazel-ified and would love to trade notes (though I suspect you know way more about bazel than I do - I'm currently flailing just a little bit). At any rate - any insight into what you have would be very appreciated, and I'm happy to beta-test / ask questions / provide comments in return. (: |
Hey, I finally got our implementation in good shape and open-sourced, as part of https://github.com/bazelbuild/rules_typescript (see eg. Highlights:
We're now discussing whether this should be extracted and placed in a first-party build_bazel_rules_node package and what that would mean for your rules. @pcj would love to discuss more with you. I'm on vacation the next two weeks but I'll try to swing by this issue. |
Ping @pcj |
Thanks @alexeagle and apologies for a very tardy reply as I have been doing some interesting traveling with the family over the summer and limited ability to deep dive on a number of areas, including this one. I do like your design and fully support it being extracted into a standalone bazelbuild/rules_node project. I think the most important feature is probably keeping it as close to normal node_js project usage (for compatibility with other tools as your mention), and your approach via the These rules improved upon the state of nodejs support in the bazel ecosystem, but I make no claim they are the be-all-end-all. If you'd like help in setting up and.or maintaining that repo, I'd be game to assist. |
Update on the design above: I learned of a special label syntax |
FYI: https://github.com/redfin/npm-bazel (thanks, @dlorenc) |
Nice! I'm interested in helping however I can :) For context, I wrote the node rules that we use inside of Dropbox: https://github.com/dropbox/rules_node At Dropbox, the first approach we tried was to have Bazel completely manage our npm dependencies. That broke down when we realized that modules with circular dependencies are everywhere in the npm ecosystem. Then we went the complete opposite direction and said that each project should have a package.json and npm-shrinkwrap.json, and we'll use a Bazel rule to download everything from the shrinkwrap. That worked better and is fine for smaller projects, but it wasn't great at Dropbox because it meant that everyone was using a different version of their dependencies. When we wanted to upgrade something, like the version of typescript we used, we needed to make sure to upgrade it everywhere. What we've landed on now is putting all of our direct dependencies in the folder |
Hey @samertm But, since my rules take a label :package_json as an attribute, one could have a scheme for registering global package versions, and individual projects in the monorepo choose a subset of these, then generate the Does dropbox use any TypeScript or Angular? Unless we converge on a single nodejs ruleset, I'm curious when the differences between our nodejs schemes will actually cause incompatibilities, and what remedies we have for that. |
Update: I published https://github.com/bazelbuild/rules_nodejs |
Nice! Dropbox does use Typescript, but we have a custom set of typescript rules that we aren't planning on open sourcing because they integrate pretty tightly with how we do things at Dropbox. |
I think we can close this issue for now. I'm always happy to discuss the different designs, and also we can open issues on bazelbuild/rules_nodejs for things specific to my re-design. |
Hi @samertm!!! Sean, here from webpack!! I'm really interested to learn more about how you were leveraging the process flow with Bazel/Blaze and webpack. Any where we could sync up, (email, hangouts, etc.). I'm trying to get an official story between the tools and also make any changes needed in webpack (within reason) to acommidate a good parallelization story powered by Bazel/Blaze workers. |
Hey! It might make sense to open an issue on bazelbuild/rules_nodejs about this. Within Dropbox, we have a rule to specifically use Webpack (https://github.com/dropbox/rules_node#webpack_build), but bazelbuild/rules_nodejs is the open source set of nodejs rules that I think we should all start contributing to, and they don't currently have a webpack rule. So first, someone should implement it :) I can offer some insight into making webpack compatible with Bazel once we've gotten that to work. @alexeagle can jump in if what I'm saying doesn't apply to bazelbuild/rules_nodejs (though I'm pretty sure it does), but when we run webpack in Bazel, it ends up being run in a tree of symlinks to other sources (called the "runfiles" for that target). Basically any time that webpack does a realpath on something (e.g. with loaders), that escapes the runfiles symlink tree and potentially breaks things. That was what caused extract-text-webpack-plugin to not work: webpack-contrib/extract-text-webpack-plugin#618. So that's something to keep in mind, but we probably shouldn't jump the gun just yet. First someone needs to implement some node_build/webpack_build rules for bazelbuild/rules_nodejs. Glad to hear that webpack is interested in supporting Bazel, though! |
https://github.com/nrwl/nx/blob/master/packages/bazel/src/utils/webpack.bzl is already based on bazelbuild/rules_nodejs |
@mterring just published our modified rules https://github.com/happy-co/rules_node. Adding to the discussion as it supports sandboxing, yarn, bower and typescript. |
Opening this here as a better location to continue from bazelbuild/rules_closure#205 (comment)
yarn install is part of the repository rule where we install yarn. So after the WORKSPACE execution is finished, we have a node_modules directory up-to-date wrt. the yarn.lock file.
We only need to write a one-line BUILD file into node_modules with filegroup(glob(all), visibility=[public]).
I have a design doc out to @damienmg proposing this for the bazelbuild repo. Right now the doc is internal-only. I should have a prototype inside the typescript rules which I hope to open-source in a week or two.
Happy to discuss more!
The text was updated successfully, but these errors were encountered: