Skip to content

Commit

Permalink
add kibana.jsonc files to existing packages (elastic#138965)
Browse files Browse the repository at this point in the history
* [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>
  • Loading branch information
2 people authored and guskovaue committed Sep 12, 2022
1 parent 5fdddb5 commit 35593a8
Show file tree
Hide file tree
Showing 401 changed files with 3,379 additions and 1,360 deletions.
9 changes: 8 additions & 1 deletion .buildkite/scripts/steps/checks/bazel_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@ source .buildkite/scripts/common/util.sh

echo --- Check Bazel Packages Manifest
node scripts/generate packages_build_manifest

check_for_changed_files 'node scripts/generate packages_build_manifest' true

echo --- Check Codeowners Manifest
if [ -f ".github/CODEOWNERS" ]; then
node scripts/generate codeowners
check_for_changed_files 'node scripts/generate codeowners' true
else
echo "skipping, no existing .github/CODEOWNERS file found"
fi
19 changes: 9 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
const Path = require('path');
const Fs = require('fs');

const globby = require('globby');
const normalizePath = require('normalize-path');
const { discoverPackageManifestPaths, Jsonc } = require('@kbn/bazel-packages');
const { REPO_ROOT } = require('@kbn/utils');

const APACHE_2_0_LICENSE_HEADER = `
/*
Expand Down Expand Up @@ -119,15 +121,10 @@ const VENN_DIAGRAM_HEADER = `
*/
`;

const packagePkgJsons = globby.sync('*/package.json', {
cwd: Path.resolve(__dirname, 'packages'),
absolute: true,
});

/** Packages which should not be included within production code. */
const DEV_PACKAGES = packagePkgJsons.flatMap((path) => {
const pkg = JSON.parse(Fs.readFileSync(path, 'utf8'));
return pkg.kibana && pkg.kibana.devOnly ? Path.dirname(Path.basename(path)) : [];
const DEV_PACKAGE_DIRS = discoverPackageManifestPaths(REPO_ROOT).flatMap((path) => {
const manifest = Jsonc.parse(Fs.readFileSync(path, 'utf8'));
return !!manifest.devOnly ? normalizePath(Path.relative(REPO_ROOT, Path.dirname(path))) : [];
});

/** Directories (at any depth) which include dev-only code. */
Expand All @@ -145,6 +142,7 @@ const DEV_DIRECTORIES = [
'integration_tests',
'manual_tests',
'mock',
'mocks',
'storybook',
'scripts',
'test',
Expand All @@ -153,6 +151,7 @@ const DEV_DIRECTORIES = [
'test_utilities',
'test_helpers',
'tests_client_integration',
'tsd_tests',
];

/** File patterns for dev-only code. */
Expand All @@ -171,7 +170,7 @@ const DEV_FILE_PATTERNS = [

/** Glob patterns which describe dev-only code. */
const DEV_PATTERNS = [
...DEV_PACKAGES.map((pkg) => `packages/${pkg}/**/*`),
...DEV_PACKAGE_DIRS.map((pkg) => `${pkg}/**/*`),
...DEV_DIRECTORIES.map((dir) => `{packages,src,x-pack}/**/${dir}/**/*`),
...DEV_FILE_PATTERNS.map((file) => `{packages,src,x-pack}/**/${file}`),
'packages/kbn-interpreter/tasks/**/*',
Expand Down
375 changes: 304 additions & 71 deletions .github/CODEOWNERS

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev_docs/contributing/code_walkthrough.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Managed by the operations team to contain Jenkins settings. Can be ignored by fo

## [.github](https://github.com/elastic/kibana/tree/main/.github)

Contains GitHub configuration settings. This file contains issue templates, and the [CODEOWNERS](https://github.com/elastic/kibana/blob/main/.github/CODEOWNERS) file. It's important for teams to keep the CODEOWNERS file up-to-date so the right team is pinged for a code owner review on PRs that edit certain files. Note that the `CODEOWNERS` file only exists on the main branch, and is not backported to other branches in the repo.
Contains GitHub configuration settings. This file contains issue templates, and the [CODEOWNERS](https://github.com/elastic/kibana/blob/main/.github/CODEOWNERS) file. It's important for teams to keep the CODEOWNERS file up-to-date so the right team is pinged for a code owner review on PRs that edit certain files. Note that the `CODEOWNERS` file only exists on the main branch, and is not backported to other branches in the repo. To aid in making sure the `CODEOWNERS` file is always up-to-date "packages" in the Kibana repo are required to have an "owner" defined, those owners are then injected into the CODEOWNERS files automatically by the `node scripts/generate codeowners` command.

## [api_docs](https://github.com/elastic/kibana/tree/main/api_docs)

Expand Down
8 changes: 4 additions & 4 deletions kbn_pm/src/commands/run_in_packages_command.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ export const command = {

const { discoverBazelPackages } = await import('@kbn/bazel-packages');
const packages = await discoverBazelPackages(REPO_ROOT);
for (const { pkg, normalizedRepoRelativeDir } of packages) {
for (const { manifest, pkg, normalizedRepoRelativeDir } of packages) {
if (
exclude.includes(pkg.name) ||
(include.length && !include.includes(pkg.name)) ||
!pkg.scripts ||
exclude.includes(manifest.id) ||
(include.length && !include.includes(manifest.id)) ||
!pkg?.scripts ||
!Object.hasOwn(pkg.scripts, scriptName)
) {
continue;
Expand Down
12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@
"@kbn/analytics-shippers-elastic-v3-server": "link:bazel-bin/packages/analytics/shippers/elastic_v3/server",
"@kbn/analytics-shippers-fullstory": "link:bazel-bin/packages/analytics/shippers/fullstory",
"@kbn/apm-config-loader": "link:bazel-bin/packages/kbn-apm-config-loader",
"@kbn/apm-synthtrace": "link:bazel-bin/packages/kbn-apm-synthtrace",
"@kbn/apm-utils": "link:bazel-bin/packages/kbn-apm-utils",
"@kbn/chart-icons": "link:bazel-bin/packages/kbn-chart-icons",
"@kbn/coloring": "link:bazel-bin/packages/kbn-coloring",
Expand Down Expand Up @@ -290,8 +289,6 @@
"@kbn/ebt-tools": "link:bazel-bin/packages/kbn-ebt-tools",
"@kbn/es-errors": "link:bazel-bin/packages/kbn-es-errors",
"@kbn/es-query": "link:bazel-bin/packages/kbn-es-query",
"@kbn/eslint-plugin-disable": "link:bazel-bin/packages/kbn-eslint-plugin-disable",
"@kbn/eslint-plugin-imports": "link:bazel-bin/packages/kbn-eslint-plugin-imports",
"@kbn/field-types": "link:bazel-bin/packages/kbn-field-types",
"@kbn/flot-charts": "link:bazel-bin/packages/kbn-flot-charts",
"@kbn/handlebars": "link:bazel-bin/packages/kbn-handlebars",
Expand All @@ -303,9 +300,6 @@
"@kbn/i18n-react": "link:bazel-bin/packages/kbn-i18n-react",
"@kbn/interpreter": "link:bazel-bin/packages/kbn-interpreter",
"@kbn/io-ts-utils": "link:bazel-bin/packages/kbn-io-ts-utils",
"@kbn/jsonc": "link:bazel-bin/packages/kbn-jsonc",
"@kbn/kibana-manifest-parser": "link:bazel-bin/packages/kbn-kibana-manifest-parser",
"@kbn/kibana-manifest-schema": "link:bazel-bin/packages/kbn-kibana-manifest-schema",
"@kbn/logging": "link:bazel-bin/packages/kbn-logging",
"@kbn/logging-mocks": "link:bazel-bin/packages/kbn-logging-mocks",
"@kbn/mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl",
Expand Down Expand Up @@ -665,6 +659,7 @@
"@jest/types": "^26",
"@kbn/ambient-storybook-types": "link:bazel-bin/packages/kbn-ambient-storybook-types",
"@kbn/ambient-ui-types": "link:bazel-bin/packages/kbn-ambient-ui-types",
"@kbn/apm-synthtrace": "link:bazel-bin/packages/kbn-apm-synthtrace",
"@kbn/axe-config": "link:bazel-bin/packages/kbn-axe-config",
"@kbn/babel-plugin-synthetic-packages": "link:bazel-bin/packages/kbn-babel-plugin-synthetic-packages",
"@kbn/babel-preset": "link:bazel-bin/packages/kbn-babel-preset",
Expand All @@ -682,13 +677,16 @@
"@kbn/es": "link:bazel-bin/packages/kbn-es",
"@kbn/es-archiver": "link:bazel-bin/packages/kbn-es-archiver",
"@kbn/eslint-config": "link:bazel-bin/packages/kbn-eslint-config",
"@kbn/eslint-plugin-disable": "link:bazel-bin/packages/kbn-eslint-plugin-disable",
"@kbn/eslint-plugin-eslint": "link:bazel-bin/packages/kbn-eslint-plugin-eslint",
"@kbn/eslint-plugin-imports": "link:bazel-bin/packages/kbn-eslint-plugin-imports",
"@kbn/expect": "link:bazel-bin/packages/kbn-expect",
"@kbn/find-used-node-modules": "link:bazel-bin/packages/kbn-find-used-node-modules",
"@kbn/generate": "link:bazel-bin/packages/kbn-generate",
"@kbn/get-repo-files": "link:bazel-bin/packages/kbn-get-repo-files",
"@kbn/import-resolver": "link:bazel-bin/packages/kbn-import-resolver",
"@kbn/jest-serializers": "link:bazel-bin/packages/kbn-jest-serializers",
"@kbn/kibana-manifest-schema": "link:bazel-bin/packages/kbn-kibana-manifest-schema",
"@kbn/managed-vscode-config": "link:bazel-bin/packages/kbn-managed-vscode-config",
"@kbn/managed-vscode-config-cli": "link:bazel-bin/packages/kbn-managed-vscode-config-cli",
"@kbn/optimizer": "link:bazel-bin/packages/kbn-optimizer",
Expand Down Expand Up @@ -1001,9 +999,7 @@
"@types/kbn__interpreter": "link:bazel-bin/packages/kbn-interpreter/npm_module_types",
"@types/kbn__io-ts-utils": "link:bazel-bin/packages/kbn-io-ts-utils/npm_module_types",
"@types/kbn__jest-serializers": "link:bazel-bin/packages/kbn-jest-serializers/npm_module_types",
"@types/kbn__jsonc": "link:bazel-bin/packages/kbn-jsonc/npm_module_types",
"@types/kbn__kbn-ci-stats-performance-metrics": "link:bazel-bin/packages/kbn-kbn-ci-stats-performance-metrics/npm_module_types",
"@types/kbn__kibana-manifest-parser": "link:bazel-bin/packages/kbn-kibana-manifest-parser/npm_module_types",
"@types/kbn__kibana-manifest-schema": "link:bazel-bin/packages/kbn-kibana-manifest-schema/npm_module_types",
"@types/kbn__logging": "link:bazel-bin/packages/kbn-logging/npm_module_types",
"@types/kbn__logging-mocks": "link:bazel-bin/packages/kbn-logging-mocks/npm_module_types",
Expand Down
4 changes: 0 additions & 4 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@ filegroup(
"//packages/kbn-interpreter:build",
"//packages/kbn-io-ts-utils:build",
"//packages/kbn-jest-serializers:build",
"//packages/kbn-jsonc:build",
"//packages/kbn-kibana-manifest-parser:build",
"//packages/kbn-kibana-manifest-schema:build",
"//packages/kbn-logging:build",
"//packages/kbn-logging-mocks:build",
Expand Down Expand Up @@ -500,8 +498,6 @@ filegroup(
"//packages/kbn-interpreter:build_types",
"//packages/kbn-io-ts-utils:build_types",
"//packages/kbn-jest-serializers:build_types",
"//packages/kbn-jsonc:build_types",
"//packages/kbn-kibana-manifest-parser:build_types",
"//packages/kbn-kibana-manifest-schema:build_types",
"//packages/kbn-logging:build_types",
"//packages/kbn-logging-mocks:build_types",
Expand Down
7 changes: 7 additions & 0 deletions packages/analytics/client/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/analytics-client",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
7 changes: 7 additions & 0 deletions packages/analytics/shippers/elastic_v3/browser/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/analytics-shippers-elastic-v3-browser",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
7 changes: 7 additions & 0 deletions packages/analytics/shippers/elastic_v3/common/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/analytics-shippers-elastic-v3-common",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
7 changes: 7 additions & 0 deletions packages/analytics/shippers/elastic_v3/server/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/analytics-shippers-elastic-v3-server",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
7 changes: 7 additions & 0 deletions packages/analytics/shippers/fullstory/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/analytics-shippers-fullstory",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-analytics-browser-internal",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-analytics-browser-mocks",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
7 changes: 7 additions & 0 deletions packages/core/analytics/core-analytics-browser/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-analytics-browser",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-analytics-server-internal",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-analytics-server-mocks",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
7 changes: 7 additions & 0 deletions packages/core/analytics/core-analytics-server/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-analytics-server",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-application-browser-internal",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-application-browser-mocks",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-application-browser",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-application-common",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
7 changes: 7 additions & 0 deletions packages/core/base/core-base-browser-internal/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-base-browser-internal",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
7 changes: 7 additions & 0 deletions packages/core/base/core-base-browser-mocks/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-base-browser-mocks",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
7 changes: 7 additions & 0 deletions packages/core/base/core-base-common-internal/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-base-common-internal",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
7 changes: 7 additions & 0 deletions packages/core/base/core-base-common/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-base-common",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
7 changes: 7 additions & 0 deletions packages/core/base/core-base-server-internal/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-base-server-internal",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
7 changes: 7 additions & 0 deletions packages/core/base/core-base-server-mocks/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-base-server-mocks",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-capabilities-browser-internal",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-capabilities-browser-mocks",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-capabilities-common",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-capabilities-server-internal",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-capabilities-server-mocks",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-capabilities-server",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/core-chrome-browser-internal",
"owner": "@elastic/kibana-core",
"runtimeDeps": [],
"typeDeps": []
}
Loading

0 comments on commit 35593a8

Please sign in to comment.