-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
[feature] an easy way to add NPM packages, dependencies and/or devDependencies as inputs #1181
Comments
To start, Invalidating based on For example, in tasks:
invalidate:
command: noop And in the consuming projects, depend on that task. tasks:
build:
deps: ['webpack-config:invalidate'] |
Does this include devDependencies of the root package.json? I share devDependencies across all the projects, so will an update of webpack at the root-level also invalidate the hashes for individual projects that don't individually depend on webpack? Also, what about the config situation I described? i.e.:
It's my understanding that even if I make |
Edit: Actually I think it does work this way: https://github.com/moonrepo/moon/blob/master/crates/node/platform/src/actions/run_target.rs#L276 We include changes from the root and project It does include root Relying on those deps "merely existing" is non-ideal and won't be supported by moon. You can workaround this by just having the root
It should invalidate because |
Is your feature request related to a problem? Please describe.
It's really hard to define inputs in a monorepo when you depend on other modules.
Here's an example:
webpack-config
which includes my webpack.config.jsapp
which uses the webpack.config.js from the webpack-config module in the monorepoapp
has a task that runs webpack with the config fromwebpack-config
.Doing any of those things example tasks should invalidate the cache:
webpack.config.js
inwebpack-config
project within the monorepowebpack
devDependency in the project rootwebpack
dependency in thewebpack-config
swc-loader
dependency in thewebpack-config
, as it is used bywebpack.config.js
Describe the solution you'd like
It would be great if we could define that a given task depends on the nested dependency tree of a given package, or specific files from any NPM dependency, using the node_modules resolution algorithm, e.g.:
I'm guessing the first one would be simpler to implement, since it only needs the dependency tree, and the latter one would also need a node resolution algorithm.
One thing to keep in mind is that if a given package exists as a project inside of the monorepo, any change to any file of that project should also invalidate the cache locally.
Describe alternatives you've considered
I guess we could add all of node_modules as inputs, but that's a little nasty, esp. when you need to add in the root devDependencies too, or dependencies of another package:
Gets pretty tedious if you have to maintain the list manually.
And doesn't even work, because
moon
responds with:Additional context
The text was updated successfully, but these errors were encountered: