Travis CI 缓存:从缓存中忽略特定 folder/file

Travis CI cache: ignore specific folder/file from cache

我的 .travis.yml 中有以下配置:

language: node_js
node_js:
- '5.0.0'
sudo: false
cache:
  bundler: true
  directories:
  - node_modules

我的一个包是 Github 分支,其中内容发生变化但版本保持不变。发生的情况是缓存没有失效,此时没有任何问题。但我想知道是否有办法从缓存构造中排除特定文件夹,大致如下:

language: node_js
node_js:
- '5.0.0'
sudo: false
cache:
  bundler: true
  directories:
  - node_modules
  - !node_modules/grommet

其中!node_modules/grommet将从缓存索引中排除。

我尝试使用 before_cache,如 here 中所述。但是运气不好。

感谢任何帮助...

我不得不手动重新安装模块。在您的情况下,您的 travis.yml install 部分应如下所示:

install:
  - npm uninstall grommet
  - npm install