This repository was archived by the owner on Aug 11, 2022. It is now read-only.
File tree Expand file treeCollapse file tree 2 files changed+20
-8
lines changedFilter options
+20
-8
lines changed Original file line number Diff line number Diff line change
@@ -123,7 +123,12 @@ function savePackageJson (tree, next) {
123
123
}
124
124
125
125
var json = JSON.stringify(tree.package, null, indent) + '\n'
126
-
writeFileAtomic(saveTarget, json, next)
126
+
if (json === packagejson) {
127
+
log.verbose('shrinkwrap', 'skipping write for package.json because there were no changes.')
128
+
next()
129
+
} else {
130
+
writeFileAtomic(saveTarget, json, next)
131
+
}
127
132
}))
128
133
}
129
134
Original file line number Diff line number Diff line change
@@ -163,14 +163,20 @@ function save (dir, pkginfo, opts, cb) {
163
163
)
164
164
const updated = updateLockfileMetadata(pkginfo, pkg && pkg.data)
165
165
const swdata = JSON.stringify(updated, null, info.indent) + '\n'
166
-
writeFileAtomic(info.path, swdata, (err) => {
167
-
if (err) return cb(err)
168
-
if (opts.silent) return cb(null, pkginfo)
169
-
if (!shrinkwrap && !lockfile) {
170
-
log.notice('', `created a lockfile as ${path.basename(info.path)}. You should commit this file.`)
171
-
}
166
+
if (swdata === info.raw) {
167
+
// skip writing if file is identical
168
+
log.verbose('shrinkwrap', `skipping write for ${path.basename(info.path)} because there were no changes.`)
172
169
cb(null, pkginfo)
173
-
})
170
+
} else {
171
+
writeFileAtomic(info.path, swdata, (err) => {
172
+
if (err) return cb(err)
173
+
if (opts.silent) return cb(null, pkginfo)
174
+
if (!shrinkwrap && !lockfile) {
175
+
log.notice('', `created a lockfile as ${path.basename(info.path)}. You should commit this file.`)
176
+
}
177
+
cb(null, pkginfo)
178
+
})
179
+
}
174
180
}
175
181
).then((file) => {
176
182
}, cb)
@@ -216,6 +222,7 @@ function checkPackageFile (dir, name) {
216
222
).then((data) => {
217
223
return {
218
224
path: file,
225
+
raw: data,
219
226
data: JSON.parse(data),
220
227
indent: detectIndent(data).indent || 2
221
228
}
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4