summaryrefslogtreecommitdiff
path: root/deps/npm/lib/install/save.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib/install/save.js')
-rw-r--r--deps/npm/lib/install/save.js7
1 files changed, 2 insertions, 5 deletions
diff --git a/deps/npm/lib/install/save.js b/deps/npm/lib/install/save.js
index 3f62643b80..f0c61f555d 100644
--- a/deps/npm/lib/install/save.js
+++ b/deps/npm/lib/install/save.js
@@ -3,7 +3,6 @@
const createShrinkwrap = require('../shrinkwrap.js').createShrinkwrap
const deepSortObject = require('../utils/deep-sort-object.js')
const detectIndent = require('detect-indent')
-const detectNewline = require('detect-newline')
const fs = require('graceful-fs')
const iferr = require('iferr')
const log = require('npmlog')
@@ -11,7 +10,6 @@ const moduleName = require('../utils/module-name.js')
const npm = require('../npm.js')
const parseJSON = require('../utils/parse-json.js')
const path = require('path')
-const stringifyPackage = require('../utils/stringify-package')
const validate = require('aproba')
const without = require('lodash.without')
const writeFileAtomic = require('write-file-atomic')
@@ -62,8 +60,7 @@ function savePackageJson (tree, next) {
// don't use readJson, because we don't want to do all the other
// tricky npm-specific stuff that's in there.
fs.readFile(saveTarget, 'utf8', iferr(next, function (packagejson) {
- const indent = detectIndent(packagejson).indent
- const newline = detectNewline(packagejson)
+ const indent = detectIndent(packagejson).indent || ' '
try {
tree.package = parseJSON(packagejson)
} catch (ex) {
@@ -125,7 +122,7 @@ function savePackageJson (tree, next) {
tree.package.bundleDependencies = deepSortObject(bundle)
}
- var json = stringifyPackage(tree.package, indent, newline)
+ var json = JSON.stringify(tree.package, null, indent) + '\n'
if (json === packagejson) {
log.verbose('shrinkwrap', 'skipping write for package.json because there were no changes.')
next()