[8.x] Sustainable Kibana Architecture: Move 11 modules under packages/core (#203638) (#205108)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Sustainable Kibana Architecture: Move 11 modules under
`packages/core`
(#203638)](https://github.com/elastic/kibana/pull/203638)

<!--- Backport version: 8.9.8 -->

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

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2024-12-23T15:36:49Z","message":"Sustainable
Kibana Architecture: Move 11 modules under `packages/core`
(#203638)\n\n## Summary\r\n\r\nThis PR aims at relocating some of the
Kibana modules (plugins and\r\npackages) into a new folder structure,
according to the _Sustainable\r\nKibana Architecture_
initiative.\r\n\r\n> [!IMPORTANT]\r\n> * We kindly ask you to:\r\n> *
Manually fix the errors in the error section below (if there
are\r\nany).\r\n> * Search for the `packages[\\/\\\\]` and
`plugins[\\/\\\\]` patterns in the\r\nsource code (Babel and Eslint
config files), and update them\r\nappropriately.\r\n> * Manually
review\r\n`.buildkite/scripts/pipelines/pull_request/pipeline.ts` to
ensure that\r\nany CI pipeline customizations continue to be correctly
applied after\r\nthe changed path names\r\n> * Review all of the updated
files, specially the `.ts` and `.js` files\r\nlisted in the sections
below, as some of them contain relative paths\r\nthat have been
updated.\r\n> * Think of potential impact of the move, including tooling
and\r\nconfiguration files that can be pointing to the relocated
modules. E.g.:\r\n> * customised eslint rules\r\n> * docs pointing to
source code\r\n\r\n> [!NOTE]\r\n> This PR has been auto-generated.\r\n>
Do not attempt to push any changes unless you know what you are
doing.\r\n> Please
use\r\n[#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E)\r\nSlack
channel for feedback.\r\n\r\n\r\n#### 11 package(s) are going to be
relocated:\r\n\r\n| Id | Target folder |\r\n| -- | ------------- |\r\n|
@kbn/core-analytics-browser | src/core/packages/analytics/browser |\r\n|
@kbn/core-analytics-browser-internal
|\r\nsrc/core/packages/analytics/browser-internal |\r\n|
@kbn/core-analytics-server | src/core/packages/analytics/server |\r\n|
@kbn/core-analytics-server-internal
|\r\nsrc/core/packages/analytics/server-internal |\r\n|
@kbn/core-application-browser |
src/core/packages/application/browser\r\n|\r\n|
@kbn/core-application-browser-internal
|\r\nsrc/core/packages/application/browser-internal |\r\n|
@kbn/core-application-common | src/core/packages/application/common
|\r\n| @kbn/core-apps-browser-internal
|\r\nsrc/core/packages/apps/browser-internal |\r\n|
@kbn/core-apps-server-internal
|\r\nsrc/core/packages/apps/server-internal |\r\n|
@kbn/core-base-browser-internal
|\r\nsrc/core/packages/base/browser-internal |\r\n|
@kbn/core-base-common | src/core/packages/base/common
|","sha":"f2a50ef30de03d1da9da3b968892ada5300024bf","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","v9.0.0","backport:prev-minor","plugin
groups"],"number":203638,"url":"https://github.com/elastic/kibana/pull/203638","mergeCommit":{"message":"Sustainable
Kibana Architecture: Move 11 modules under `packages/core`
(#203638)\n\n## Summary\r\n\r\nThis PR aims at relocating some of the
Kibana modules (plugins and\r\npackages) into a new folder structure,
according to the _Sustainable\r\nKibana Architecture_
initiative.\r\n\r\n> [!IMPORTANT]\r\n> * We kindly ask you to:\r\n> *
Manually fix the errors in the error section below (if there
are\r\nany).\r\n> * Search for the `packages[\\/\\\\]` and
`plugins[\\/\\\\]` patterns in the\r\nsource code (Babel and Eslint
config files), and update them\r\nappropriately.\r\n> * Manually
review\r\n`.buildkite/scripts/pipelines/pull_request/pipeline.ts` to
ensure that\r\nany CI pipeline customizations continue to be correctly
applied after\r\nthe changed path names\r\n> * Review all of the updated
files, specially the `.ts` and `.js` files\r\nlisted in the sections
below, as some of them contain relative paths\r\nthat have been
updated.\r\n> * Think of potential impact of the move, including tooling
and\r\nconfiguration files that can be pointing to the relocated
modules. E.g.:\r\n> * customised eslint rules\r\n> * docs pointing to
source code\r\n\r\n> [!NOTE]\r\n> This PR has been auto-generated.\r\n>
Do not attempt to push any changes unless you know what you are
doing.\r\n> Please
use\r\n[#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E)\r\nSlack
channel for feedback.\r\n\r\n\r\n#### 11 package(s) are going to be
relocated:\r\n\r\n| Id | Target folder |\r\n| -- | ------------- |\r\n|
@kbn/core-analytics-browser | src/core/packages/analytics/browser |\r\n|
@kbn/core-analytics-browser-internal
|\r\nsrc/core/packages/analytics/browser-internal |\r\n|
@kbn/core-analytics-server | src/core/packages/analytics/server |\r\n|
@kbn/core-analytics-server-internal
|\r\nsrc/core/packages/analytics/server-internal |\r\n|
@kbn/core-application-browser |
src/core/packages/application/browser\r\n|\r\n|
@kbn/core-application-browser-internal
|\r\nsrc/core/packages/application/browser-internal |\r\n|
@kbn/core-application-common | src/core/packages/application/common
|\r\n| @kbn/core-apps-browser-internal
|\r\nsrc/core/packages/apps/browser-internal |\r\n|
@kbn/core-apps-server-internal
|\r\nsrc/core/packages/apps/server-internal |\r\n|
@kbn/core-base-browser-internal
|\r\nsrc/core/packages/base/browser-internal |\r\n|
@kbn/core-base-common | src/core/packages/base/common
|","sha":"f2a50ef30de03d1da9da3b968892ada5300024bf"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/203638","number":203638,"mergeCommit":{"message":"Sustainable
Kibana Architecture: Move 11 modules under `packages/core`
(#203638)\n\n## Summary\r\n\r\nThis PR aims at relocating some of the
Kibana modules (plugins and\r\npackages) into a new folder structure,
according to the _Sustainable\r\nKibana Architecture_
initiative.\r\n\r\n> [!IMPORTANT]\r\n> * We kindly ask you to:\r\n> *
Manually fix the errors in the error section below (if there
are\r\nany).\r\n> * Search for the `packages[\\/\\\\]` and
`plugins[\\/\\\\]` patterns in the\r\nsource code (Babel and Eslint
config files), and update them\r\nappropriately.\r\n> * Manually
review\r\n`.buildkite/scripts/pipelines/pull_request/pipeline.ts` to
ensure that\r\nany CI pipeline customizations continue to be correctly
applied after\r\nthe changed path names\r\n> * Review all of the updated
files, specially the `.ts` and `.js` files\r\nlisted in the sections
below, as some of them contain relative paths\r\nthat have been
updated.\r\n> * Think of potential impact of the move, including tooling
and\r\nconfiguration files that can be pointing to the relocated
modules. E.g.:\r\n> * customised eslint rules\r\n> * docs pointing to
source code\r\n\r\n> [!NOTE]\r\n> This PR has been auto-generated.\r\n>
Do not attempt to push any changes unless you know what you are
doing.\r\n> Please
use\r\n[#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E)\r\nSlack
channel for feedback.\r\n\r\n\r\n#### 11 package(s) are going to be
relocated:\r\n\r\n| Id | Target folder |\r\n| -- | ------------- |\r\n|
@kbn/core-analytics-browser | src/core/packages/analytics/browser |\r\n|
@kbn/core-analytics-browser-internal
|\r\nsrc/core/packages/analytics/browser-internal |\r\n|
@kbn/core-analytics-server | src/core/packages/analytics/server |\r\n|
@kbn/core-analytics-server-internal
|\r\nsrc/core/packages/analytics/server-internal |\r\n|
@kbn/core-application-browser |
src/core/packages/application/browser\r\n|\r\n|
@kbn/core-application-browser-internal
|\r\nsrc/core/packages/application/browser-internal |\r\n|
@kbn/core-application-common | src/core/packages/application/common
|\r\n| @kbn/core-apps-browser-internal
|\r\nsrc/core/packages/apps/browser-internal |\r\n|
@kbn/core-apps-server-internal
|\r\nsrc/core/packages/apps/server-internal |\r\n|
@kbn/core-base-browser-internal
|\r\nsrc/core/packages/base/browser-internal |\r\n|
@kbn/core-base-common | src/core/packages/base/common
|","sha":"f2a50ef30de03d1da9da3b968892ada5300024bf"}}]}] BACKPORT-->
This commit is contained in:
Gerard Soldevila 2024-12-23 19:26:55 +01:00 committed by GitHub
parent ccf8bcb420
commit 1febffdff2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
270 changed files with 183 additions and 148 deletions

22
.github/CODEOWNERS vendored
View file

@ -120,23 +120,23 @@ packages/kbn-content-management-utils @elastic/kibana-data-discovery
examples/controls_example @elastic/kibana-presentation
src/plugins/controls @elastic/kibana-presentation
src/core @elastic/kibana-core
packages/core/analytics/core-analytics-browser @elastic/kibana-core
packages/core/analytics/core-analytics-browser-internal @elastic/kibana-core
src/core/packages/analytics/browser @elastic/kibana-core
src/core/packages/analytics/browser-internal @elastic/kibana-core
packages/core/analytics/core-analytics-browser-mocks @elastic/kibana-core
packages/core/analytics/core-analytics-server @elastic/kibana-core
packages/core/analytics/core-analytics-server-internal @elastic/kibana-core
src/core/packages/analytics/server @elastic/kibana-core
src/core/packages/analytics/server-internal @elastic/kibana-core
packages/core/analytics/core-analytics-server-mocks @elastic/kibana-core
test/plugin_functional/plugins/core_app_status @elastic/kibana-core
packages/core/application/core-application-browser @elastic/kibana-core
packages/core/application/core-application-browser-internal @elastic/kibana-core
src/core/packages/application/browser @elastic/kibana-core
src/core/packages/application/browser-internal @elastic/kibana-core
packages/core/application/core-application-browser-mocks @elastic/kibana-core
packages/core/application/core-application-common @elastic/kibana-core
packages/core/apps/core-apps-browser-internal @elastic/kibana-core
src/core/packages/application/common @elastic/kibana-core
src/core/packages/apps/browser-internal @elastic/kibana-core
packages/core/apps/core-apps-browser-mocks @elastic/kibana-core
packages/core/apps/core-apps-server-internal @elastic/kibana-core
packages/core/base/core-base-browser-internal @elastic/kibana-core
src/core/packages/apps/server-internal @elastic/kibana-core
src/core/packages/base/browser-internal @elastic/kibana-core
packages/core/base/core-base-browser-mocks @elastic/kibana-core
packages/core/base/core-base-common @elastic/kibana-core
src/core/packages/base/common @elastic/kibana-core
packages/core/base/core-base-common-internal @elastic/kibana-core
packages/core/base/core-base-server-internal @elastic/kibana-core
packages/core/base/core-base-server-mocks @elastic/kibana-core

View file

@ -29,7 +29,7 @@ export class MyPlugin implements Plugin {
}
}
----
<1> Refer to {kib-repo}/blob/8.9/packages/core/application/core-application-browser/src/contracts.ts[application.register interface]
<1> Refer to {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/contracts.ts[application.register interface]
<2> Application specific URL.
<3> `mount` callback is invoked when a user navigates to the application-specific URL.
<4> `core.getStartServices` method provides API available during `start` lifecycle.

View file

@ -39,7 +39,7 @@ Registering a feature consists of the following fields. For more information, co
|A human readable name for your feature.
|`category` (required)
|{kib-repo}blob/{branch}/packages/core/application/core-application-common/src/app_category.ts[`AppCategory`]
|{kib-repo}blob/{branch}/src/core/packages/application/common/src/app_category.ts[`AppCategory`]
|`DEFAULT_APP_CATEGORIES.kibana`
|The `AppCategory` which best represents your feature. Used to organize the display
of features within the management screens.

View file

@ -87,13 +87,13 @@ window.location.href = urlToADashboard;
To navigate between different {kib} apps without a page reload (by default) there are APIs in `core`:
* {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/contracts.ts[core.application.navigateToApp]
* {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/contracts.ts[core.application.navigateToUrl]
* {kib-repo}tree/{branch}/src/core/packages/application/browser/src/contracts.ts[core.application.navigateToApp]
* {kib-repo}tree/{branch}/src/core/packages/application/browser/src/contracts.ts[core.application.navigateToUrl]
Both methods offer customization such as opening the target in a new page, with an `options` parameter. All the options are optional be default.
* {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/contracts.ts[core.application.navigateToApp options]
* {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/contracts.ts[core.application.navigateToUrl options]
* {kib-repo}tree/{branch}/src/core/packages/application/browser/src/contracts.ts[core.application.navigateToApp options]
* {kib-repo}tree/{branch}/src/core/packages/application/browser/src/contracts.ts[core.application.navigateToUrl options]
*Rendering a link to a different {kib} app on its own would also cause a full page reload:*
@ -163,8 +163,8 @@ Common rules to follow in this scenario:
This is required to make sure `core` is aware of navigations triggered inside your app, so it could act accordingly when needed.
* `Core`'s {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/scoped_history.ts[ScopedHistory] instance.
* {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/app_mount.ts[Example usage]
* `Core`'s {kib-repo}tree/{branch}/src/core/packages/application/browser/src/scoped_history.ts[ScopedHistory] instance.
* {kib-repo}tree/{branch}/src/core/packages/application/browser/src/app_mount.ts[Example usage]
* {kib-repo}tree/{branch}/test/plugin_functional/plugins/core_plugin_a/public/application.tsx#L120[Example plugin]
Relative links will be resolved relative to your app's route (e.g.: `http://localhost5601/app/{your-app-id}`)
@ -181,14 +181,14 @@ const MyInternalLink = () => <Link to="/my-other-page"></Link>
=== Using history and browser location
Try to avoid using `window.location` and `window.history` directly. +
Instead, consider using {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/scoped_history.ts[ScopedHistory]
Instead, consider using {kib-repo}tree/{branch}/src/core/packages/application/browser/src/scoped_history.ts[ScopedHistory]
instance provided by `core`.
* This way `core` will know about location changes triggered within your app, and it would act accordingly.
* Some plugins are listening to location changes. Triggering location change manually could lead to unpredictable and hard-to-catch bugs.
Common use-case for using
`core`'s {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/scoped_history.ts[ScopedHistory] directly:
`core`'s {kib-repo}tree/{branch}/src/core/packages/application/browser/src/scoped_history.ts[ScopedHistory] directly:
* Reading/writing query params or hash.
* Imperatively triggering internal navigations within your app.

View file

@ -245,18 +245,18 @@
"@kbn/controls-example-plugin": "link:examples/controls_example",
"@kbn/controls-plugin": "link:src/plugins/controls",
"@kbn/core": "link:src/core",
"@kbn/core-analytics-browser": "link:packages/core/analytics/core-analytics-browser",
"@kbn/core-analytics-browser-internal": "link:packages/core/analytics/core-analytics-browser-internal",
"@kbn/core-analytics-server": "link:packages/core/analytics/core-analytics-server",
"@kbn/core-analytics-server-internal": "link:packages/core/analytics/core-analytics-server-internal",
"@kbn/core-analytics-browser": "link:src/core/packages/analytics/browser",
"@kbn/core-analytics-browser-internal": "link:src/core/packages/analytics/browser-internal",
"@kbn/core-analytics-server": "link:src/core/packages/analytics/server",
"@kbn/core-analytics-server-internal": "link:src/core/packages/analytics/server-internal",
"@kbn/core-app-status-plugin": "link:test/plugin_functional/plugins/core_app_status",
"@kbn/core-application-browser": "link:packages/core/application/core-application-browser",
"@kbn/core-application-browser-internal": "link:packages/core/application/core-application-browser-internal",
"@kbn/core-application-common": "link:packages/core/application/core-application-common",
"@kbn/core-apps-browser-internal": "link:packages/core/apps/core-apps-browser-internal",
"@kbn/core-apps-server-internal": "link:packages/core/apps/core-apps-server-internal",
"@kbn/core-base-browser-internal": "link:packages/core/base/core-base-browser-internal",
"@kbn/core-base-common": "link:packages/core/base/core-base-common",
"@kbn/core-application-browser": "link:src/core/packages/application/browser",
"@kbn/core-application-browser-internal": "link:src/core/packages/application/browser-internal",
"@kbn/core-application-common": "link:src/core/packages/application/common",
"@kbn/core-apps-browser-internal": "link:src/core/packages/apps/browser-internal",
"@kbn/core-apps-server-internal": "link:src/core/packages/apps/server-internal",
"@kbn/core-base-browser-internal": "link:src/core/packages/base/browser-internal",
"@kbn/core-base-common": "link:src/core/packages/base/common",
"@kbn/core-base-common-internal": "link:packages/core/base/core-base-common-internal",
"@kbn/core-base-server-internal": "link:packages/core/base/core-base-server-internal",
"@kbn/core-capabilities-browser-internal": "link:packages/core/capabilities/core-capabilities-browser-internal",

View file

@ -1,14 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
module.exports = {
preset: '@kbn/test',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/analytics/core-analytics-browser-internal'],
};

View file

@ -1,14 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
module.exports = {
preset: '@kbn/test',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/application/core-application-browser-internal'],
};

View file

@ -1,14 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
module.exports = {
preset: '@kbn/test',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/application/core-application-browser'],
};

View file

@ -9,6 +9,6 @@
module.exports = {
preset: '@kbn/test',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/application/core-application-common'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/analytics/browser-internal'],
};

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": ["jest", "node"]

View file

@ -9,6 +9,6 @@
module.exports = {
preset: '@kbn/test',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/apps/core-apps-browser-internal'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/analytics/browser'],
};

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [

View file

@ -9,6 +9,6 @@
module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/analytics/core-analytics-server-internal'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/analytics/server-internal'],
};

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [

View file

@ -9,6 +9,6 @@
module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/apps/core-apps-server-internal'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/analytics/server'],
};

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [

View file

@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
module.exports = {
preset: '@kbn/test',
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/application/browser-internal'],
};

View file

@ -9,6 +9,6 @@
module.exports = {
preset: '@kbn/test/jest_integration',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/application/core-application-browser-internal'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/application/browser-internal'],
};

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [

View file

@ -9,6 +9,6 @@
module.exports = {
preset: '@kbn/test',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/base/core-base-browser-internal'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/application/browser'],
};

Some files were not shown because too many files have changed in this diff Show more