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

Support packages and plugins co-existing in the same folder #112886

Closed
stacey-gammon opened this issue Sep 22, 2021 · 5 comments
Closed

Support packages and plugins co-existing in the same folder #112886

stacey-gammon opened this issue Sep 22, 2021 · 5 comments
Labels
Team:Operations Team label for Operations Team

Comments

@stacey-gammon
Copy link
Contributor

stacey-gammon commented Sep 22, 2021

Problem statement

Our current directory structure, of keeping packages and plugins separate, causes some issues:

1. Increasing bundle size

A developer building a plugin will usually export stateless helper utilities from the index.ts file. This unnecessarily increases bundle size and slows down the page load for every application. We have plugins that don’t need to be plugins at all (kibana_react, kibana_utils).

2. Discoverability

If that developer does understand the benefits of putting stateless code in a package, we’ll end up with related code in two folders that are far away from each other. This leads to duplicate platform utilities, a larger public API footprint, and services that are hard to find.

Goals

  1. Decrease page load times in Kibana
  2. Improve discoverability of platform services
  3. Reduce duplicate code, which will improve maintenance

Proposal

  1. Support the ability for packages and plugins to co-exist in the same folder.

For example:
Screen Shot 2021-09-22 at 4 17 25 PM
Would simply become:
Screen Shot 2021-09-22 at 4 17 28 PM

  1. All stateless index.ts exports would automatically part of the package. Relative plugin exports would be no more.

As far as I am aware, the support for this will actually fall out naturally with some of the work the Ops team is already doing.

@stacey-gammon stacey-gammon added the Team:Operations Team label for Operations Team label Sep 22, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@stacey-gammon
Copy link
Contributor Author

Should we consider following the same strategy for packages that we have for plugins in terms of using "scope" folders, common, public, server? I suspect it will be difficult to merge them without creating consistency.

@mattkime
Copy link
Contributor

mattkime commented Oct 5, 2021

I've been thinking about tradeoffs between using packages, plugins, and how discoverability is affected. This seems to offer the best of both worlds. It would be nice to use this with the data and data_views plugins.

@stacey-gammon
Copy link
Contributor Author

Note, this is currently blocked on #107648, as moving code into packages will increase build times compared to plugins.

@tylersmalley tylersmalley added 1 and removed 1 labels Oct 11, 2021
@exalate-issue-sync exalate-issue-sync bot added impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort labels Nov 5, 2021
@tylersmalley tylersmalley removed loe:small Small Level of Effort impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. EnableJiraSync labels Mar 16, 2022
@tylersmalley
Copy link
Contributor

Closing in favor of #128012

@tylersmalley tylersmalley reopened this Mar 31, 2022
@tylersmalley tylersmalley closed this as not planned Won't fix, can't repro, duplicate, stale Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Operations Team label for Operations Team
Projects
None yet
Development

No branches or pull requests

4 participants