add plugin id format warning on frontend framework
Signed-off-by: Juan Pablo Garcia Ripa <sarabadu@gmail.com>
This commit is contained in:
@@ -14,6 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// NOTE: changing any of these constants need to be reflected in
|
||||
// @backstage/frontend-plugin-api/src/wiring/constants.ts as well
|
||||
|
||||
/**
|
||||
* The pattern that IDs must match.
|
||||
*
|
||||
|
||||
@@ -55,18 +55,18 @@ export interface CreateBackendModuleOptions {
|
||||
export function createBackendModule(
|
||||
options: CreateBackendModuleOptions,
|
||||
): BackendFeature {
|
||||
function getRegistrations() {
|
||||
if (!ID_PATTERN.test(options.moduleId)) {
|
||||
console.warn(
|
||||
`WARNING: The moduleId '${options.moduleId}' for plugin '${options.pluginId}', will be invalid soon please must match the pattern ${ID_PATTERN} (letters, digits, and dashes only, starting with a letter)`,
|
||||
);
|
||||
}
|
||||
if (!ID_PATTERN_OLD.test(options.moduleId)) {
|
||||
throw new Error(
|
||||
`Invalid moduleId '${options.moduleId}' for plugin '${options.pluginId}', must match the pattern ${ID_PATTERN} (letters, digits, and dashes only, starting with a letter)`,
|
||||
);
|
||||
}
|
||||
if (!ID_PATTERN.test(options.moduleId)) {
|
||||
console.warn(
|
||||
`WARNING: The moduleId '${options.moduleId}' for plugin '${options.pluginId}', will be invalid soon, please change it to match the pattern ${ID_PATTERN} (letters, digits, and dashes only, starting with a letter)`,
|
||||
);
|
||||
}
|
||||
if (!ID_PATTERN_OLD.test(options.moduleId)) {
|
||||
throw new Error(
|
||||
`Invalid moduleId '${options.moduleId}' for plugin '${options.pluginId}', must match the pattern ${ID_PATTERN} (letters, digits, and dashes only, starting with a letter)`,
|
||||
);
|
||||
}
|
||||
|
||||
function getRegistrations() {
|
||||
const extensionPoints: InternalBackendPluginRegistration['extensionPoints'] =
|
||||
[];
|
||||
let init: InternalBackendModuleRegistration['init'] | undefined = undefined;
|
||||
|
||||
@@ -49,18 +49,18 @@ export interface CreateBackendPluginOptions {
|
||||
export function createBackendPlugin(
|
||||
options: CreateBackendPluginOptions,
|
||||
): BackendFeature {
|
||||
function getRegistrations() {
|
||||
if (!ID_PATTERN.test(options.pluginId)) {
|
||||
console.warn(
|
||||
`WARNING: The pluginId '${options.pluginId}' will be invalid soon, please change it to match the pattern ${ID_PATTERN} (letters, digits, and dashes only, starting with a letter)`,
|
||||
);
|
||||
}
|
||||
if (!ID_PATTERN_OLD.test(options.pluginId)) {
|
||||
throw new Error(
|
||||
`Invalid pluginId '${options.pluginId}', must match the pattern ${ID_PATTERN} (letters, digits, and dashes only, starting with a letter)`,
|
||||
);
|
||||
}
|
||||
if (!ID_PATTERN.test(options.pluginId)) {
|
||||
console.warn(
|
||||
`WARNING: The pluginId '${options.pluginId}' will be invalid soon, please change it to match the pattern ${ID_PATTERN} (letters, digits, and dashes only, starting with a letter)`,
|
||||
);
|
||||
}
|
||||
if (!ID_PATTERN_OLD.test(options.pluginId)) {
|
||||
throw new Error(
|
||||
`Invalid pluginId '${options.pluginId}', must match the pattern ${ID_PATTERN} (letters, digits, and dashes only, starting with a letter)`,
|
||||
);
|
||||
}
|
||||
|
||||
function getRegistrations() {
|
||||
const extensionPoints: InternalBackendPluginRegistration['extensionPoints'] =
|
||||
[];
|
||||
let init: InternalBackendPluginRegistration['init'] | undefined = undefined;
|
||||
|
||||
Reference in New Issue
Block a user