Skip to content

Commit

Permalink
Introduce TS incremental builds & move src/test_utils to TS project (#…
Browse files Browse the repository at this point in the history
…76082)

* move test_helpers to the core

* create base tsconfig

* all tsconfigs use the base one

* use test_helpers exposed from the src/core

* move getFieldFormatsRegistry to data plugin

* add test_utils project

* compile types after checkout

* add a stub for platform tsconfig.json

* fix broken import

* fix broken path to the base config

* set tsBuildInfoFile for project without outDir

* do not commit tsbuildinfo file

* do not check output d.ts files

* fix type error

* use separate config to build types

* rollback changes to include paths

* mute import zone error

* rename files to avoid references to tsd

* do not use tsd for type tests

* include all ts files in project

* run buildRefs before type check to ensure the latest version

* store tsbuildinfo locally

* update paths to base config

* comment out core/tsconfig.json

* remove ui path

* fix wrong tsbuildinfo path
  • Loading branch information
mshustov committed Sep 3, 2020
1 parent 4c5e75e commit e9e0ca3
Show file tree
Hide file tree
Showing 117 changed files with 381 additions and 240 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@ apm.tsconfig.json
# release notes script output
report.csv
report.asciidoc

# TS incremental build cache
*.tsbuildinfo
2 changes: 1 addition & 1 deletion examples/alerting_example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/bfetch_explorer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/dashboard_embeddable_examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/developer_examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/embeddable_examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/embeddable_explorer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/routing_example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/search_examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/state_containers_examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/ui_action_examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/ui_actions_explorer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/url_generators_examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/url_generators_explorer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"kbn:watch": "node scripts/kibana --dev --logging.json=false",
"build:types": "tsc --p tsconfig.types.json",
"docs:acceptApiChanges": "node --max-old-space-size=6144 scripts/check_published_api_changes.js --accept",
"kbn:bootstrap": "node scripts/register_git_hook",
"kbn:bootstrap": "node scripts/build_ts_refs && node scripts/register_git_hook",
"spec_to_console": "node scripts/spec_to_console",
"backport-skip-ci": "backport --prDescription \"[skip-ci]\"",
"storybook": "node scripts/storybook",
Expand Down
7 changes: 5 additions & 2 deletions packages/elastic-datemath/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/elastic-datemath"
},
"include": [
"index.d.ts"
],
]
}
5 changes: 1 addition & 4 deletions packages/elastic-safer-lodash-set/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"scripts": {
"lint": "dependency-check --no-dev package.json set.js setWith.js fp/*.js",
"test": "npm run lint && tape test/*.js && npm run test:types",
"test:types": "./scripts/tsd.sh",
"test:types": "tsc --noEmit",
"update": "./scripts/update.sh",
"save_state": "./scripts/save_state.sh"
},
Expand All @@ -42,8 +42,5 @@
"ignore": [
"/lodash/"
]
},
"tsd": {
"directory": "test"
}
}
17 changes: 0 additions & 17 deletions packages/elastic-safer-lodash-set/scripts/tsd.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { expectType } from 'tsd';
import { set, setWith } from '../';
import { set, setWith } from '..';

const someObj: object = {};
const anyValue: any = 'any value';
Expand Down
10 changes: 5 additions & 5 deletions packages/elastic-safer-lodash-set/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/elastic-safer-lodash-set"
},
"include": [
"**/*"
"**/*",
],
"exclude": [
"**/*.test-d.ts"
]
}
1 change: 0 additions & 1 deletion packages/kbn-analytics/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ run(
proc.run(padRight(10, 'tsc'), {
cmd: 'tsc',
args: [
'--emitDeclarationOnly',
...(flags.watch ? ['--watch', '--preserveWatchOutput', 'true'] : []),
...(flags['source-maps'] ? ['--declarationMap', 'true'] : []),
],
Expand Down
7 changes: 4 additions & 3 deletions packages/kbn-analytics/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"declarationDir": "./target/types",
"emitDeclarationOnly": true,
"outDir": "./target/types",
"stripInternal": true,
"declarationMap": true,
"types": [
Expand All @@ -11,7 +12,7 @@
]
},
"include": [
"./src/**/*.ts"
"src/**/*"
],
"exclude": [
"target"
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-config-schema/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"declarationDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-dev-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target",
"target": "ES2019",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-es-archiver/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"declaration": true,
Expand Down
7 changes: 5 additions & 2 deletions packages/kbn-es/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-es"
},
"include": [
"src/**/*.ts"
"src/**/*"
]
}
5 changes: 4 additions & 1 deletion packages/kbn-expect/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-expect"
},
"include": [
"expect.js.d.ts"
]
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-i18n/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ run(
proc.run(padRight(10, 'tsc'), {
cmd: 'tsc',
args: [
'--emitDeclarationOnly',
...(flags.watch ? ['--watch', '--preserveWatchOutput', 'true'] : []),
...(flags['source-maps'] ? ['--declarationMap', 'true'] : []),
],
Expand Down
5 changes: 3 additions & 2 deletions packages/kbn-i18n/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": [
"src/**/*.ts",
"src/**/*.tsx",
Expand All @@ -11,7 +11,8 @@
],
"compilerOptions": {
"declaration": true,
"declarationDir": "./target/types",
"emitDeclarationOnly": true,
"outDir": "./target/types",
"types": [
"jest",
"node"
Expand Down
5 changes: 4 additions & 1 deletion packages/kbn-interpreter/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-interpreter"
},
"include": ["index.d.ts", "src/**/*.d.ts"]
}
2 changes: 1 addition & 1 deletion packages/kbn-monaco/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"declaration": true,
Expand Down
5 changes: 4 additions & 1 deletion packages/kbn-optimizer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-optimizer"
},
"include": [
"index.d.ts",
"src/**/*"
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-plugin-generator/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target",
"target": "ES2019",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-plugin-helpers/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target",
"declaration": true,
Expand Down
5 changes: 3 additions & 2 deletions packages/kbn-pm/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": [
"./index.d.ts",
"./src/**/*.ts",
"./dist/*.d.ts",
"./dist/*.d.ts"
],
"exclude": [],
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-pm",
"types": [
"jest",
"node"
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-release-notes/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"declaration": true,
Expand Down
5 changes: 4 additions & 1 deletion packages/kbn-telemetry-tools/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-telemetry-tools"
},
"include": [
"src/**/*",
]
Expand Down
7 changes: 5 additions & 2 deletions packages/kbn-test-subj-selector/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-test-subj-selector"
},
"include": [
"index.d.ts"
],
]
}
5 changes: 4 additions & 1 deletion packages/kbn-test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-test"
},
"include": [
"types/**/*",
"src/**/*",
Expand Down
5 changes: 4 additions & 1 deletion packages/kbn-ui-shared-deps/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-ui-shared-deps"
},
"include": [
"index.d.ts",
"theme.ts"
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-utility-types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"declarationDir": "./target",
Expand Down
Loading

0 comments on commit e9e0ca3

Please sign in to comment.