3 ms·
I think the problem here is poor tooling that contaminates your working directory. If you look at something like Bazel, all the build artifacts end up in ~/.ca
by jrockway 7y ago
I think the problem here is poor tooling that contaminates your working directory.
If you look at something like Bazel, all the build artifacts end up in ~/.cache (or similar). Thus there are no artifacts to gitignore. OCI container builds ("docker images") are done by simply adding artifacts controlled by a build rule into the image (rather than starting a vm/container, copying a working directory into the container, and running random shell commands).
To summarize, I think the problem is that node puts packages in your working directory instead of some other location, causing you to have to ignore them. It is reasonable to check in your dependencies, in which case node's strategy is fine. But you can compare this to something like go, which puts all modules in $GOPATH/pkg/mod and if you want to check in your modules, you run "go mod vendor" and it creates a vendor/ directory in your working directory to check in. All of these ignore files exist to work around other packages; it's not git or docker or dropbox's fault that some tool you use contaminates your working directory. Plenty of designs exist for those types of tools that don't.
- michaelmior 7y agoPersonally I prefer that build artifacts end up somewhere under my current working directory. That means if I want to clear everything out related to a project, it's easy to do so without interfering with anything else.
- 7777fps 7y agoYes, as frustrating as it is to need on occassion to rm -rf /node_modules and start again to fix things, at least that's an option.
- tmpz22 7y agoDon't forget the git rm -r --cached ./node_modules!
- michaelmior 7y agoOf course it still would be an option if these were stored out of tree, but it means I need to know where that is. I also have the potential to affect other unrelated projects.
- ska 7y agoI suppose this could be addressed by the tooling, if there was an easy way to get it to echo the target, and it made sure to always keep things separate.
- e40 7y ago> If you look at something like Bazel, all the build artifacts end up in ~/.cache (or similar). That is a terrible design, as it makes parallel builds error prone.
- Vendan 7y agoBazel is the king of parallel builds though, at work we can spread out 100 actions wide across across a cluster of machines, and the only reason it's that small is we have no real need to go wider...
- jingwen 7y agoOutput directories are unique by the user and source project workspace directory. Output artifacts don't clobber, even though they are all in ~/.cache.