File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 * Constructs a scope:team string in the format expected by npm.
33 * npm operations require the format @scope:team (with @ prefix).
44 *
5- * @param orgName - The organization name (without @)
5+ * @param orgName - The organization name (with or without @)
66 * @param teamName - The team name
77 * @returns The scope:team string in @scope:team format
88 */
99export function buildScopeTeam ( orgName : string , teamName : string ) : string {
10- return `@${ orgName } :${ teamName } `
10+ return `@${ orgName . replace ( / ^ @ / , '' ) } :${ teamName } `
1111}
Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ describe('buildScopeTeam', () => {
99 expect ( buildScopeTeam ( 'nuxt' , 'core' ) ) . toBe ( '@nuxt:core' )
1010 } )
1111
12+ it ( 'strips existing @ prefix from orgName' , ( ) => {
13+ expect ( buildScopeTeam ( '@netlify' , 'developers' ) ) . toBe ( '@netlify:developers' )
14+ expect ( buildScopeTeam ( '@nuxt' , 'core' ) ) . toBe ( '@nuxt:core' )
15+ } )
16+
1217 it ( 'produces format accepted by validateScopeTeam' , ( ) => {
1318 expect ( ( ) => validateScopeTeam ( buildScopeTeam ( 'netlify' , 'developers' ) ) ) . not . toThrow ( )
1419 expect ( ( ) => validateScopeTeam ( buildScopeTeam ( 'nuxt' , 'core' ) ) ) . not . toThrow ( )
You can’t perform that action at this time.
0 commit comments