Add centralized mapping for known plugin packages in knownPluginPackages.ts

Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2026-03-10 23:15:03 +01:00
committed by Patrik Oldsberg
parent f22a0822ab
commit 7f8daf93fb
3 changed files with 48 additions and 30 deletions
@@ -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<string | undefined> = [
'frontend-plugin',
'backend-plugin',
@@ -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<string, string> = {
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;
@@ -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<string, string> =
Object.fromEntries(
knownPluginIds.map(pluginId => [
pluginId,
`@backstage/plugin-${pluginId}-backend`,
]),
);
export const knownFrontendPluginPackageNameByPluginId: Record<string, string> =
Object.fromEntries(
knownPluginIds.map(pluginId => [pluginId, `@backstage/plugin-${pluginId}`]),
);