From 363723fc84f7b8477592e0105aeb331ec9a017af Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Aug 2017 05:01:11 +0200 Subject: node_modules --- node_modules/write-pkg/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'node_modules/write-pkg/index.js') diff --git a/node_modules/write-pkg/index.js b/node_modules/write-pkg/index.js index 262fa925a..981cc0b54 100644 --- a/node_modules/write-pkg/index.js +++ b/node_modules/write-pkg/index.js @@ -3,7 +3,7 @@ const path = require('path'); const writeJsonFile = require('write-json-file'); const sortKeys = require('sort-keys'); -const opts = {indent: 2}; +const opts = {detectIndent: true}; const dependencyKeys = new Set([ 'dependencies', @@ -16,7 +16,11 @@ function normalize(pkg) { const ret = {}; for (const key of Object.keys(pkg)) { - ret[key] = dependencyKeys.has(key) ? sortKeys(pkg[key]) : pkg[key]; + if (!dependencyKeys.has(key)) { + ret[key] = pkg[key]; + } else if (Object.keys(pkg[key]).length !== 0) { + ret[key] = sortKeys(pkg[key]); + } } return ret; -- cgit v1.2.3