Skip to content

Commit

Permalink
Fix npm 9 compatibility (#666)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerTimonius authored Dec 27, 2022
1 parent 95622c0 commit 0f5dd33
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/npm/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const pkgDir = require('pkg-dir');
const ignoreWalker = require('ignore-walk');
const minimatch = require('minimatch');
const {verifyRequirementSatisfied} = require('../version');
const semver = require('semver');

// According to https://docs.npmjs.com/files/package.json#files
// npm's default behavior is to ignore these files.
Expand Down Expand Up @@ -68,7 +69,8 @@ exports.collaborators = async pkg => {
const packageName = pkg.name;
ow(packageName, ow.string);

const args = ['access', 'ls-collaborators', packageName];
const npmVersion = await exports.version();
const args = semver.satisfies(npmVersion, '>=9.0.0') ? ['access', 'list', 'collaborators', packageName, '--json'] : ['access', 'ls-collaborators', packageName];
if (exports.isExternalRegistry(pkg)) {
args.push('--registry', pkg.publishConfig.registry);
}
Expand Down

0 comments on commit 0f5dd33

Please sign in to comment.