We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5dd0538 + 3a1754b commit c59e8f2Copy full SHA for c59e8f2
src/Config.js
@@ -1,8 +1,9 @@
1
import {resolve} from 'path';
2
import {writeFileSync} from 'fs';
3
import del from 'del';
4
-
5
import _ from 'lodash';
+import detectIndent from 'detect-indent';
6
+import {loadPackageJson} from './packageUtils';
7
8
const PROJECT_CONFIG_FILENAME = '.npm-upgrade.json';
9
@@ -32,9 +33,12 @@ export default class Config {
32
33
if (_.isEmpty(data)) {
34
this.remove();
35
} else {
36
+ const {source: packageSource} = loadPackageJson();
37
+ const {indent} = detectIndent(packageSource);
38
+
39
writeFileSync(
40
this[path],
- JSON.stringify(data, null, 2)
41
+ JSON.stringify(data, null, indent)
42
);
43
}
44
} catch (err) {
0 commit comments