Skip to content

Commit

Permalink
fixed bug: timeout wasn't passed to pacote
Browse files Browse the repository at this point in the history
also requests to check updates for dependencies are now made in batches instead
of making all of them at once resulting in default timeout being exeeded
when number of dependencies is big
	modified:   lib/package-managers/npm.js
	modified:   lib/versionmanager.js
	modified:   package-lock.json
	modified:   package.json
  • Loading branch information
abnud1 committed Mar 24, 2020
1 parent 481ba38 commit 21931c3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/package-managers/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function viewMany(packageName, fields, currentVersion, {timeout} = {}) {

npmConfig.fullMetadata = _.includes(fields, 'time');

return pacote.packument(packageName, Object.assign({}, npmConfig, timeout)).then(result =>
return pacote.packument(packageName, Object.assign({}, npmConfig, {timeout})).then(result =>
fields.reduce((accum, field) => Object.assign(
accum,
{
Expand Down
5 changes: 3 additions & 2 deletions lib/versionmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const ProgressBar = require('progress');
const versionUtil = require('./version-util.js');
const packageManagers = require('./package-managers');
const prompts = require('prompts');

const pMap = require('p-map');
const os = require('os');
// keep order for setPrecision
const DEFAULT_WILDCARD = '^';

Expand Down Expand Up @@ -456,7 +457,7 @@ function queryVersions(packageMap, options = {}) {
});
}

return Promise.all(packageList.map(getPackageVersionProtected))
return pMap(packageList,getPackageVersionProtected,{concurrency: os.cpus().length})
.then(zipVersions)
.then(_.partialRight(_.pickBy, _.identity));
}
Expand Down
16 changes: 13 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"libnpmconfig": "^1.2.1",
"lodash": "^4.17.15",
"node-alias": "^1.0.4",
"p-map": "^4.0.0",
"pacote": "^11.1.0",
"progress": "^2.0.3",
"prompts": "^2.3.1",
Expand Down

0 comments on commit 21931c3

Please sign in to comment.