From 5d89e9a0d06c8abfd54653f635695abe3d6cd3ee Mon Sep 17 00:00:00 2001 From: Jurij Cherepanov Date: Fri, 20 Apr 2018 17:09:18 +0300 Subject: [PATCH] #127 - Custom npm scoped packages add npm pacote config for npm package at least 5.0.0 --- package.json | 1 - src/npm-utils.js | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 843e7c4..4a09e43 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "fs-write-stream-atomic": "1.0.10", "lodash": "4.17.5", "mkdirp": "0.5.1", - "npm": "^5.0.0", "pacote": "8.0.0", "q": "1.5.1", "requireg": "0.1.7", diff --git a/src/npm-utils.js b/src/npm-utils.js index b24eeff..df1b982 100644 --- a/src/npm-utils.js +++ b/src/npm-utils.js @@ -137,8 +137,14 @@ function oldNpmCache(pkg, deferred) { * @return {Promise} The manifest object. */ function getManifest(pkg) { - const pakoteOpts = require('npm/lib/config/pacote'); - return require('pacote').manifest(pkg, pakoteOpts({})).then(function(pkgJson) { + let opts = {}; + + try { + const pakoteOpts = requireg('npm/lib/config/pacote'); + opts = pakoteOpts(); + } catch (ex) {}; + + return require('pacote').manifest(pkg, opts).then(function(pkgJson) { return { integrity: pkgJson._integrity, manifest: {