-
I am afraid this may create too many caches if hash file changed frequently. I am not a node.js developer, but my understanding is that as long as there is a baseline
node_moduelscache, runningnpm installto make it align with current package.json should be very fast. -
Previous Value Current Value Open
Closed
-
I tried this and it didn’t work as npm install started to fail after few package updates. Seems like it may or may not work. Would be great to have multiple path hash as cache key.
I have of lot of space on my machine so size is not an issue.
-
How are you specifying the cache key?
-
I'm using the following: (I have two node_modules folder in the same project)
caches: - key: '@project_name@-cargo-target' path: target - key: '@project_name@-root-node_modules' path: node_modules - key: '@project_name@-client-node_modules' path: client/node_modules -
For each cache key, OneDev creates a separate cache, and then mounts that cache into specified path. It also makes sure that that particular cache is only used by one job run at the same time. However it maybe used by different job runs (or even different jobs if their cache key is the same) at different time. My understanding is that as long as
npm installrans as the first command, that cache will be synced with the version specified inpackage.jsoneven if some package has different versions (due to use in other jobs etc). I did some experiments when implementing the cache, and it seems so. Please correct me if I am wrong on this.
| Type |
New Feature
|
| Priority |
Minor
|
| Assignee |
Allow a hash of an project file to be included in the cache key. This is useful for caching project dependencies described in files like package.json for Node, composer.json for PHP etc. The advantage is that it would work efficiently across branches or even projects.