mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05:00
Merge pull request #12972 from twbs/cleaner-shrinkwrap
Exclude `resolved` from npm shrinkwrap to avoid irrelevant changes
This commit is contained in:
commit
41b2868906
2 changed files with 15 additions and 2 deletions
|
@ -14,13 +14,26 @@ var NON_CANONICAL_FILE = 'npm-shrinkwrap.json';
|
||||||
var DEST_FILE = 'test-infra/npm-shrinkwrap.canonical.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) {
|
function updateShrinkwrap(grunt) {
|
||||||
// Assumption: Non-canonical shrinkwrap already generated by prerequisite Grunt task
|
// Assumption: Non-canonical shrinkwrap already generated by prerequisite Grunt task
|
||||||
var shrinkwrapData = grunt.file.readJSON(NON_CANONICAL_FILE);
|
var shrinkwrapData = grunt.file.readJSON(NON_CANONICAL_FILE);
|
||||||
grunt.log.writeln('Deleting ' + NON_CANONICAL_FILE.cyan + '...');
|
grunt.log.writeln('Deleting ' + NON_CANONICAL_FILE.cyan + '...');
|
||||||
grunt.file.delete(NON_CANONICAL_FILE);
|
grunt.file.delete(NON_CANONICAL_FILE);
|
||||||
// Output as Canonical JSON in correct location
|
// 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.');
|
grunt.log.writeln('File ' + DEST_FILE.cyan + ' updated.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue