Commit graph

75 commits

Author SHA1 Message Date
David Luna
9a798c7969
chore: update elastic-agent-nodejs to v4 (#165483)
## Summary

Draft PR to see the impact of the new major version of
`elastic-apm-node` dependency. Please do not review yet.

- elastic-apm-node@4 changelog:
https://www.elastic.co/guide/en/apm/agent/nodejs/current/release-notes-4.x.html#release-notes-4.0.0
- elastic-apm-node@4 upgrade guide:
https://www.elastic.co/guide/en/apm/agent/nodejs/current/upgrade-to-v4.html


### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2023-09-13 12:56:39 +02:00
Walter Rafelsberger
b2f48f2d54
[spacetime] Improve scripts/build_api_docs stats output speed. (#157129)
The existing `build_api_docs` script takes about ~10m to run and
generate the API docs. That's not too bad for the daily CI task that
generates the docs. However, even if you're just interested in getting
some stats on a single plugin/package it runs the full script. We often
have to run this script locally to check the stats in detail to improve
JSDoc and missing exports which is quite cumbersome if it takes this
long to run after each code change.

This PR updates the script in the following way: If both the options
`--stats` and `--plugin` (with a single plugin/package) are set, it will
not generate a TS project for the whole Kibana codebase but just the
code related to that plugin/package. API docs will then not be written
to avoid inconsistencies and just the stats will be logged.

Depending on the size of the package/plugin this can reduce the time
needed to run the script down to a few seconds.
2023-06-01 14:10:59 +02:00
Spencer
1b85815402
[packages] migrate all plugins to packages (#148130)
Fixes https://github.com/elastic/kibana/issues/149344

This PR migrates all plugins to packages automatically. It does this
using `node scripts/lint_packages` to automatically migrate
`kibana.json` files to `kibana.jsonc` files. By doing this automatically
we can simplify many build and testing procedures to only support
packages, and not both "packages" and "synthetic packages" (basically
pointers to plugins).

The majority of changes are in operations related code, so we'll be
having operations review this before marking it ready for review. The
vast majority of the code owners are simply pinged because we deleted
all `kibana.json` files and replaced them with `kibana.jsonc` files, so
we plan on leaving the PR ready-for-review for about 24 hours before
merging (after feature freeze), assuming we don't have any blockers
(especially from @elastic/kibana-core since there are a few core
specific changes, though the majority were handled in #149370).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-02-08 21:06:50 -06:00
Spencer
52d235ae49
[docs-utils] remove extra api_docs dir (#148658)
In order to avoid searching the `api_docs` directory at the root of the
repo in VSCode we have to exclude all api_docs dirs from search, so
instead of putting the source of the code that generates the api_docs in
a similarly named dir this just removes that wrapper.
2023-01-10 12:20:35 -07:00
Spencer
5eba1df3de
When counting eslint directives, only check files checked into the repo (#148208)
We're seeing many extra eslint-disabled counts on PRs right now because
new .gitignore'd files are being written to plugins/packages. This fixes
the logic to stop checking every file in a plugin/package directory, and
instead only check files that are committed to the repository.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-29 15:13:00 -07:00
Spencer
afb09ccf8a
Transpile packages on demand, validate all TS projects (#146212)
## Dearest Reviewers 👋 

I've been working on this branch with @mistic and @tylersmalley and
we're really confident in these changes. Additionally, this changes code
in nearly every package in the repo so we don't plan to wait for reviews
to get in before merging this. If you'd like to have a concern
addressed, please feel free to leave a review, but assuming that nobody
raises a blocker in the next 24 hours we plan to merge this EOD pacific
tomorrow, 12/22.

We'll be paying close attention to any issues this causes after merging
and work on getting those fixed ASAP. 🚀

---

The operations team is not confident that we'll have the time to achieve
what we originally set out to accomplish by moving to Bazel with the
time and resources we have available. We have also bought ourselves some
headroom with improvements to babel-register, optimizer caching, and
typescript project structure.

In order to make sure we deliver packages as quickly as possible (many
teams really want them), with a usable and familiar developer
experience, this PR removes Bazel for building packages in favor of
using the same JIT transpilation we use for plugins.

Additionally, packages now use `kbn_references` (again, just copying the
dx from plugins to packages).

Because of the complex relationships between packages/plugins and in
order to prepare ourselves for automatic dependency detection tools we
plan to use in the future, this PR also introduces a "TS Project Linter"
which will validate that every tsconfig.json file meets a few
requirements:

1. the chain of base config files extended by each config includes
`tsconfig.base.json` and not `tsconfig.json`
1. the `include` config is used, and not `files`
2. the `exclude` config includes `target/**/*`
3. the `outDir` compiler option is specified as `target/types`
1. none of these compiler options are specified: `declaration`,
`declarationMap`, `emitDeclarationOnly`, `skipLibCheck`, `target`,
`paths`

4. all references to other packages/plugins use their pkg id, ie:
	
	```js
    // valid
    {
      "kbn_references": ["@kbn/core"]
    }
    // not valid
    {
      "kbn_references": [{ "path": "../../../src/core/tsconfig.json" }]
    }
    ```

5. only packages/plugins which are imported somewhere in the ts code are
listed in `kbn_references`

This linter is not only validating all of the tsconfig.json files, but
it also will fix these config files to deal with just about any
violation that can be produced. Just run `node scripts/ts_project_linter
--fix` locally to apply these fixes, or let CI take care of
automatically fixing things and pushing the changes to your PR.

> **Example:** [`64e93e5`
(#146212)](64e93e5806)
When I merged main into my PR it included a change which removed the
`@kbn/core-injected-metadata-browser` package. After resolving the
conflicts I missed a few tsconfig files which included references to the
now removed package. The TS Project Linter identified that these
references were removed from the code and pushed a change to the PR to
remove them from the tsconfig.json files.

## No bazel? Does that mean no packages??
Nope! We're still doing packages but we're pretty sure now that we won't
be using Bazel to accomplish the 'distributed caching' and 'change-based
tasks' portions of the packages project.

This PR actually makes packages much easier to work with and will be
followed up with the bundling benefits described by the original
packages RFC. Then we'll work on documentation and advocacy for using
packages for any and all new code.

We're pretty confident that implementing distributed caching and
change-based tasks will be necessary in the future, but because of
recent improvements in the repo we think we can live without them for
**at least** a year.

## Wait, there are still BUILD.bazel files in the repo
Yes, there are still three webpack bundles which are built by Bazel: the
`@kbn/ui-shared-deps-npm` DLL, `@kbn/ui-shared-deps-src` externals, and
the `@kbn/monaco` workers. These three webpack bundles are still created
during bootstrap and remotely cached using bazel. The next phase of this
project is to figure out how to get the package bundling features
described in the RFC with the current optimizer, and we expect these
bundles to go away then. Until then any package that is used in those
three bundles still needs to have a BUILD.bazel file so that they can be
referenced by the remaining webpack builds.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-22 19:00:29 -06:00
Alejandro Fernández Haro
b70c70c6ad
[API Docs] Fix --plugin filter (#147500) 2022-12-14 14:24:48 +00:00
spalger
52f2b33a07
[auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
spalger
42879f7656
[bazel] fix some BUILD.bazel file inconsistencies 2022-10-26 11:07:55 -05:00
Spencer
32491462a9
add kibana.jsonc files to existing packages (#138965)
* [packages] add kibana.jsonc files

* auto-migrate to kibana.jsonc

* support interactive pkg id selection too

* remove old codeowners entry

* skip codeowners generation when .github/CODEOWNERS doesn't exist

* fall back to format validation if user is offline

* update question style

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-09-08 13:31:57 -07:00
Alejandro Fernández Haro
27d93fdf69
[API Docs] Add @track-adoption (#138366)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: spalger <spencer@elastic.co>
2022-09-07 17:39:31 +02:00
Spencer
dcbe46ba55
[api-docs] automatically strip deleted doc files from the nav (#139878) 2022-09-01 08:11:02 -07:00
Tiago Costa
1cbf83f73c
chore(NA): remove src folder requirement from packages (part 2) (#138476)
* refact(NA): apply root_input_dir=src to each already created pkg

* refact(NA): update package generator

* fix(NA): correctly use rootDir

* fix(NA): use root input dir on latest introduced pkgs for jsts_transpiler macro

* chore(NA): merge with main

* chore(NA): first attempt to complete removal of src folder on a small group of pkgs

* Revert "chore(NA): first attempt to complete removal of src folder on a small group of pkgs"

This reverts commit b6f34b7530.

* chore(NA): remove src folder requirement from xpack pkgs

* chore(NA): remove src folder from analytics pkgs

* chore(NA): remove src folder from home pkgs

* chore(NA): remove src folder from shared_ux pkgs

* fix(NA): remove missing src folder inputs on sharedux pkg

* chore(NA): remove src folder from kbn-a* pkgs

* chore(NA): remove src folder from kbn-b* pkgs

* chore(NA): remove src folder from kbn-c* pkgs

* chore(NA): correct exclude pattern for each changed pkg

* chore(NA): remove src folder from kbn-y* pkgs

* chore(NA): remove src folder from kbn-e* pkgs

* chore(NA): remove src folder from kbn-f* and kbn-g* pkgs

* chore(NA): remove src folder from kbn-f* and kbn-g* pkgs

* chore(NA): remove src folder from kbn-h** pkgs

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Revert "chore(NA): remove src folder from kbn-h** pkgs"

This reverts commit dcdf72bcc1.

* fix(NA): grammar location

* test(NA): fix tests for kbn/config-schema

* test(NA): fix tests for kbn/config-schema

* chore(NA): multiple errors fixed

* chore(NA): remove kuery grammar fix

* fix(NA): @kbn/ace imports

* fix(NA): grammar location

* fix(NA): add missing files to tsconfigs

* [CI] Auto-commit changed files from 'node scripts/build_plugin_list_docs'

* chore(NA): complete tsconfigs

* Revert "chore(NA): complete tsconfigs"

This reverts commit f48c616864.

* chore(NA): remove src folder from kbn-core* pkgs

* chore(NA): remove src folder from kbn-u* pkgs

* chore(NA): remove src folder from kbn-ui-shared-deps* pkgs

* chore(NA): fix problems on core pkgs

* chore(NA): fix problems on core pkgs

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* fix(NA): shared_built_assets correct location'

* test(NA): update @kbn/optimizer integration snapshots

* chore(NA): remove src folder from kbn-t* p1 pkgs

* chore(NA): remove src folder from kbn-t* p2 pkgs

* chore(NA): update rootDir on utility types pkg

* chore(NA): include missing files on @kbn/test

* chore(NA): include missing files on @kbn/test

* fix(NA): new jest preset paths on @kbn/test

* chore(NA): fix eslint

* fix(NA): new jest preset paths on @kbn/test

* chore(NA): remove exclusion for mocks folde on @kbn/test

* fix(NA): several imports from target_node

* fix(NA): @kbn/test mocha and jest types clash

* chore(NA): remove src folder from kbn-storybook pkg

* chore(NA): remove src folder from kbn-stdio-dev-helpers pkg

* chore(NA): remove src folder from kbn-std pkg

* chore(NA): remove src folder from kbn-sort-pkg-json pkg

* chore(NA): remove src folder from kbn-some-dev-log and kbn-shared-ux-utility pkgs

* chore(NA): remove src folder from kbn-ux-storybook pkg

* chore(NA): remove src folder from kbn-shared-ux-services pkg

* chore(NA): remove src folder from kbn-shared-ux-components pkg

* chore(NA): remove src folder from kbn-shared-svg pkg

* chore(NA): remove src folder from kbn-server-http-tools pkg

* chore(NA): remove src folder from kbn-securitysolution-* pkgs

* chore(NA): remove src folder from kbn-r-* pkgs

* chore(NA): remove src folder from kbn-p* pkgs

* chore(NA): remove src folder from kbn-o* pkgs

* chore(NA): remove src folder from kbn-m* pkgs

* chore(NA): remove src folder from kbn-j,k,l* pkgs

* chore(NA): remove src folder from kbn-j,k,l* pkgs

* chore(NA): remove src folder from kbn-io-ts-utils* pkgs

* chore(NA): remove src folder from kbn-* pkgs except a few

* chore(NA): update @kbn/generate

* fix(NA): wrong exclusion on kbn-storybook

* chore(NA): remove src folder from kbn-monaco pkg

* chore(NA): remove src folder from kbn-interpreter pkg

* fix(NA): wrong exclusion on kbn-storybook

* chore(NA): update every require for target_*/src

* chore(NA): remover src folder from @kbn/handlebars

* fix(NA): license for @kbn/handlebars

* chore(NA): copy templates as part of the jsts_transpiler macro for @kbn/storybook

* chore(NA): update handlebars

* fix(NA): @kbn/plugin-generator import paths

* fix(NA): bundle sizes

* fix(NA): web bundle for @kbn/i18n-react

* Revert "fix(NA): bundle sizes"

This reverts commit 8aefe84fbc.

* Revert "Revert "fix(NA): bundle sizes""

This reverts commit e9d87d72a4.

* fix(NA): @kbn/docs-utils index.ts path expectation

* chore(NA): merge and solve conflicts with main

* fix(NA): relative import to index

* chore(NA): merge and solve conflicts with main

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* chore(NA): apply eslint fix

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-08-30 15:57:35 +01:00
Spencer
6c438b331c
[api-docs] follow the correct schema for frontmatter (#138348)
* [api-docs] follow the correct schema for frontmatter

* rename non-generated summary: usage

* fix yaml comment syntax
2022-08-10 17:17:50 -05:00
Tiago Costa
df8b62aa98
chore(NA): allow packages to not have an obligation for a src folder on packages (#138038)
* refact(NA): apply root_input_dir=src to each already created pkg

* refact(NA): update package generator

* fix(NA): correctly use rootDir

* fix(NA): use root input dir on latest introduced pkgs for jsts_transpiler macro

* chore(NA): merge with main

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-08-08 15:54:05 +01:00
Alejandro Fernández Haro
c3500c21e9
[IDM] Assign author: Kibana Core to packages owned by core (#137887) 2022-08-02 10:25:53 -07:00
Spencer
a3b2757e4e
[type-summarizer] reimplement for broader support (#135163)
* [type-summarizer] reimplement for broader support

* Enable sourceMaps in all packages

* include naming collision in summarizePackage test

* fix readmes

* remove unnecessary transient dependency

* remove code that was commented out

* remove outdated todo comment

* ensure errors triggered by untyped-exports are ligible

* remove unused import

* break out snippet generation from AstIndexer

* refactor several massive files into smaller pieces and add more inline docs

* fix typos

* update jest snapshots

* add sections to readme that points people to the useful parts of the source code along with a high-level overview of how the type-summarizer works

* remove --dump flag, it doesn't work

* use decName instead of calling names.get a second time

* include `export` as invalid name
2022-07-06 13:48:45 -05:00
Walter Rafelsberger
8c94def73e
[ML] Move aiops-utils package to x-pack/packages/ml. (#134985)
When we created the `aiops-utils` package originally, we were not aware that packages could also live within `x-pack`. Since `aiops` is a platinum feature and maintained by the ML team, this moves the package from `/packages` to `/x-pack/packages/ml`. The license header of the package files now match the `aiops` plugin again.
2022-06-24 19:37:02 +02:00
Spencer
f3d69b8197
[@kbn/dev-utils] break out more pieces (#132292)
* [@kbn/dev-utils] break out more pieces

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-05-17 11:19:20 -05:00
Alejandro Fernández Haro
060cdf6df2
[@kbn/docs-utils] Support ConstructSignatures (#131287) 2022-05-02 22:30:12 +02:00
Spencer
2a78f350e1
break out parts of @kbn/dev-utils (#130509)
* break out parts of @kbn/dev-utils

* autofix imports and kbn/pm dist

* update readme for @kbn/stdio-dev-helpers

* finish renames
2022-04-19 12:24:58 -05:00
spalger
bd8171c13e [plugins] use module ids to import across plugins 2022-04-16 01:19:05 -05:00
Tiago Costa
eb0ef19583
chore(NA): upgrades bazel rules nodejs to v5 (#129522)
* chore(NA): upgrade bazel into v5

* chore(NA): initial work to upgrade to rules v5

* chore(NA): remove @elastic/datemath jest unit test for eslint plugin imports

* chore(NA): removed packager tsc_wrapped added my mistake
2022-04-08 20:42:37 +01:00
Stacey Gammon
131021050c
Fix deprecations being incorrectly counted (#128985)
* Adjust logic to fix overcounting bad deprecations

* Update api docs

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-03-31 14:01:14 -04:00
Spencer
92d65484a5
[plugin-discovery] move logic to a package (#128684) 2022-03-29 13:19:58 -06:00
Rachel Shen
9d8f95f390
[shared-ux] Migrate redirect app links component (#124197) 2022-03-14 10:26:15 -07:00
Spencer
614139b8e5
[bazel] avoid a little boilerplate in packages (#126309)
* [bazel] avoid a little boilerplate for @types packages

* [bazel/ts] stop building sourcemaps since they're ignored
2022-02-24 12:43:12 -06:00
Stacey Gammon
3bbbbb9ed3
Don't include teams with no usage of due deprecations (#124268)
* Don't include teams that have 0 due deprecations

* Update api docs
2022-02-01 10:53:35 -07:00
Stacey Gammon
41c7521402
Add a new file to list deprecations that are due, and by team (#124056)
* Add another file to track deprecations due by team

* update docs

* add link to new page

* Update api docs after merging master
2022-01-31 16:02:39 -05:00
Stacey Gammon
2d982c0070
Update api docs (#123839)
* Support the docs scripts knowing which json files are specifically for dev docs.

* Update jest snapshot docs

* Update api docs
2022-01-27 09:48:49 -05:00
Dario Gieselaar
7f5e6c3d9f
[APM] Explicit return types for routes (#123266) 2022-01-25 03:28:56 -07:00
Stacey Gammon
af283e8a07
Don't count any ci stats coming from code in node_modules (#122600)
* ensure no stats are tracked that are coming from third party libraries

Update stats.ts

* Build api docs with new stats
2022-01-11 08:34:07 -05:00
Tiago Costa
64468b7a3e
chore(NA): splits types from code on @kbn/utils (#121924) 2021-12-23 03:18:10 +00:00
Stacey Gammon
4305732a45
Add plugin stats to count number of times eslint-disable is used. (#121818)
* add eslint disable count stats

* address code review comments
2021-12-21 20:36:26 -05:00
Stacey Gammon
cb588a3a15
Track unreferenced deprecated apis count (#121809)
* Track unreferenced deprecated apis count

* Update api docs
2021-12-21 15:34:53 -05:00
Tiago Costa
de5dd787b1
chore(NA): splits types from code on @kbn/dev-utils (#120531)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-12-07 20:12:18 +00:00
Tiago Costa
561031efd5
chore(NA): splits types from code on @kbn/docs-utils (#120533) 2021-12-06 22:01:36 +00:00
Stacey Gammon
6434762b4b
Fix broken link (#120410) 2021-12-03 15:47:10 -05:00
Tiago Costa
1b38b8ea15
chore(NA): splits types from code on @kbn/config (#120267) 2021-12-03 02:48:51 +00:00
Tyler Smalley
92a8636f0f
Upgrade Typescript to 4.3.5 (#104470)
Co-authored-by: Mikhail Shustov <restrry@gmail.com>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
Co-authored-by: CJ Cenizal <cj@cenizal.com>
Co-authored-by: Justin Kambic <justin.kambic@elastic.co>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Co-authored-by: Jean-Louis Leysens <jloleysens@gmail.com>
Co-authored-by: Kyle Pollich <kpollich1@gmail.com>
Co-authored-by: Xavier Mouligneau <189600+XavierM@users.noreply.github.com>
Co-authored-by: Kevin Qualters <kevin.qualters@elastic.co>
Co-authored-by: Candace Park <candace.park@elastic.co>
Co-authored-by: Brian Seeders <brian.seeders@elastic.co>
Co-authored-by: spalger <spencer@elastic.co>
2021-12-02 16:27:41 -08:00
Stacey Gammon
92d64e5361
Fix typo in api docs system (#119521)
* fix typo

* update api docs
2021-11-23 15:32:54 -05:00
Stacey Gammon
d7b9a49d41
Fix any counts in api docs code (#119392)
* Update code

* Update api docs
2021-11-23 11:11:14 -05:00
Stacey Gammon
45e9d51a44
Add pluginTeam to plugin API ci stats (#115007)
* Add pluginTeam to ci stats for easier higher level groupings

* Updated docs
2021-10-14 11:54:35 -04:00
Stacey Gammon
8e72e17648
api docs (#114565) 2021-10-11 19:46:01 -04:00
Stacey Gammon
6723fa583f
Add packages to our API documentation (#113564)
* Add packages

* Update docs

* Fix test and types

* debug heap size

* remove debug heap line

* updated docs
2021-10-06 17:02:57 -04:00
Stacey Gammon
20202f7e7d
Add a plugin directory page to the docs build (#112862)
* Write plugin directory doc as part of api docs build.

* Replace service folder with the new name for index patterns

* Updated docs

* small update

* update docs
2021-09-28 13:17:12 -04:00
Tyler Smalley
4681a80317
[DX] Upgrade prettier to v2.4.0 (#112359)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2021-09-19 22:34:30 -07:00
Stacey Gammon
98b7e99747
Clean up some of the API doc code (#111635)
* Clean up api doc infra

* updated docs

* Update api dics
2021-09-08 17:50:25 -04:00
Tiago Costa
7c4e4f507b
chore(NA): replace babel config files by inline presets by default in the jsts_transpiler rule (#110620)
* chore(NA): replace babel config files by inline presets by default in the js_ts_transpiler rule

* chore(NA): update @kbn/ace build to exclude worker file

* chore(NA): remove config file support

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-03 21:17:46 +01:00
Stacey Gammon
e097adbb6a
API Doc Fixes (#109685)
* Fixes

- Fix bad formatting of deprecated apis by plugin
- Collect deprecated apis recursively
- Include unreferenced apis in Deprecated apis by API page.

* Fix unreferenced dep list

* check in updated docs

* Fix the issue with saved objects management plugin docs not being included

* adding the new docs after fixing some docs missing

* update api docs
2021-08-24 13:42:23 -04:00