Skip to content

Commit

Permalink
chore(grunt): blow away cached node_modules when npm-shrinkwrap.json …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
IgorMinar committed Feb 22, 2015
1 parent f497358 commit a773f89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ install:
# Log HTTP requests
- npm config set loglevel http
- npm install -g [email protected]
# Instal npm dependcies and ensure that npm cache is not stale (these steps are replicated in lib/grunt/utils.js)
- 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
- time npm install
- cp npm-shrinkwrap.json node_modules/npm-shrinkwrap.cached.json
Expand Down
3 changes: 3 additions & 0 deletions lib/grunt/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ module.exports = {

init: function() {
if (!process.env.TRAVIS) {
// replicated from .travis.yaml
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");
shell.exec('npm install');
shell.exec('cp npm-shrinkwrap.json node_modules/npm-shrinkwrap.cached.json');
}
},

Expand Down

0 comments on commit a773f89

Please sign in to comment.