Skip to content

Commit 87d08e8

Browse files
committed
fix(create): normalize scope inputs
1 parent c37a543 commit 87d08e8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/create-element/generator/element.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const getComponentAbsPath =
111111
* If no scope is provided, returns the empty string.
112112
*/
113113
const normalizeScope = (scope: string): string =>
114-
scope ? `@${scope.replace(/^(@+)(.*)\/$/, '$2')}/` : '';
114+
scope ? `@${scope.replace(/^(@+)([-.\w]+)\/?$/, '$2')}/` : '';
115115

116116
/** Get template interpolation data from options */
117117
const getInterpolations =
@@ -121,7 +121,7 @@ const getInterpolations =
121121
const className = Case.pascal(options.tagName);
122122
const readmeName = Case.title(options.tagName.replace(/^\w+-(.*)/, '$1'));
123123
const scope = !options.scope ? '' : normalizeScope(options.scope);
124-
const packageName = `${scope}${tagName}`.replace(/^@+/, '@');
124+
const packageName = `${scope}${tagName}`;
125125
return {
126126
className,
127127
cssName,

0 commit comments

Comments
 (0)