Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit a773f89

Browse files
committed
chore(grunt): blow away cached node_modules when npm-shrinkwrap.json changes
this replicates the travis setup in grunt from the previous commit the reason why we duplicate this rather than having just a single place for this code is so that we can individually time the actions on travis
1 parent f497358 commit a773f89

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ install:
4646
# Log HTTP requests
4747
- npm config set loglevel http
4848
- npm install -g [email protected]
49+
# Instal npm dependcies and ensure that npm cache is not stale (these steps are replicated in lib/grunt/utils.js)
4950
- diff -q npm-shrinkwrap.json node_modules/npm-shrinkwrap.cached.json; if [[ $? -ne 0 ]]; then echo 'Shrinkwrap changed! Blowing away node_modules.'; rm -rf node_modules; fi
5051
- time npm install
5152
- cp npm-shrinkwrap.json node_modules/npm-shrinkwrap.cached.json

lib/grunt/utils.js

+3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ module.exports = {
1616

1717
init: function() {
1818
if (!process.env.TRAVIS) {
19+
// replicated from .travis.yaml
20+
shell.exec("diff -q npm-shrinkwrap.json node_modules/npm-shrinkwrap.cached.json; if [[ $? -ne 0 ]]; then echo 'Shrinkwrap changed! Blowing away node_modules.'; rm -rf node_modules; fi");
1921
shell.exec('npm install');
22+
shell.exec('cp npm-shrinkwrap.json node_modules/npm-shrinkwrap.cached.json');
2023
}
2124
},
2225

0 commit comments

Comments
 (0)