diff --git a/packages/cli-module-maintenance/src/commands/repo/fix.ts b/packages/cli-module-maintenance/src/commands/repo/fix.ts index 399234ff2e..34b7c93288 100644 --- a/packages/cli-module-maintenance/src/commands/repo/fix.ts +++ b/packages/cli-module-maintenance/src/commands/repo/fix.ts @@ -30,6 +30,7 @@ import { extname, } from 'node:path'; import { targetPaths } from '@backstage/cli-common'; +import { knownBackendPluginPackageNameByPluginId } from '../../../../lib/knownPluginPackages'; const SCRIPT_EXTS = ['.js', '.jsx', '.ts', '.tsx', '.json']; @@ -347,23 +348,6 @@ export function fixPluginId(pkg: FixablePackage) { } } -export const knownBackendPluginPackageNameByPluginId = Object.fromEntries( - [ - 'app', - 'auth', - 'catalog', - 'events', - 'kubernetes', - 'notifications', - 'permission', - 'proxy', - 'scaffolder', - 'search', - 'signals', - 'techdocs', - ].map(pluginId => [pluginId, `@backstage/plugin-${pluginId}-backend`]), -); - const pluginPackageRoles: Array = [ 'frontend-plugin', 'backend-plugin', diff --git a/packages/cli-module-new/src/lib/preparation/collectPortableTemplateInput.ts b/packages/cli-module-new/src/lib/preparation/collectPortableTemplateInput.ts index 169a064869..a65c5f04d2 100644 --- a/packages/cli-module-new/src/lib/preparation/collectPortableTemplateInput.ts +++ b/packages/cli-module-new/src/lib/preparation/collectPortableTemplateInput.ts @@ -27,19 +27,10 @@ import { } from '../types'; import { PortableTemplate } from '../types'; import { resolvePackageParams } from './resolvePackageParams'; -import { knownBackendPluginPackageNameByPluginId } from '../../../maintenance/commands/repo/fix'; - -const knownFrontendPluginPackageNameByPluginId: Record = { - app: '@backstage/plugin-app', - auth: '@backstage/plugin-auth', - catalog: '@backstage/plugin-catalog', - kubernetes: '@backstage/plugin-kubernetes', - notifications: '@backstage/plugin-notifications', - scaffolder: '@backstage/plugin-scaffolder', - search: '@backstage/plugin-search', - signals: '@backstage/plugin-signals', - techdocs: '@backstage/plugin-techdocs', -}; +import { + knownBackendPluginPackageNameByPluginId, + knownFrontendPluginPackageNameByPluginId, +} from '../../../../lib/knownPluginPackages'; type CollectTemplateParamsOptions = { config: PortableTemplateConfig; diff --git a/packages/cli/src/lib/knownPluginPackages.ts b/packages/cli/src/lib/knownPluginPackages.ts new file mode 100644 index 0000000000..88bfdf25e0 --- /dev/null +++ b/packages/cli/src/lib/knownPluginPackages.ts @@ -0,0 +1,43 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const knownPluginIds = [ + 'app', + 'auth', + 'catalog', + 'events', + 'kubernetes', + 'notifications', + 'permission', + 'proxy', + 'scaffolder', + 'search', + 'signals', + 'techdocs', +]; + +export const knownBackendPluginPackageNameByPluginId: Record = + Object.fromEntries( + knownPluginIds.map(pluginId => [ + pluginId, + `@backstage/plugin-${pluginId}-backend`, + ]), + ); + +export const knownFrontendPluginPackageNameByPluginId: Record = + Object.fromEntries( + knownPluginIds.map(pluginId => [pluginId, `@backstage/plugin-${pluginId}`]), + );