Skip to content

Commit 6ee5622

Browse files
committed
factor our prettify fn
1 parent 0e2317a commit 6ee5622

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cmd.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ function installShims ({ modules, overwrite }, done) {
219219
installLine += ' '
220220
})
221221

222-
fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + '\n', function (err) {
222+
fs.writeFile(pkgPath, prettify(pkg), function (err) {
223223
if (err) throw err
224224

225225
if (installLine.trim() === BASE_INSTALL_LINE) {
@@ -339,7 +339,7 @@ function fixPackageJSON (modules, file, overwrite) {
339339
if (!deepEqual(orgBrowser, depBrowser)) {
340340
pkgJson.browser = pkgJson['react-native'] = depBrowser
341341
delete pkgJson.browserify
342-
fs.writeFileSync(file, JSON.stringify(pkgJson, null, 2) + '\n')
342+
fs.writeFileSync(file, prettify(pkgJson))
343343
}
344344
}
345345

@@ -367,3 +367,7 @@ function runHelp () {
367367
function log () {
368368
console.log.apply(console, arguments)
369369
}
370+
371+
function prettify (json) {
372+
return JSON.stringify(json, null, 2) + '\n'
373+
}

0 commit comments

Comments
 (0)