Skip to content

Commit 0731665

Browse files
author
markw65
committed
Use project references to subdivide the tsconfig
1 parent 9690e1a commit 0731665

12 files changed

+54
-19
lines changed

benchmark/tsconfig.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": "../tsconfig-base.json",
3+
"include": ["**/*.js"],
4+
"exclude": ["./vendor"],
5+
}

bin/tsconfig.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../tsconfig-base.json",
3+
"include": ["**/*.js"],
4+
"compilerOptions": {
5+
"outDir": "../build/ts-cli"
6+
},
7+
}

jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = {
1616
"**/*.test-d.ts",
1717
],
1818
"transform": {
19-
"^.+\\.ts$": ["ts-jest", { "tsconfig":"tsconfig-build.json" }],
19+
"^.+\\.ts$": ["ts-jest", { "tsconfig":"test/tsconfig.json" }],
2020
},
2121
"testTimeout": 20000,
2222
};

lib/.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"env": {
33
"commonjs": true
4+
},
5+
"parserOptions": {
6+
"project": ["lib/tsconfig.json"]
47
}
58
}

lib/tsconfig.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../tsconfig-base.json",
3+
"include": ["**/*.ts", "**/*.js"],
4+
"compilerOptions": {
5+
"types": [],
6+
}
7+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"examples": "node bin/peggy.js -c docs/js/options.js docs/js/examples.peggy",
2828
"set_version": "node ./tools/set_version",
2929
"lint": "eslint . --ext js,ts,mjs",
30-
"ts": "tsc --build tsconfig-build.json tsconfig.json test/tsconfig.json",
30+
"ts": "tsc --build tsconfig.json",
3131
"docs": "cd docs && npm run build",
3232
"test": "jest",
3333
"test:web": "cd web-test && npm test",

test/.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"mocha": true
55
},
66
"parserOptions": {
7-
"project": "test/tsconfig.json"
7+
"project": ["test/tsconfig.json", "test/tsconfig-cli.json"]
88
}
99
}

test/tsconfig-cli.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "../tsconfig-base.json",
3+
"include": ["./cli/**/*", "./types/**/*"],
4+
"exclude": ["./cli/fixtures/bad.js"],
5+
"compilerOptions": {
6+
"outDir": "../build/ts-cli"
7+
},
8+
"references": [
9+
{ "path": "../bin" },
10+
{ "path": "../lib" }
11+
]
12+
}

test/tsconfig.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"extends": "../tsconfig-base.json",
3-
"include": ["**/*.ts", "**/*.spec.js"],
4-
"compilerOptions": {
5-
"noEmit": true
6-
}
3+
"include": ["**/*.ts", "**/*.js"],
4+
"exclude": ["./cli/**/*", "./types/**/*"],
5+
"references": [
6+
{ "path": "../lib" },
7+
{ "path": "./tsconfig-cli.json" }
8+
]
79
}

tsconfig-base.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
"compilerOptions": {
33
"allowJs": true, /* Allow javascript files to be compiled. */
44
"checkJs": false, /* Report errors in .js files. */
5-
"declaration": false, /* Generates corresponding '.d.ts' file. */
5+
"composite": true,
6+
"declaration": true, /* Generates corresponding '.d.ts' file. */
7+
"declarationDir": "./build/tsd",
68
"declarationMap": false, /* Generates a sourcemap for each corresponding '.d.ts' file. */
79
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
810
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
@@ -14,7 +16,7 @@
1416
"sourceMap": true, /* Generates corresponding '.map' file. */
1517
"strict": true, /* Enable all strict type-checking options. */
1618
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
17-
// "lib": [], /* Specify library files to be included in the compilation. */
19+
"lib": ["ES2015"], /* Specify library files to be included in the compilation. */
1820

1921
/* over time we will enable these */
2022
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */

tsconfig-build.json

-4
This file was deleted.

tsconfig.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
2-
"extends": "./tsconfig-build.json",
3-
"compilerOptions": {
4-
"types": [],
5-
"noEmit": true
6-
},
7-
"exclude": ["./test/**/*"],
2+
"files": [],
3+
"include": [],
4+
"references": [
5+
{ "path":"./benchmark/tsconfig.json" },
6+
{ "path":"./lib/tsconfig.json" },
7+
{ "path":"./test/tsconfig.json" }
8+
]
89
}

0 commit comments

Comments
 (0)