kibana/packages/kbn-relocate
Gerard Soldevila e0faf07b61
[9.0] SKA: Misc cleanup and enhancements (#212207) (#212349)
# Backport

This will backport the following commits from `main` to `9.0`:
- [SKA: Misc cleanup and enhancements
(#212207)](https://github.com/elastic/kibana/pull/212207)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2025-02-24T13:31:00Z","message":"SKA:
Misc cleanup and enhancements (#212207)\n\n## Summary\n\n* Remove some
old paths pointing to `packages/kbn-pm` (no longer\nexists).\n* ~Fix
group and visibility for `@kbn/streams-app-wrapper-plugin`~.\n(done in
https://github.com/elastic/kibana/pull/212210)\n* Update
`scripts/relocate` logic with latest enhancements.\n* Convert
`@kbn/observability-synthetics-test-data` folder name to\ncamel-case
(messes up with pre-commit
hook).","sha":"a41badf96496c81587fca3d56c1c891abeb1a3a9","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","v9.0.0","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"SKA:
Misc cleanup and
enhancements","number":212207,"url":"https://github.com/elastic/kibana/pull/212207","mergeCommit":{"message":"SKA:
Misc cleanup and enhancements (#212207)\n\n## Summary\n\n* Remove some
old paths pointing to `packages/kbn-pm` (no longer\nexists).\n* ~Fix
group and visibility for `@kbn/streams-app-wrapper-plugin`~.\n(done in
https://github.com/elastic/kibana/pull/212210)\n* Update
`scripts/relocate` logic with latest enhancements.\n* Convert
`@kbn/observability-synthetics-test-data` folder name to\ncamel-case
(messes up with pre-commit
hook).","sha":"a41badf96496c81587fca3d56c1c891abeb1a3a9"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/212207","number":212207,"mergeCommit":{"message":"SKA:
Misc cleanup and enhancements (#212207)\n\n## Summary\n\n* Remove some
old paths pointing to `packages/kbn-pm` (no longer\nexists).\n* ~Fix
group and visibility for `@kbn/streams-app-wrapper-plugin`~.\n(done in
https://github.com/elastic/kibana/pull/212210)\n* Update
`scripts/relocate` logic with latest enhancements.\n* Convert
`@kbn/observability-synthetics-test-data` folder name to\ncamel-case
(messes up with pre-commit
hook).","sha":"a41badf96496c81587fca3d56c1c891abeb1a3a9"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-25 12:35:31 +00:00
..
utils [9.0] SKA: Misc cleanup and enhancements (#212207) (#212349) 2025-02-25 12:35:31 +00:00
constants.ts SK: Relocate Script v7.2 (#207081) 2025-01-20 15:43:32 +01:00
healthcheck.ts [9.0] SKA: Misc cleanup and enhancements (#212207) (#212349) 2025-02-25 12:35:31 +00:00
index.ts SK: Relocate Script v7.2 (#207081) 2025-01-20 15:43:32 +01:00
jest.config.js Sustainable Kibana Architecture: Add scripts/relocate CLI (beta) (#203803) 2024-12-11 17:10:37 +01:00
kibana.jsonc Sustainable Kibana Architecture: Add scripts/relocate CLI (beta) (#203803) 2024-12-11 17:10:37 +01:00
list.ts [9.0] SKA: Misc cleanup and enhancements (#212207) (#212349) 2025-02-25 12:35:31 +00:00
package.json Sustainable Kibana Architecture: Add scripts/relocate CLI (beta) (#203803) 2024-12-11 17:10:37 +01:00
README.md Sustainable Kibana Architecture: Relocate script v4 (#204383) 2024-12-16 09:45:31 -06:00
relocate.ts [9.0] SKA: Misc cleanup and enhancements (#212207) (#212349) 2025-02-25 12:35:31 +00:00
tsconfig.json Sustainable Kibana Architecture: Add scripts/relocate CLI (beta) (#203803) 2024-12-11 17:10:37 +01:00
types.ts Sustainable Kibana Architecture: Relocate script v5 (#204461) 2024-12-17 04:04:48 -06:00

@kbn/relocate

This package contains a CLI tool to help move modules (plugins and packages) into their intended folders, according to the _Sustainable Kibana Architecture.

Prerequisites

You must have gh CLI tool installed. You can install it by running:

brew install gh
gh auth login

Usage

First of all, you need to decide whether you want to contribute to an existing PR or to create a new one. Use the --pr flag to specify the PR you are trying to update:

node scripts/relocate --pr <prNumber>

Note that when specifying an existing PR, the logic will undo + rewrite history for that PR, by force-pushing changes.

To relocate modules for a given team, identify the "team handle" (e.g. @elastic/kibana-core), and run the following command from the root of the Kibana repo:

node scripts/relocate --pr <prNumber> --team <team_handle>

You can relocate modules by path, e.g. all modules that are under x-pack/plugins/observability_solution/:

node scripts/relocate --pr <prNumber> --path "x-pack/plugins/observability_solution/"

You can specify indivual packages by ID:

node scripts/relocate --pr <prNumber> --include "@kbn/data-forge" --include "@kbn/deeplinks-observability"

You can also specify combinations of the above filters, to include modules that match ANY of the criteria. Excluding modules explictly is also supported:

node scripts/relocate --pr <prNumber> --team "@elastic/obs-ux-management-team" --exclude "@kbn/data-forge"

Details

The script generates log / description files of the form relocate_YYYYMMDDhhmmss_<type>.out. You can inspect them if you encounter any errors.

In particular, the file relocate_YYYYMMDDhhmmss_description.out contains the auto-generated PR description. You can push it to the PR by running:

gh pr edit <prNumber> -F relocate_YYYYMMDDhhmmss_description.out -R elastic/kibana