Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to identify plugin dependencies for TS project references migration #80463

Merged
merged 19 commits into from
Oct 16, 2020

Conversation

mshustov
Copy link
Contributor

@mshustov mshustov commented Oct 14, 2020

Summary

Closes #79343
Adds a script node scripts/find_plugins_without_ts_refs.js --id your_plugin_id to report what plugin deps haven't been migrated to TS project refs yet and what circular deps have been detected.

output for node scripts/find_plugins_without_ts_refs.js --id data

 warn Circular refs detected: [data] --> [expressions] --> [data]
 info Dependencies haven't been migrated to TS project refs yet:
      expressions
      inspector
      data
      uiActions
      usageCollection

Adds a script node scripts/find_plugin_circular_deps.js to report circular deps between all the plugins in the repo. It analyzes deps declared in kibana.json only. Thus, it doesn't detect circular type imports, imports between common and server folders - these problems should be solved by #78162 I'm going to remove this script as soon as #78162 lands.

output:

 warn Circular refs detected: [data] --> [expressions] --> [data]
 warn Circular refs detected: [discover] --> [visualizations] --> [discover]
 warn Circular refs detected: [security] --> [spaces] --> [security]
 warn Circular refs detected: [lists] --> [securitySolution] --> [lists]

@mshustov mshustov added chore release_note:skip Skip the PR/issue when compiling release notes v7.11.0 v8.0.0 labels Oct 14, 2020
@mshustov mshustov changed the title Issue 79343 find ts proj refs Add script to identify plugin dependencies for TS project references migration Oct 15, 2020
@mshustov mshustov marked this pull request as ready for review October 15, 2020 09:16
@mshustov mshustov requested a review from a team as a code owner October 15, 2020 09:16
@mshustov mshustov requested a review from spalger October 15, 2020 09:16
@mshustov mshustov added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Oct 15, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

packages/kbn-dev-utils/src/index.ts Outdated Show resolved Hide resolved
packages/kbn-dev-utils/src/plugin_list/discover_plugins.ts Outdated Show resolved Hide resolved
Comment on lines 64 to 69
version: manifest.version!,
kibanaVersion: manifest.kibanaVersion || manifest.version!,
requiredPlugins: Array.isArray(manifest.requiredPlugins) ? manifest.requiredPlugins : [],
optionalPlugins: Array.isArray(manifest.optionalPlugins) ? manifest.optionalPlugins : [],
requiredBundles: Array.isArray(manifest.requiredBundles) ? manifest.requiredBundles : [],
extraPublicDirs: Array.isArray(manifest.extraPublicDirs) ? manifest.extraPublicDirs : [],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than assume these properties are set and their types are correct please validate their existence above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added validations in plain js. What if we switch to @kbn/config-schema here?

spalger and others added 2 commits October 15, 2020 10:59
Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple nits if you don't mind, but LGTM otherwise

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

distributable file count

id before after diff
default 48028 48030 +2
oss 28561 28563 +2

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@mshustov mshustov merged commit 2e37bd0 into elastic:master Oct 16, 2020
@mshustov mshustov deleted the issue-79343-find-ts-proj-refs branch October 16, 2020 09:55
mshustov added a commit to mshustov/kibana that referenced this pull request Oct 16, 2020
…migration (elastic#80463)

* move kbn-dev-utils plugin helpers under a dedicated folder

* use getPluginSearchPaths in kbn-config & kbn-optimizer

* add a script to find plugin dependencies not migrated to TS project refs

* update docs

* add a script reporting all circular deps between plugins

based on kibana.json declaration, so it doesn't provide all the cases

* fix optimizer scan logic. removed by mistake

* revert changes. fails on CI

* remove prod depenedency on kbn/dev-utils

* remove last export

* only run plugin discovery once to speed up circular dep detection

* address comments

* address comments

* update fixtures

Co-authored-by: spalger <[email protected]>
mshustov added a commit that referenced this pull request Oct 16, 2020
…migration (#80463) (#80811)

* move kbn-dev-utils plugin helpers under a dedicated folder

* use getPluginSearchPaths in kbn-config & kbn-optimizer

* add a script to find plugin dependencies not migrated to TS project refs

* update docs

* add a script reporting all circular deps between plugins

based on kibana.json declaration, so it doesn't provide all the cases

* fix optimizer scan logic. removed by mistake

* revert changes. fails on CI

* remove prod depenedency on kbn/dev-utils

* remove last export

* only run plugin discovery once to speed up circular dep detection

* address comments

* address comments

* update fixtures

Co-authored-by: spalger <[email protected]>

Co-authored-by: spalger <[email protected]>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Oct 19, 2020
* master: (51 commits)
  [Discover] Unskip flaky test (elastic#80670)
  Fix security solution template label (elastic#80754)
  [Ingest]: ignore 404, check if there are transforms in results. (elastic#80721)
  Moving loader to logo in header, add a slight 250ms pause (elastic#78879)
  [Security Solution][Cases] Fix bug with case connectors (elastic#80642)
  Update known-plugins.asciidoc (elastic#75388)
  [Lens] Add median operation (elastic#79453)
  Fix navigateToApp logic when navigating to the current app. (elastic#80809)
  [Visualizations] Fix bad color mapping with multiple split series (elastic#80801)
  [ILM] Add esErrorHandler for the new es js client (elastic#80302)
  Fix codeowners (elastic#80826)
  skip flaky suite (elastic#79463)
  [Timelion] Remove kui usage (elastic#80287)
  [Ingest Manager] add skipIfNoDockerRegistry to package_install_complete test (elastic#80779)
  [Alerting UI] Disable "Save" button for Alerts with broken Connectors (elastic#80579)
  Allow the default space to be accessed via `/s/default` (elastic#77109)
  Add script to identify plugin dependencies for TS project references migration (elastic#80463)
  [Search] Client side session service (elastic#76889)
  feat: 🎸 add separator for different context menu groups (elastic#80498)
  Lazy load reporting (elastic#80492)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create tool to identify plugin import dependencies to support TS project references migration
4 participants