Skip to content

Commit

Permalink
SKA: Relocate script V6.2 (#205244)
Browse files Browse the repository at this point in the history
## Summary

* Support packages that are currently placed under a `*/plugins/*`
folder (and viceversa).
* Transform (simplify) the following path:

```
src/platform/packages/shared/chart_expressions/common
# becomes
src/platform/packages/shared/chart-expressions-common
```

cc @markov00
  • Loading branch information
gsoldevila authored Dec 30, 2024
1 parent 12608c3 commit ac5e20d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/kbn-relocate/utils/relocate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/`)) {
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-relocate/utils/transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import type { Package } from '../types';

type TransformFunction = (param: string) => string;
const TRANSFORMS: Record<string, string | TransformFunction> = {
'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/',
Expand Down

0 comments on commit ac5e20d

Please sign in to comment.