github.com/kayoticsully/syncthing@v0.8.9-0.20140724133906-c45a2fdc03f8/assets/bootstrap-3.1.1/grunt/shrinkwrap.js (about) 1 /*! 2 * Bootstrap Grunt task for generating npm-shrinkwrap.canonical.json 3 * http://getbootstrap.com 4 * Copyright 2014 Twitter, Inc. 5 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 */ 7 /* 8 This Grunt task updates the npm-shrinkwrap.canonical.json file that's used as the key for Bootstrap's npm packages cache. 9 This task should be run and the updated file should be committed whenever Bootstrap's dependencies change. 10 */ 11 'use strict'; 12 var canonicallyJsonStringify = require('canonical-json'); 13 var NON_CANONICAL_FILE = 'npm-shrinkwrap.json'; 14 var DEST_FILE = 'test-infra/npm-shrinkwrap.canonical.json'; 15 16 17 function updateShrinkwrap(grunt) { 18 // Assumption: Non-canonical shrinkwrap already generated by prerequisite Grunt task 19 var shrinkwrapData = grunt.file.readJSON(NON_CANONICAL_FILE); 20 grunt.log.writeln('Deleting ' + NON_CANONICAL_FILE.cyan + '...'); 21 grunt.file.delete(NON_CANONICAL_FILE); 22 // Output as Canonical JSON in correct location 23 grunt.file.write(DEST_FILE, canonicallyJsonStringify(shrinkwrapData)); 24 grunt.log.writeln('File ' + DEST_FILE.cyan + ' updated.'); 25 } 26 27 28 module.exports = updateShrinkwrap;