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

Transpile packages on demand, validate all TS projects #146212

Merged
merged 34 commits into from
Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
92014fb
[pkgs] remove pre-building of packages, transpile on demand
Dec 20, 2022
3f7b0d8
split up enterprise_search jest config
Dec 20, 2022
03c4adb
pick a larger default min so that new jest configs which are slow get…
Dec 21, 2022
0b5b910
Merge branch 'main' of github.com:elastic/kibana into implement/babel…
Dec 21, 2022
64e93e5
[CI] Auto-commit changed files from 'node scripts/ts_project_linter -…
kibanamachine Dec 21, 2022
5c7e5f8
move pkg resolution to resolver, config is too slow
Dec 21, 2022
4f19a49
Merge branch 'main' of github.com:elastic/kibana into implement/babel…
Dec 21, 2022
944a871
Merge branch 'implement/babel-register-packages' of github.com:spalge…
Dec 21, 2022
550cbf6
remove bazel reader
Dec 21, 2022
8489160
add info about weird imports
Dec 21, 2022
061aa53
Merge branch 'main' of github.com:elastic/kibana into implement/babel…
Dec 21, 2022
1f9f5af
move moduleNameMap config to resolver
Dec 21, 2022
11539b7
tweat ts project linter after review
Dec 21, 2022
a1c9999
Merge branch 'main' of github.com:elastic/kibana into implement/babel…
Dec 21, 2022
4d4d371
[CI] Auto-commit changed files from 'node scripts/ts_project_linter -…
kibanamachine Dec 21, 2022
b12756f
fix APM_AGENT_MOCK path
Dec 21, 2022
012e4db
Merge branch 'implement/babel-register-packages' of github.com:spalge…
Dec 21, 2022
7fc347a
restore default resolver for packages using "exports": {} maps
Dec 21, 2022
3509e0c
Merge branch 'main' of github.com:elastic/kibana into implement/babel…
Dec 21, 2022
d33e602
prioritize checks which auto-commit
Dec 21, 2022
f9c1278
Merge branch 'main' of github.com:elastic/kibana into implement/babel…
Dec 22, 2022
5a87970
remove ts upgrade
Dec 22, 2022
3dee99f
tsify parts of kbn-es which are breaking tsc
Dec 22, 2022
ae986f9
remove more errant ts-expect-error directives
Dec 22, 2022
eb76e97
Merge branch 'main' of github.com:elastic/kibana into implement/babel…
Dec 22, 2022
eb567bc
add descriptions to naked `@ts-expect-errors`, remove `@ts-ignore`s
Dec 22, 2022
45fbb45
fix typo in kbn-es
Dec 22, 2022
d0ef0e9
don't force the core team to use snapshots
Dec 22, 2022
7d97fbd
[CI] Auto-commit changed files from 'node scripts/ts_project_linter -…
kibanamachine Dec 22, 2022
ee3b0a8
remove "preserveSymlines" setting from tsconfig.base.json, no longer …
Dec 22, 2022
72571cc
Merge branch 'implement/babel-register-packages' of github.com:spalge…
Dec 22, 2022
fec17fb
Merge branch 'main' of github.com:elastic/kibana into implement/babel…
Dec 22, 2022
97be880
improve ftr types to deal with linting error
Dec 22, 2022
129d0fc
Merge branch 'main' into implement/babel-register-packages
Dec 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 2 additions & 3 deletions .bazelrc.common
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ query --incompatible_no_implicit_file_export
# Log configs
## different from default
common --color=yes
common --show_progress
common --noshow_progress
common --show_task_finish
common --show_progress_rate_limit=10
build --progress_report_interval=10
build --show_loading_progress
build --show_result=1
build --noshow_loading_progress

# Specifies desired output mode for running tests.
# Valid values are
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,14 @@ export async function pickTestGroupRunOrder() {
groups: [
{
type: UNIT_TYPE,
defaultMin: 3,
defaultMin: 60,
maxMin: JEST_MAX_MINUTES,
overheadMin: 0.2,
names: jestUnitConfigs,
},
{
type: INTEGRATION_TYPE,
defaultMin: 10,
defaultMin: 60,
maxMin: JEST_MAX_MINUTES,
overheadMin: 0.2,
names: jestIntegrationConfigs,
Expand Down Expand Up @@ -389,7 +389,7 @@ export async function pickTestGroupRunOrder() {
label: 'Jest Tests',
command: getRequiredEnv('JEST_UNIT_SCRIPT'),
parallelism: unit.count,
timeout_in_minutes: 60,
timeout_in_minutes: 120,
key: 'jest',
agents: {
queue: 'n2-4-spot',
Expand All @@ -409,7 +409,7 @@ export async function pickTestGroupRunOrder() {
label: 'Jest Integration Tests',
command: getRequiredEnv('JEST_INTEGRATION_SCRIPT'),
parallelism: integration.count,
timeout_in_minutes: 60,
timeout_in_minutes: 120,
key: 'jest-integration',
agents: {
queue: 'n2-4-spot',
Expand Down
8 changes: 4 additions & 4 deletions .buildkite/scripts/steps/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ export DISABLE_BOOTSTRAP_VALIDATION=false
.buildkite/scripts/bootstrap.sh

.buildkite/scripts/steps/checks/precommit_hook.sh
.buildkite/scripts/steps/checks/ftr_configs.sh
.buildkite/scripts/steps/checks/ts_projects.sh
.buildkite/scripts/steps/checks/bazel_packages.sh
.buildkite/scripts/steps/checks/verify_notice.sh
.buildkite/scripts/steps/checks/plugin_list_docs.sh
.buildkite/scripts/steps/checks/event_log.sh
.buildkite/scripts/steps/checks/telemetry.sh
.buildkite/scripts/steps/checks/ts_projects.sh
.buildkite/scripts/steps/checks/jest_configs.sh
.buildkite/scripts/steps/checks/plugin_list_docs.sh
.buildkite/scripts/steps/checks/bundle_limits.sh
.buildkite/scripts/steps/checks/i18n.sh
.buildkite/scripts/steps/checks/file_casing.sh
.buildkite/scripts/steps/checks/licenses.sh
.buildkite/scripts/steps/checks/plugins_with_circular_deps.sh
.buildkite/scripts/steps/checks/verify_notice.sh
.buildkite/scripts/steps/checks/test_projects.sh
.buildkite/scripts/steps/checks/test_hardening.sh
.buildkite/scripts/steps/checks/ftr_configs.sh
4 changes: 0 additions & 4 deletions .buildkite/scripts/steps/checks/bazel_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ set -euo pipefail

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
Expand Down
10 changes: 8 additions & 2 deletions .buildkite/scripts/steps/checks/ts_projects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@ set -euo pipefail

source .buildkite/scripts/common/util.sh

echo --- Check TypeScript Projects
node scripts/check_ts_projects
echo --- Run TS Project Linter
cmd="node scripts/ts_project_linter"
if is_pr && ! is_auto_commit_disabled; then
cmd="$cmd --fix"
fi

eval "$cmd"
check_for_changed_files "$cmd" true
8 changes: 4 additions & 4 deletions .buildkite/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"incremental": false,
"composite": false,
"emitDeclarationOnly": true,
"outDir": "./target/types",
"outDir": "target/types",
"types": ["node", "mocha"],
"paths": {
"#pipeline-utils": [".buildkite/pipeline-utils/index.ts"],
Expand All @@ -19,5 +16,8 @@
"scripts/**/*",
"pipelines/flaky_tests/groups.json",
"pull_requests.json"
],
"exclude": [
"target/**/*",
]
}
14 changes: 9 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
* Side Public License, v 1.
*/

require('@kbn/babel-register').install();

const Path = require('path');
const Fs = require('fs');

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

const APACHE_2_0_LICENSE_HEADER = `
/*
Expand Down Expand Up @@ -137,6 +139,7 @@ const DEV_DIRECTORIES = [
'__mocks__',
'__stories__',
'e2e',
'cypress',
'fixtures',
'ftr_e2e',
'integration_tests',
Expand Down Expand Up @@ -165,7 +168,7 @@ const DEV_FILE_PATTERNS = [
'mock.{js,ts,tsx}',
'_stubs.{js,ts,tsx}',
'{testHelpers,test_helper,test_utils}.{js,ts,tsx}',
'{postcss,webpack}.config.js',
'{postcss,webpack,cypress}.config.{js,ts}',
];

/** Glob patterns which describe dev-only code. */
Expand All @@ -175,10 +178,10 @@ const DEV_PATTERNS = [
...DEV_FILE_PATTERNS.map((file) => `{packages,src,x-pack}/**/${file}`),
'packages/kbn-interpreter/tasks/**/*',
'src/dev/**/*',
'x-pack/{dev-tools,tasks,scripts,test,build_chromium}/**/*',
'x-pack/plugins/*/server/scripts/**/*',
'x-pack/plugins/fleet/cypress',
'x-pack/{dev-tools,tasks,test,build_chromium}/**/*',
'x-pack/performance/**/*',
'src/setup_node_env/index.js',
'src/cli/dev.js',
];

/** Restricted imports with suggested alternatives */
Expand Down Expand Up @@ -599,6 +602,7 @@ module.exports = {
'x-pack/test/saved_object_api_integration/*/apis/**/*',
'x-pack/test/ui_capabilities/*/tests/**/*',
'x-pack/test/performance/**/*.ts',
'**/cypress.config.{js,ts}',
],
rules: {
'import/no-default-export': 'off',
Expand Down
17 changes: 12 additions & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -889,8 +889,10 @@ packages/kbn-apm-config-loader @elastic/kibana-core @vigneshshanmugam
packages/kbn-apm-synthtrace @elastic/apm-ui
packages/kbn-apm-utils @elastic/apm-ui
packages/kbn-axe-config @elastic/kibana-qa
packages/kbn-babel-plugin-synthetic-packages @elastic/kibana-operations
packages/kbn-babel-plugin-package-imports @elastic/kibana-operations
packages/kbn-babel-preset @elastic/kibana-operations
packages/kbn-babel-register @elastic/kibana-operations
packages/kbn-babel-transform @elastic/kibana-operations
packages/kbn-bazel-packages @elastic/kibana-operations
packages/kbn-bazel-runner @elastic/kibana-operations
packages/kbn-cases-components @elastic/response-ops
Expand All @@ -905,6 +907,7 @@ packages/kbn-config-mocks @elastic/kibana-core
packages/kbn-config-schema @elastic/kibana-core
packages/kbn-crypto @elastic/kibana-security
packages/kbn-crypto-browser @elastic/kibana-core
packages/kbn-cypress-config @elastic/kibana-operations
packages/kbn-datemath @elastic/kibana-app-services
packages/kbn-dev-cli-errors @elastic/kibana-operations
packages/kbn-dev-cli-runner @elastic/kibana-operations
Expand Down Expand Up @@ -954,13 +957,16 @@ packages/kbn-monaco @elastic/kibana-global-experience
packages/kbn-optimizer @elastic/kibana-operations
packages/kbn-optimizer-webpack-helpers @elastic/kibana-operations
packages/kbn-osquery-io-ts-types @elastic/security-asset-management
packages/kbn-package-map @elastic/kibana-operations
packages/kbn-peggy @elastic/kibana-operations
packages/kbn-peggy-loader @elastic/kibana-operations
packages/kbn-performance-testing-dataset-extractor @elastic/kibana-performance-testing
packages/kbn-plugin-discovery @elastic/kibana-operations
packages/kbn-plugin-generator @elastic/kibana-operations
packages/kbn-plugin-helpers @elastic/kibana-operations
packages/kbn-react-field @elastic/kibana-app-services
packages/kbn-repo-info @elastic/kibana-operations
packages/kbn-repo-path @elastic/kibana-operations
packages/kbn-repo-source-classifier @elastic/kibana-operations
packages/kbn-repo-source-classifier-cli @elastic/kibana-operations
packages/kbn-rison @elastic/kibana-operations
Expand Down Expand Up @@ -991,17 +997,17 @@ packages/kbn-spec-to-console @elastic/platform-deployment-management
packages/kbn-std @elastic/kibana-core
packages/kbn-stdio-dev-helpers @elastic/kibana-operations
packages/kbn-storybook @elastic/kibana-operations
packages/kbn-synthetic-package-map @elastic/kibana-operations
packages/kbn-telemetry-tools @elastic/kibana-core
packages/kbn-test @elastic/kibana-operations
packages/kbn-test-jest-helpers @elastic/kibana-operations
packages/kbn-test-subj-selector @elastic/kibana-operations
packages/kbn-timelion-grammar @elastic/kibana-visualizations
packages/kbn-tinymath @elastic/kibana-visualizations
packages/kbn-tooling-log @elastic/kibana-operations
packages/kbn-type-summarizer @elastic/kibana-operations
packages/kbn-type-summarizer-cli @elastic/kibana-operations
packages/kbn-type-summarizer-core @elastic/kibana-operations
packages/kbn-ts-project-linter @elastic/kibana-operations
packages/kbn-ts-project-linter-cli @elastic/kibana-operations
packages/kbn-ts-projects @elastic/kibana-operations
packages/kbn-ts-type-check-cli @elastic/kibana-operations
packages/kbn-typed-react-router-config @elastic/apm-ui
packages/kbn-ui-framework @elastic/kibana-design
packages/kbn-ui-shared-deps-npm @elastic/kibana-operations
Expand All @@ -1011,6 +1017,7 @@ packages/kbn-user-profile-components @elastic/kibana-security
packages/kbn-utility-types @elastic/kibana-core
packages/kbn-utility-types-jest @elastic/kibana-operations
packages/kbn-utils @elastic/kibana-operations
packages/kbn-web-worker-stub @elastic/kibana-operations
packages/kbn-yarn-lock-validator @elastic/kibana-operations
packages/shared-ux/avatar/solution @elastic/kibana-global-experience
packages/shared-ux/avatar/user_profile/impl @elastic/kibana-global-experience
Expand Down
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ report.asciidoc

# Automatically generated and user-modifiable
/tsconfig.refs.json
tsconfig.base.type_check.json
tsconfig.type_check.json
*.type_check.json

# Yarn local mirror content
.yarn-local-mirror
Expand All @@ -111,5 +110,5 @@ elastic-agent-*
fleet-server-*
elastic-agent.yml
fleet-server.yml
/packages/kbn-synthetic-package-map/synthetic-packages.json

/packages/kbn-package-map/package-map.json
/packages/kbn-synthetic-package-map/
11 changes: 9 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
exports_files(
[
"tsconfig.base.json",
"tsconfig.bazel.json",
"tsconfig.browser.json",
"tsconfig.browser_bazel.json",
"tsconfig.json",
"package.json"
"package.json",
".browserslistrc"
],
visibility = ["//visibility:public"]
)

config_setting(
name = "dist",
values = {
"define": "dist=true"
}
)
26 changes: 26 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,32 @@ THE SOFTWARE.
This product uses Noto fonts that are licensed under the SIL Open
Font License, Version 1.1.

---
This project includes code from the NX project, which is MIT licensed:

(The MIT License)

Copyright (c) 2017-2022 Narwhal Technologies Inc.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---
Vendored copy of `strip-json-comments` so that we can use it when npm modules are not available.
https://github.com/sindresorhus/strip-json-comments/tree/34b79cb0f1129aa85ef4b5c3292e8bc546984ef9
Expand Down
2 changes: 1 addition & 1 deletion dev_docs/operations/operations_landing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ layout: landing
{ pageId: "kibDevDocsOpsOptimizer" },
{ pageId: "kibDevDocsOpsBabelPreset" },
{ pageId: "kibDevDocsOpsTypeSummarizer" },
{ pageId: "kibDevDocsOpsBabelPluginSyntheticPackages" },
{ pageId: "kibDevDocsOpsBabelPluginPackageImports" },
{ pageId: "kibDevDocsOpsUiSharedDepsNpm" },
{ pageId: "kibDevDocsOpsUiSharedDepsSrc" },
{ pageId: "kibDevDocsOpsPluginDiscovery" },
Expand Down
2 changes: 1 addition & 1 deletion docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ NOTE:

node scripts/build_plugin_list_docs

You can update the template within node_modules/@kbn/dev-utils/target_node/src/plugin_list/generate_plugin_list.js
You can update the template within packages/kbn-dev-utils/src/plugin_list/generate_plugin_list.ts

////

Expand Down
14 changes: 8 additions & 6 deletions examples/bfetch_explorer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target/types",
"outDir": "target/types",
},
"include": [
"index.ts",
Expand All @@ -10,11 +10,13 @@
"server/**/*.ts",
"../../typings/**/*",
],
"exclude": [],
"exclude": [
"target/**/*",
],
"kbn_references": [
{ "path": "../../src/core/tsconfig.json" },
{ "path": "../developer_examples/tsconfig.json" },
{ "path": "../../src/plugins/bfetch/tsconfig.json" },
{ "path": "../../src/plugins/kibana_react/tsconfig.json" },
"@kbn/core",
"@kbn/developer-examples-plugin",
"@kbn/bfetch-plugin",
"@kbn/kibana-react-plugin",
]
}
22 changes: 14 additions & 8 deletions examples/controls_example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target/types"
"outDir": "target/types"
},
"include": [
"index.ts",
Expand All @@ -11,13 +11,19 @@
"server/**/*.ts",
"../../typings/**/*"
],
"exclude": [],
"exclude": [
"target/**/*",
],
"kbn_references": [
{ "path": "../../src/core/tsconfig.json" },
{ "path": "../developer_examples/tsconfig.json" },
{ "path": "../../src/plugins/data/tsconfig.json" },
{ "path": "../../src/plugins/controls/tsconfig.json" },
{ "path": "../../src/plugins/navigation/tsconfig.json" },
{ "path": "../../src/plugins/presentation_util/tsconfig.json" }
"@kbn/core",
"@kbn/developer-examples-plugin",
"@kbn/data-plugin",
"@kbn/controls-plugin",
"@kbn/navigation-plugin",
"@kbn/presentation-util-plugin",
"@kbn/shared-ux-page-kibana-template",
"@kbn/embeddable-plugin",
"@kbn/data-views-plugin",
"@kbn/es-query",
]
}
Loading