ymedlop/npm-cache-resource

Support Incremental Caching

Closed this issue · 2 comments

If I understand correctly, this cache resource does checkout the source repo, run npm install and provides the node_modules folder. As far as I can see, this is only useful for avoiding to re-download node modules as part of the same pipeline execution.

However it does not cache npm modules in between pipeline executions, right?

It'd be awesome if we could have a way to incrementally cache the global npm/yarn cache and restore that before build execution. Do you see any way to make that happen?

Update: I see that the git resource will only trigger updates when the packages.json file itself has changed:

paths: Optional. If specified (as a list of glob patterns), only changes to the specified files will yield new versions from check.

That makes npm-cache-resource a lot more useful I guess :-)

Hi,

You are right. npm-cache-resource is a wrapper of git concourse resource. It`s the reason we can cache the npm modules between pipelines executions meanwhile the package.json doesn't has changes.

Example:

 # a resource caching the dependencies listed in the source repository
  - name: npm-repo-cache
    type: npm-cache # as defined above
    source:
      <<: *repo-source # the source is the same as the corresponding git resource ...
      paths: # ... except that it's only interested in files listing dependencies
        - package.json