Skip to content

Commit 3c22d1a

Browse files
zkataeschright
authored andcommitted
access: ls-collaborators is ok with non-scoped (#151)
PR-URL: #151 Fixes: https://npm.community/t/npm-6-6-0-breaks-access-to-ls-collaborators/5101 Credit: @zkat Reviewed-By: @aeschright
1 parent 309260d commit 3c22d1a

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

lib/access.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ access['ls-packages'] = access.lsPackages = ([owner], opts) => {
154154
}
155155

156156
access['ls-collaborators'] = access.lsCollaborators = ([pkg, usr], opts) => {
157-
return getPackage(pkg).then(pkgName =>
157+
return getPackage(pkg, false).then(pkgName =>
158158
libaccess.lsCollaborators(pkgName, usr, opts)
159159
).then(collabs => {
160160
// TODO - print these out nicely (breaking change)

test/tap/access.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,34 @@ test('npm access ls-collaborators on package', function (t) {
469469
)
470470
})
471471

472+
test('npm access ls-collaborators on unscoped', function (t) {
473+
var serverCollaborators = {
474+
'myorg:myteam': 'write',
475+
'myorg:anotherteam': 'read'
476+
}
477+
var clientCollaborators = {
478+
'myorg:myteam': 'read-write',
479+
'myorg:anotherteam': 'read-only'
480+
}
481+
server.get(
482+
'/-/package/pkg/collaborators?format=cli'
483+
).reply(200, serverCollaborators)
484+
common.npm(
485+
[
486+
'access',
487+
'ls-collaborators',
488+
'pkg',
489+
'--registry', common.registry
490+
],
491+
{ cwd: pkg },
492+
function (er, code, stdout, stderr) {
493+
t.ifError(er, 'npm access ls-collaborators')
494+
t.same(JSON.parse(stdout), clientCollaborators)
495+
t.end()
496+
}
497+
)
498+
})
499+
472500
test('npm access ls-collaborators on current w/user filter', function (t) {
473501
var serverCollaborators = {
474502
'myorg:myteam': 'write',

0 commit comments

Comments
 (0)