Support `node_modules` that live in source control
#13926 opened on Jan 31, 2022
Description
What would you like Renovate to be able to do?
Having node_modules checked into source control is not a very common pattern, however there is at least one use case where it simplifies life a lot: creating Github Actions. GH expects all the things needed for runtime to be in the repository, so as a developer you're left with either checking in the node_modules or using a bundler.
The feature request is two-fold:
- The
node_modulesneed to be wiped before renovation:- Without wiping, when used with a lockfile1,
npmdoes not have the information about installed package meta data in the cache and so when it tries to recreate the shrinkwrap it does not have the checksums2. See an example resulting lock file maintenance PR: https://github.com/pkgjs/action/pull/31. - Moreover, when the
node_modulesare present,npmwill not install the latest versions of the packages if the existing ones match the version range (unlessnpm updateis run), so this effectively disables the core purpose of renovate.
- Without wiping, when used with a lockfile1,
- Need to push the updated
node_modulesback into source control after the upgrade.
If you have any ideas on how this should be implemented, please tell us here.
There's probably several considerations for this feature:
- Does this need a separate config option or can it be implied (based on the presence of
node_modules)? - Does this need separate config options for both of the steps - wiping
node_modulesat the start and adding them back at the end? - When lock files are not used, does this need a separate "
node_modulesmaintenance" (which should probably run on a similar schedule as lock file maintenance?)
Alternatively, this could maybe become a little bit more abstract, not tied to node_modules, and just have separate config options for "wipe these files/folders at the start" and "check these folders/files into source control when done".
Is this a feature you are interested in implementing yourself?
Yes
Footnotes
-
lock files are not strictly necessary when checking
node_modulesin, but it is one way to ensure that the whole dependency tree receives updates via renovate. ↩ -
one could argue that this is an issue with npm, however we have to keep in mind, that if npm did not fetch and unpack the files, then it can't really know or calculate the checksum of the unpacked files, therefore leaving it out of the lockfiles is quite possibly the correct behavior. ↩