Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

Commit d2d290b

Browse filesBrowse files
Benjamin Coeiarna
Benjamin Coe
authored andcommitted
feat: allow optional @ prefix on scope
Credit: @bcoe Reviewed-By: @zkat PR-URL: #20082
1 parent 857c213 commit d2d290b
Copy full SHA for d2d290b

File tree

Expand file treeCollapse file tree

2 files changed

+25
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+25
-1
lines changed

‎lib/team.js

Copy file name to clipboardExpand all lines: lib/team.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function team (args, cb) {
4242
try {
4343
return npm.registry.team(cmd, uri, {
4444
auth: auth,
45-
scope: entity[0],
45+
scope: entity[0].replace(/^@/, ''), // '@' prefix on scope is optional.
4646
team: entity[1],
4747
user: args.shift()
4848
}, function (err, data) {

‎test/tap/team.js

Copy file name to clipboardExpand all lines: test/tap/team.js
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,30 @@ test('team create basic', function (t) {
3737
})
3838
})
3939

40+
test('team create (allow optional @ prefix on scope)', function (t) {
41+
var teamData = {
42+
name: 'test',
43+
scope_id: 1234,
44+
created: '2015-07-23T18:07:49.959Z',
45+
updated: '2015-07-23T18:07:49.959Z',
46+
deleted: null
47+
}
48+
server.put('/-/org/myorg/team', JSON.stringify({
49+
name: teamData.name
50+
})).reply(200, teamData)
51+
common.npm([
52+
'team', 'create', '@myorg:' + teamData.name,
53+
'--registry', common.registry,
54+
'--loglevel', 'silent'
55+
], {}, function (err, code, stdout, stderr) {
56+
t.ifError(err, 'npm team')
57+
t.equal(code, 0, 'exited OK')
58+
t.equal(stderr, '', 'no error output')
59+
t.same(JSON.parse(stdout), teamData)
60+
t.end()
61+
})
62+
})
63+
4064
test('team destroy', function (t) {
4165
var teamData = {
4266
name: 'myteam',

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.