npm-upgrade
Advanced tools
Comparing version
@@ -13,2 +13,6 @@ # Changelog | ||
## 2.0.1 | ||
* **Improvement** | ||
* Use indentation from `package.json` for `.npm-upgrade.json` ([#36](https://github.com/th0r/npm-upgrade/pull/36), [@cascornelissen](https://github.com/cascornelissen)) | ||
## 2.0.0 | ||
@@ -15,0 +19,0 @@ * **Breaking Change** |
@@ -28,2 +28,6 @@ "use strict"; | ||
var _detectIndent = _interopRequireDefault(require("detect-indent")); | ||
var _packageUtils = require("./packageUtils"); | ||
const PROJECT_CONFIG_FILENAME = '.npm-upgrade.json'; | ||
@@ -53,3 +57,9 @@ const path = Symbol('path'); | ||
} else { | ||
(0, _fs.writeFileSync)(this[path], JSON.stringify(data, null, 2)); | ||
const { | ||
source: packageSource | ||
} = (0, _packageUtils.loadPackageJson)(); | ||
const { | ||
indent | ||
} = (0, _detectIndent.default)(packageSource); | ||
(0, _fs.writeFileSync)(this[path], JSON.stringify(data, null, indent)); | ||
} | ||
@@ -56,0 +66,0 @@ } catch (err) { |
{ | ||
"name": "npm-upgrade", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Interactive CLI utility to easily update outdated NPM dependencies", | ||
@@ -5,0 +5,0 @@ "author": "Yuriy Grunin <grunin.ya@ya.ru>", |
@@ -14,3 +14,3 @@ # npm-upgrade | ||
## Installation | ||
First, install [Node.js](https://nodejs.org) (at least `v4`). | ||
First, install [Node.js](https://nodejs.org) (at least `v8.10`). | ||
@@ -17,0 +17,0 @@ Then install this utility as global npm-module: |
import {resolve} from 'path'; | ||
import {writeFileSync} from 'fs'; | ||
import del from 'del'; | ||
import _ from 'lodash'; | ||
import detectIndent from 'detect-indent'; | ||
import {loadPackageJson} from './packageUtils'; | ||
@@ -35,5 +36,8 @@ const PROJECT_CONFIG_FILENAME = '.npm-upgrade.json'; | ||
} else { | ||
const {source: packageSource} = loadPackageJson(); | ||
const {indent} = detectIndent(packageSource); | ||
writeFileSync( | ||
this[path], | ||
JSON.stringify(data, null, 2) | ||
JSON.stringify(data, null, indent) | ||
); | ||
@@ -40,0 +44,0 @@ } |
71946
1.02%1592
0.76%