Commit 51b825d6 authored by Chris Rebert's avatar Chris Rebert
Browse files

fix #12959

parent 30bbab06
4 merge requests!28721Hot test,!12972Exclude `resolved` from npm shrinkwrap to avoid irrelevant changes,!22103test,!25326Adjust examples
Showing with 14 additions and 1 deletion
+14 -1
......@@ -14,13 +14,26 @@ var NON_CANONICAL_FILE = 'npm-shrinkwrap.json';
var DEST_FILE = 'test-infra/npm-shrinkwrap.canonical.json';
function cleanup(shrinkwrap) {
// Remove `resolved` property to avoid irrelevant changes
// See https://github.com/npm/npm/issues/3581
if ((typeof shrinkwrap) === 'string') {
return shrinkwrap;
}
delete shrinkwrap.resolved;
for (var key in shrinkwrap) {
shrinkwrap[key] = cleanup(shrinkwrap[key]);
}
return shrinkwrap;
}
function updateShrinkwrap(grunt) {
// Assumption: Non-canonical shrinkwrap already generated by prerequisite Grunt task
var shrinkwrapData = grunt.file.readJSON(NON_CANONICAL_FILE);
grunt.log.writeln('Deleting ' + NON_CANONICAL_FILE.cyan + '...');
grunt.file.delete(NON_CANONICAL_FILE);
// Output as Canonical JSON in correct location
grunt.file.write(DEST_FILE, canonicallyJsonStringify(shrinkwrapData));
grunt.file.write(DEST_FILE, canonicallyJsonStringify(cleanup(shrinkwrapData)));
grunt.log.writeln('File ' + DEST_FILE.cyan + ' updated.');
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment