diff --git a/packages/kbn-relocate/utils/relocate.ts b/packages/kbn-relocate/utils/relocate.ts index 233c03b84ea05..1e833b8d2539a 100644 --- a/packages/kbn-relocate/utils/relocate.ts +++ b/packages/kbn-relocate/utils/relocate.ts @@ -39,7 +39,12 @@ export const calculateModuleTargetFolder = (module: Package): string => { const group = module.manifest.group!; const isPlugin = module.manifest.type === 'plugin'; const fullPath = join(BASE_FOLDER, module.directory); - let moduleDelimiter = isPlugin ? '/plugins/' : '/packages/'; + if (!fullPath.includes('/plugins/') && !fullPath.includes('/packages/')) { + throw new Error( + `The module ${module.id} is not located under a '*/plugins/*' or '*/packages/*' folder` + ); + } + let moduleDelimiter = fullPath.includes('/plugins/') ? '/plugins/' : '/packages/'; // for platform modules that are in a sustainable folder, strip the /private/ or /shared/ part too if (module.directory.includes(`${moduleDelimiter}private/`)) { diff --git a/packages/kbn-relocate/utils/transforms.ts b/packages/kbn-relocate/utils/transforms.ts index 267d570169d67..e3bd95b3a6c2d 100644 --- a/packages/kbn-relocate/utils/transforms.ts +++ b/packages/kbn-relocate/utils/transforms.ts @@ -11,6 +11,8 @@ import type { Package } from '../types'; type TransformFunction = (param: string) => string; const TRANSFORMS: Record = { + 'src/platform/packages/shared/chart_expressions/common': + 'src/platform/packages/shared/chart-expressions-common', 'x-pack/solutions/security/packages/security-solution/': 'x-pack/solutions/security/packages/', 'x-pack/solutions/observability/plugins/observability_solution/': 'x-pack/solutions/observability/plugins/',