diff options
author | Kat Marchán <kzm@sykosomatic.org> | 2017-07-01 06:03:56 +0300 |
---|---|---|
committer | Kat Marchán <kzm@sykosomatic.org> | 2017-07-06 01:11:01 +0300 |
commit | 394436b098dcca2d252061f95c4eeb92c4a7027c (patch) | |
tree | aae962513ba41be86356fa5a1489662f0daf0761 /lib | |
parent | d21ab57c3ef4f01d41fb6c2103debe884a17dc22 (diff) |
actions: make refresh-package-json re-verify the package platform (#17552)
Fixes: https://github.com/npm/npm/issues/16810
PR-URL: https://github.com/npm/npm/pull/17552
Credit: @zkat
Reviewed-By: @iarna
Diffstat (limited to 'lib')
-rw-r--r-- | lib/install/action/refresh-package-json.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/install/action/refresh-package-json.js b/lib/install/action/refresh-package-json.js index 3b4e18640..42f801210 100644 --- a/lib/install/action/refresh-package-json.js +++ b/lib/install/action/refresh-package-json.js @@ -1,9 +1,13 @@ '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) @@ -24,6 +28,8 @@ module.exports = function (staging, pkg, log) { 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) @@ -37,4 +43,3 @@ function isEmpty (value) { if (typeof value === 'object') return !Object.keys(value).length return false } - |