diff --git a/packages/cli/src/lib/new/utils.ts b/packages/cli/src/lib/new/utils.ts index 4fea5774b4..51448a5a80 100644 --- a/packages/cli/src/lib/new/utils.ts +++ b/packages/cli/src/lib/new/utils.ts @@ -33,14 +33,17 @@ export const resolvePackageName = (options: { }) => { const { baseName, scope, plugin } = options; if (scope) { - const scopeSanitized = scope.replace(/[@/]/g, ''); if (plugin) { - const pluginPrefix = scopeSanitized.startsWith('backstage') + const pluginName = scope.startsWith('backstage') ? 'plugin' : 'backstage-plugin'; - return `@${scopeSanitized}/${pluginPrefix}-${baseName}`; + return scope.includes('/') + ? `@${scope}${pluginName}-${baseName}` + : `@${scope}/${pluginName}-${baseName}`; } - return `@${scopeSanitized}/${baseName}`; + return scope.includes('/') + ? `@${scope}${baseName}` + : `@${scope}/${baseName}`; } return plugin ? `backstage-plugin-${baseName}` : baseName;