summaryrefslogtreecommitdiff
path: root/deps/npm/lib/install/action/refresh-package-json.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib/install/action/refresh-package-json.js')
-rw-r--r--deps/npm/lib/install/action/refresh-package-json.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/deps/npm/lib/install/action/refresh-package-json.js b/deps/npm/lib/install/action/refresh-package-json.js
index 6910803451..42f8012100 100644
--- a/deps/npm/lib/install/action/refresh-package-json.js
+++ b/deps/npm/lib/install/action/refresh-package-json.js
@@ -1,16 +1,20 @@
'use strict'
-const path = require('path')
+
const Bluebird = require('bluebird')
+
+const checkPlatform = Bluebird.promisify(require('npm-install-checks').checkPlatform)
+const getRequested = require('../get-requested.js')
+const npm = require('../../npm.js')
+const path = require('path')
const readJson = Bluebird.promisify(require('read-package-json'))
const updatePackageJson = Bluebird.promisify(require('../update-package-json'))
-const getRequested = require('../get-requested.js')
module.exports = function (staging, pkg, log) {
log.silly('refresh-package-json', pkg.realpath)
return readJson(path.join(pkg.path, 'package.json'), false).then((metadata) => {
Object.keys(pkg.package).forEach(function (key) {
- if (!isEmpty(pkg.package[key])) {
+ if (key !== 'dependencies' && !isEmpty(pkg.package[key])) {
metadata[key] = pkg.package[key]
}
})
@@ -22,7 +26,10 @@ module.exports = function (staging, pkg, log) {
delete metadata.readmeFilename
pkg.package = metadata
+ pkg.fakeChild = false
}).catch(() => 'ignore').then(() => {
+ return checkPlatform(pkg.package, npm.config.get('force'))
+ }).then(() => {
const requested = pkg.package._requested || getRequested(pkg)
if (requested.type !== 'directory') {
return updatePackageJson(pkg, pkg.path)