## Summary This PR aims at relocating some of the Kibana modules (plugins and packages) into a new folder structure, according to the _Sustainable Kibana Architecture_ initiative. > [!IMPORTANT] > * We kindly ask you to: > * Manually fix the errors in the error section below (if there are any). > * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the source code (Babel and Eslint config files), and update them appropriately. > * Manually review `.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that any CI pipeline customizations continue to be correctly applied after the changed path names > * Review all of the updated files, specially the `.ts` and `.js` files listed in the sections below, as some of them contain relative paths that have been updated. > * Think of potential impact of the move, including tooling and configuration files that can be pointing to the relocated modules. E.g.: > * customised eslint rules > * docs pointing to source code > [!NOTE] > * This PR has been auto-generated. > * Any manual contributions will be lost if the 'relocate' script is re-run. > * Try to obtain the missing reviews / approvals before applying manual fixes, and/or keep your changes in a .patch / git stash. > * Please use [#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E) Slack channel for feedback. Are you trying to rebase this PR to solve merge conflicts? Please follow the steps describe [here](https://elastic.slack.com/archives/C07TCKTA22E/p1734019532879269?thread_ts=1734019339.935419&cid=C07TCKTA22E). #### 4 plugin(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/encrypted-saved-objects-plugin` | `x-pack/platform/plugins/shared/encrypted_saved_objects` | | `@kbn/interactive-setup-plugin` | `src/platform/plugins/private/interactive_setup` | | `@kbn/security-plugin` | `x-pack/platform/plugins/shared/security` | | `@kbn/spaces-plugin` | `x-pack/platform/plugins/shared/spaces` | #### 14 packages(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/crypto` | `src/platform/packages/shared/kbn-crypto` | | `@kbn/handlebars` | `src/platform/packages/private/kbn-handlebars` | | `@kbn/safer-lodash-set` | `src/platform/packages/shared/kbn-safer-lodash-set` | | `@kbn/security-api-key-management` | `x-pack/platform/packages/shared/security/api_key_management` | | `@kbn/security-authorization-core` | `x-pack/platform/packages/private/security/authorization_core` | | `@kbn/security-authorization-core-common` | `x-pack/platform/packages/private/security/authorization_core_common` | | `@kbn/security-form-components` | `x-pack/platform/packages/shared/security/form_components` | | `@kbn/security-hardening` | `src/platform/packages/shared/kbn-security-hardening` | | `@kbn/security-plugin-types-common` | `x-pack/platform/packages/shared/security/plugin_types_common` | | `@kbn/security-plugin-types-public` | `x-pack/platform/packages/shared/security/plugin_types_public` | | `@kbn/security-plugin-types-server` | `x-pack/platform/packages/shared/security/plugin_types_server` | | `@kbn/security-role-management-model` | `x-pack/platform/packages/private/security/role_management_model` | | `@kbn/security-ui-components` | `x-pack/platform/packages/private/security/ui_components` | | `@kbn/user-profile-components` | `src/platform/packages/shared/kbn-user-profile-components` | <details open> <summary>Script errors</summary> ``` Cannot replace multiple occurrences of "../.." in the same line, please fix manually: /Users/dokmic/work/elastic/kibana/src/platform/packages/shared/kbn-safer-lodash-set/package.json:6 ``` </details><details > <summary>Updated references</summary> ``` ./.buildkite/scripts/steps/test/kbn_handlebars.sh ./.eslintrc.js ./.i18nrc.json ./docs/developer/advanced/sharing-saved-objects.asciidoc ./docs/developer/plugin-list.asciidoc ./legacy_rfcs/text/0007_lifecycle_unblocked.md ./legacy_rfcs/text/0016_ols_phase_1.md ./package.json ./packages/kbn-dependency-usage/src/dependency_graph/providers/cruiser.test.ts ./packages/kbn-ts-projects/config-paths.json ./packages/kbn-user-profile-components/src/user_profile.ts ./src/core/packages/saved-objects/common/src/types.ts ./src/core/packages/security/server/src/audit_logging/audit_logger.ts ./src/core/packages/user-profile/common/src/user_profile.ts ./src/dev/precommit_hook/casing_check_config.js ./src/platform/packages/private/kbn-handlebars/README.md ./src/platform/packages/private/kbn-handlebars/index.test.ts ./src/platform/packages/private/kbn-handlebars/index.ts ./src/platform/packages/private/kbn-handlebars/jest.config.js ./src/platform/packages/private/kbn-handlebars/scripts/check_for_upstream_updates.sh ./src/platform/packages/private/kbn-handlebars/scripts/print_ast.js ./src/platform/packages/private/kbn-handlebars/scripts/update_upstream_git_hash.sh ./src/platform/packages/private/kbn-handlebars/src/__jest__/test_bench.ts ./src/platform/packages/private/kbn-handlebars/src/handlebars.ts ./src/platform/packages/private/kbn-handlebars/src/spec/index.basic.test.ts ./src/platform/packages/private/kbn-handlebars/src/spec/index.blocks.test.ts ./src/platform/packages/private/kbn-handlebars/src/spec/index.builtins.test.ts ./src/platform/packages/private/kbn-handlebars/src/spec/index.compiler.test.ts ./src/platform/packages/private/kbn-handlebars/src/spec/index.data.test.ts ./src/platform/packages/private/kbn-handlebars/src/spec/index.helpers.test.ts ./src/platform/packages/private/kbn-handlebars/src/spec/index.partials.test.ts ./src/platform/packages/private/kbn-handlebars/src/spec/index.regressions.test.ts ./src/platform/packages/private/kbn-handlebars/src/spec/index.security.test.ts ./src/platform/packages/private/kbn-handlebars/src/spec/index.strict.test.ts ./src/platform/packages/private/kbn-handlebars/src/spec/index.subexpressions.test.ts ./src/platform/packages/private/kbn-handlebars/src/spec/index.utils.test.ts ./src/platform/packages/private/kbn-handlebars/src/spec/index.whitespace_control.test.ts ./src/platform/packages/private/kbn-handlebars/src/symbols.ts ./src/platform/packages/private/kbn-handlebars/src/types.ts ./src/platform/packages/private/kbn-handlebars/src/utils.ts ./src/platform/packages/private/kbn-handlebars/src/visitor.ts ./src/platform/packages/private/kbn-repo-packages/package-map.json ./src/platform/packages/private/kbn-ui-shared-deps-src/BUILD.bazel ./src/platform/packages/shared/kbn-crypto/jest.config.js ./src/platform/packages/shared/kbn-safer-lodash-set/fp/assoc.d.ts ./src/platform/packages/shared/kbn-safer-lodash-set/fp/assoc.js ./src/platform/packages/shared/kbn-safer-lodash-set/fp/assocPath.d.ts ./src/platform/packages/shared/kbn-safer-lodash-set/fp/assocPath.js ./src/platform/packages/shared/kbn-safer-lodash-set/fp/index.d.ts ./src/platform/packages/shared/kbn-safer-lodash-set/fp/index.js ./src/platform/packages/shared/kbn-safer-lodash-set/fp/set.d.ts ./src/platform/packages/shared/kbn-safer-lodash-set/fp/set.js ./src/platform/packages/shared/kbn-safer-lodash-set/fp/setWith.d.ts ./src/platform/packages/shared/kbn-safer-lodash-set/fp/setWith.js ./src/platform/packages/shared/kbn-safer-lodash-set/index.d.ts ./src/platform/packages/shared/kbn-safer-lodash-set/index.js ./src/platform/packages/shared/kbn-safer-lodash-set/lodash/_baseSet.js ./src/platform/packages/shared/kbn-safer-lodash-set/lodash/set.js ./src/platform/packages/shared/kbn-safer-lodash-set/lodash/setWith.js ./src/platform/packages/shared/kbn-safer-lodash-set/package.json ./src/platform/packages/shared/kbn-safer-lodash-set/scripts/_get_lodash.sh ./src/platform/packages/shared/kbn-safer-lodash-set/scripts/license-header.txt ./src/platform/packages/shared/kbn-safer-lodash-set/scripts/save_state.sh ./src/platform/packages/shared/kbn-safer-lodash-set/scripts/update.sh ./src/platform/packages/shared/kbn-safer-lodash-set/set.d.ts ./src/platform/packages/shared/kbn-safer-lodash-set/set.js ./src/platform/packages/shared/kbn-safer-lodash-set/setWith.d.ts ./src/platform/packages/shared/kbn-safer-lodash-set/setWith.js ./src/platform/packages/shared/kbn-safer-lodash-set/test/fp.ts ./src/platform/packages/shared/kbn-safer-lodash-set/test/fp_assoc.ts ./src/platform/packages/shared/kbn-safer-lodash-set/test/fp_assocPath.ts ./src/platform/packages/shared/kbn-safer-lodash-set/test/fp_patch_test.js ./src/platform/packages/shared/kbn-safer-lodash-set/test/fp_set.ts ./src/platform/packages/shared/kbn-safer-lodash-set/test/fp_setWith.ts ./src/platform/packages/shared/kbn-safer-lodash-set/test/index.ts ./src/platform/packages/shared/kbn-safer-lodash-set/test/patch_test.js ./src/platform/packages/shared/kbn-safer-lodash-set/test/set.ts ./src/platform/packages/shared/kbn-safer-lodash-set/test/setWith.ts ./src/platform/packages/shared/kbn-user-profile-components/jest.config.js ./src/platform/plugins/private/interactive_setup/jest.config.js ./tsconfig.base.json ./x-pack/.i18nrc.json ./x-pack/platform/packages/private/security/authorization_core/jest.config.js ./x-pack/platform/packages/private/security/authorization_core_common/jest.config.js ./x-pack/platform/packages/private/security/role_management_model/jest.config.js ./x-pack/platform/packages/private/security/ui_components/jest.config.js ./x-pack/platform/packages/shared/security/api_key_management/jest.config.js ./x-pack/platform/packages/shared/security/form_components/jest.config.js ./x-pack/platform/plugins/shared/cases/server/authorization/index.ts ./x-pack/platform/plugins/shared/cases/server/authorization/types.ts ./x-pack/platform/plugins/shared/cases/server/connectors/cases/utils.ts ./x-pack/platform/plugins/shared/cases/server/routes/api/utils.ts ./x-pack/platform/plugins/shared/encrypted_saved_objects/README.md ./x-pack/platform/plugins/shared/encrypted_saved_objects/jest.config.js ./x-pack/platform/plugins/shared/fleet/common/http_authorization_header.ts ./x-pack/platform/plugins/shared/rule_registry/server/lib/get_is_kibana_request.ts ./x-pack/platform/plugins/shared/security/jest.config.js ./x-pack/platform/plugins/shared/spaces/jest.config.js ./x-pack/solutions/security/plugins/security_solution/server/lib/timeline/routes/notes/get_notes.ts ./yarn.lock .github/CODEOWNERS ``` </details><details > <summary>Updated relative paths</summary> ``` src/platform/packages/private/kbn-handlebars/jest.config.js:8 src/platform/packages/private/kbn-handlebars/src/spec/index.regressions.test.ts:276 src/platform/packages/private/kbn-handlebars/src/spec/index.regressions.test.ts:277 src/platform/packages/private/kbn-handlebars/tsconfig.json:2 src/platform/packages/shared/kbn-crypto/jest.config.js:12 src/platform/packages/shared/kbn-crypto/tsconfig.json:2 src/platform/packages/shared/kbn-safer-lodash-set/package.json:6 src/platform/packages/shared/kbn-safer-lodash-set/package.json:7 src/platform/packages/shared/kbn-safer-lodash-set/package.json:8 src/platform/packages/shared/kbn-safer-lodash-set/tsconfig.json:2 src/platform/packages/shared/kbn-security-hardening/tsconfig.json:2 src/platform/packages/shared/kbn-user-profile-components/jest.config.js:12 src/platform/packages/shared/kbn-user-profile-components/tsconfig.json:2 src/platform/plugins/private/interactive_setup/jest.config.js:12 src/platform/plugins/private/interactive_setup/tsconfig.json:2 x-pack/platform/packages/private/security/authorization_core/jest.config.js:13 x-pack/platform/packages/private/security/authorization_core/tsconfig.json:2 x-pack/platform/packages/private/security/authorization_core_common/jest.config.js:15 x-pack/platform/packages/private/security/authorization_core_common/tsconfig.json:2 x-pack/platform/packages/private/security/role_management_model/jest.config.js:14 x-pack/platform/packages/private/security/role_management_model/tsconfig.json:2 x-pack/platform/packages/private/security/ui_components/jest.config.js:13 x-pack/platform/packages/private/security/ui_components/tsconfig.json:2 x-pack/platform/packages/shared/security/api_key_management/jest.config.js:14 x-pack/platform/packages/shared/security/api_key_management/tsconfig.json:2 x-pack/platform/packages/shared/security/form_components/jest.config.js:14 x-pack/platform/packages/shared/security/form_components/tsconfig.json:2 x-pack/platform/packages/shared/security/plugin_types_common/tsconfig.json:2 x-pack/platform/packages/shared/security/plugin_types_public/tsconfig.json:2 x-pack/platform/packages/shared/security/plugin_types_server/tsconfig.json:2 x-pack/platform/plugins/shared/encrypted_saved_objects/README.md:8 x-pack/platform/plugins/shared/encrypted_saved_objects/jest.config.js:10 x-pack/platform/plugins/shared/encrypted_saved_objects/tsconfig.json:2 x-pack/platform/plugins/shared/security/jest.config.js:10 x-pack/platform/plugins/shared/security/tsconfig.json:2 x-pack/platform/plugins/shared/spaces/jest.config.js:10 x-pack/platform/plugins/shared/spaces/tsconfig.json:2 ``` </details> --------- Co-authored-by: Michael Dokolin <mikhail.dokolin@elastic.co> Co-authored-by: “jeramysoucy” <jeramy.soucy@elastic.co> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
---|---|---|
.. | ||
src | ||
jest.config.js | ||
kibana.jsonc | ||
package.json | ||
README.md | ||
tsconfig.json |
@kbn/dependency-usage
A CLI tool for analyzing dependencies across packages and plugins. This tool provides commands to check dependency usage, aggregate it, debug dependency graphs, and more.
Table of Contents
- Show all packages/plugins using a dependency
- Show dependencies grouped by code owner
- List all dependencies for a package or directory
- Group by code owner with adjustable collapse depth
- Show dependencies matching a pattern
- Verbose flag to debug dependency graph issues
1. Show all packages/plugins using a specific dependency
Use this command to list all packages or plugins within a directory that use a specified dependency.
bash scripts/dependency_usage.sh -d <dependency> -p <path_to_directory>
or
bash scripts/dependency_usage.sh --dependency-name <dependency> --paths <path_to_directory>
Example:
bash scripts/dependency_usage.sh -d rxjs -p x-pack/solutions/security/plugins/security_solution
-d rxjs
: Specifies the dependency to look for (rxjs
).-p x-pack/solutions/security/plugins/security_solution
: Sets the directory to search within (x-pack/solutions/security/plugins/security_solution
).
2. Show dependencies grouped by code owner
Group the dependencies used within a directory by code owner.
bash scripts/dependency_usage.sh -p <path_to_directory> -g owner
or
bash scripts/dependency_usage.sh --paths <path_to_directory> --group-by owner
Example:
bash scripts/dependency_usage.sh -p x-pack/plugins -g owner
-p x-pack/plugins
: Sets the directory to scan for plugins using this dependency.-g owner
: Groups results by code owner.- Output: Lists all dependencies for
x-pack/plugins
, organized by code owner.
3. List all dependencies for source directory
To display all dependencies used within a specific directory.
bash scripts/dependency_usage.sh -p <path_to_directory>
or
bash scripts/dependency_usage.sh --paths <path_to_directory>
Example:
bash scripts/dependency_usage.sh -p x-pack/solutions/security/plugins/security_solution
-p x-pack/solutions/security/plugins/security_solution
: Specifies the package or directory for which to list all dependencies.- Output: Lists all dependencies for
x-pack/solutions/security/plugins/security_solution
.
4. Group by code owner with adjustable collapse depth
When a package or plugin has multiple subteams, use the --collapse-depth
option to control how granular the grouping by code owner should be.
Detailed Subteam Grouping
Shows all subteams within security_solution
.
bash scripts/dependency_usage.sh -p x-pack/solutions/security/plugins/security_solution -g owner --collapse-depth 4
Collapsed Grouping
Groups the results under a higher-level owner (e.g., security_solution
as a single group).
bash scripts/dependency_usage.sh -p x-pack/solutions/security/plugins/security_solution -g owner --collapse-depth 1
Explanation:
-p x-pack/solutions/security/plugins/security_solution
: Specifies the directory to scan.-g owner
: Groups results by code owner.--collapse-depth
: Defines the depth for grouping, where higher numbers show more granular subteams.- Output: Lists dependencies grouped by code owner at different levels of depth based on the
--collapse-depth
value.
5. Show dependencies matching a pattern
Search for dependencies that match a specific pattern (such as react-*
) within a package and output the results to a specified file.
bash scripts/dependency_usage.sh -p <path_to_directory> -d '<pattern>' -o <output_file>
Example:
bash scripts/dependency_usage.sh -d 'react-*' -p x-pack/solutions/security/plugins/security_solution -o ./tmp/results.json
-p x-pack/solutions/security/plugins/security_solution
: Specifies the directory or package to search within.-d 'react-*'
: Searches for dependencies that match the patternreact-*
.-o ./tmp/results.json
: Outputs the results to a specified file (results.json
in the./tmp
directory).- Output: Saves a list of all dependencies matching
react-*
inx-pack/solutions/security/plugins/security_solution
to./tmp/results.json
.
6. Verbose flag to debug dependency graph issues
Enable verbose mode to log additional details for debugging dependency graphs. This includes generating a non-aggregated dependency graph in .dependency-graph-log.json
.
bash scripts/dependency_usage.sh -p <path_to_directory> -o <output_file> -v
Example:
bash scripts/dependency_usage.sh -p x-pack/solutions/security/plugins/security_solution -o ./tmp/results.json
-p x-pack/solutions/security/plugins/security_solution
: Specifies the target directory or package to analyze.-o ./tmp/results.json
: Saves the output to theresults.json
file in the./tmp
directory.-v
: Enables verbose mode.
Output: Saves a list of all dependencies in x-pack/solutions/security/plugins/security_solution
to ./tmp/results.json
. Additionally, it logs a detailed, non aggregated dependency graph to .dependency-graph-log.json
for debugging purposes.
For further information on additional flags and options, refer to the script's help command.