Skip to content

Commit d97b205

Browse files
authored
Merge pull request #213 from oleksandr-danylchenko/modernize-tsconfig-setup
Unified `tsconfig` and separated declarations emission step
2 parents 14c91c9 + 4c34012 commit d97b205

File tree

16 files changed

+214
-766
lines changed

16 files changed

+214
-766
lines changed

package-lock.json

Lines changed: 0 additions & 693 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/extension-tei/package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
"type": "module",
88
"scripts": {
99
"start": "vite --host",
10-
"build": "vite build",
10+
"build": "tsc -p tsconfig.build.json && vite build",
1111
"preview": "vite preview",
1212
"test": "echo 'Skipping tests in @recogito/text-annotator package'"
1313
},
1414
"main": "./dist/text-annotator-tei.umd.js",
1515
"module": "./dist/text-annotator-tei.es.js",
16-
"types": "./dist/src/index.d.ts",
16+
"types": "./dist/index.d.ts",
1717
"files": [
1818
"dist"
1919
],
2020
"exports": {
2121
".": {
22-
"types": "./dist/src/index.d.ts",
22+
"types": "./dist/index.d.ts",
2323
"import": "./dist/text-annotator-tei.es.js",
2424
"require": "./dist/text-annotator-tei.umd.js"
2525
},
@@ -28,11 +28,10 @@
2828
"devDependencies": {
2929
"CETEIcean": "^1.9.5",
3030
"typescript": "5.9.3",
31-
"vite": "^6.3.6",
32-
"vite-plugin-dts": "^4.5.4"
31+
"vite": "^6.3.6"
3332
},
3433
"peerDependencies": {
3534
"@annotorious/core": "^3.7.11",
3635
"@recogito/text-annotator": "3.3.3"
3736
}
38-
}
37+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
/* Declarations */
5+
"noEmit": false,
6+
"declaration": true,
7+
"emitDeclarationOnly": true,
8+
"rootDir": "src",
9+
"outDir": "dist"
10+
},
11+
"include": [
12+
"src"
13+
]
14+
}
Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
11
{
22
"compilerOptions": {
3-
"baseUrl": ".",
3+
"target": "ESNext",
4+
"lib": [
5+
"DOM",
6+
"ESNext"
7+
],
8+
/*
9+
`bundler` allows resolving the new `exports`/`imports` syntax in the `package.json`
10+
But it doesn't enforce specifying files extensions for imports.
11+
@see https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution-is-host-defined
12+
*/
13+
"module": "ESNext",
14+
"moduleResolution": "bundler",
15+
/* Linting */
16+
"allowJs": true,
417
"checkJs": true,
518
"esModuleInterop": true,
619
"forceConsistentCasingInFileNames": true,
7-
"incremental": false,
820
"isolatedModules": true,
9-
"module": "ESNext",
10-
"moduleResolution": "bundler",
11-
"outDir": "dist",
1221
"resolveJsonModule": true,
13-
"skipLibCheck": false,
14-
"sourceMap": true,
15-
"target": "ESNext",
16-
"verbatimModuleSyntax": true
22+
"skipLibCheck": true,
23+
"verbatimModuleSyntax": true,
24+
/* Declarations */
25+
"noEmit": true,
26+
/* Aliases */
27+
"baseUrl": "."
1728
},
18-
"include": ["./src/**/*", "./test/**/*"],
19-
"exclude": ["node_modules", "dist"]
20-
}
29+
"include": [
30+
"src",
31+
"test"
32+
],
33+
"exclude": [
34+
"node_modules",
35+
"dist"
36+
],
37+
"references": [
38+
{
39+
"path": "./tsconfig.node.json"
40+
}
41+
]
42+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compilerOptions": {
3+
"composite": true,
4+
/*
5+
`bundler` allows resolving the new `exports`/`imports` syntax in the `package.json`
6+
But it doesn't enforce specifying files extensions for imports.
7+
@see https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution-is-host-defined
8+
*/
9+
"module": "ESNext",
10+
"moduleResolution": "bundler",
11+
"noEmit": true,
12+
"skipLibCheck": true,
13+
"resolveJsonModule": true,
14+
"strict": true
15+
},
16+
"include": [
17+
"vite.config.ts",
18+
"package.json"
19+
]
20+
}
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
import { defineConfig } from 'vite';
2-
import dts from 'vite-plugin-dts';
32

43
export default defineConfig({
5-
plugins: [
6-
dts({
7-
insertTypesEntry: true,
8-
entryRoot: '.'
9-
})
10-
],
114
server: {
125
open: '/test/index.html'
136
},
147
build: {
8+
emptyOutDir: false,
159
sourcemap: true,
1610
lib: {
1711
entry: './src/index.ts',
@@ -25,4 +19,4 @@ export default defineConfig({
2519
}
2620
}
2721
}
28-
});
22+
});

packages/text-annotator-react/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "module",
88
"scripts": {
99
"start": "vite --host",
10-
"build": "tsc && vite build",
10+
"build": "tsc -p tsconfig.build.json && vite build",
1111
"preview": "vite preview",
1212
"test": "echo 'Skipping tests in @recogito/text-annotator-react package'"
1313
},
@@ -31,8 +31,7 @@
3131
"react-dom": "^19.2.0",
3232
"typescript": "5.9.3",
3333
"vite": "^6.3.6",
34-
"vite-plugin-dts": "^4.5.4",
35-
"vite-plugin-externalize-deps": "^0.10.0",
34+
"vite-plugin-externalize-deps": "^0.9.0",
3635
"vite-tsconfig-paths": "^5.1.4"
3736
},
3837
"peerDependencies": {
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
/* Declarations */
5+
"noEmit": false,
6+
"declaration": true,
7+
"emitDeclarationOnly": true,
8+
"rootDir": "src",
9+
"outDir": "dist"
10+
},
11+
"include": [
12+
"src"
13+
]
14+
}
Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,48 @@
11
{
22
"compilerOptions": {
3+
"target": "ESNext",
4+
"lib": [
5+
"DOM",
6+
"ESNext"
7+
],
8+
/*
9+
`bundler` allows resolving the new `exports`/`imports` syntax in the `package.json`
10+
But it doesn't enforce specifying files extensions for imports.
11+
@see https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution-is-host-defined
12+
*/
13+
"module": "ESNext",
14+
"moduleResolution": "bundler",
15+
/* Linting */
316
"allowJs": false,
417
"allowSyntheticDefaultImports": true,
5-
"baseUrl": ".",
6-
"declaration": true,
7-
"declarationDir": "dist",
8-
"declarationMap": true,
918
"esModuleInterop": true,
1019
"forceConsistentCasingInFileNames": true,
1120
"isolatedModules": true,
21+
"resolveJsonModule": true,
22+
"skipLibCheck": true,
23+
"useDefineForClassFields": true,
24+
/* React */
1225
"jsx": "react-jsx",
13-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
14-
"module": "ESNext",
15-
"moduleResolution": "bundler",
26+
/* Declarations, the `dts` plugin is used */
1627
"noEmit": true,
17-
"outDir": "dist",
28+
/* Aliases */
29+
"baseUrl": ".",
1830
"paths": {
19-
"@recogito/react": ["src/index.ts"]
20-
},
21-
"resolveJsonModule": true,
22-
"skipLibCheck": true,
23-
"sourceMap": true,
24-
"target": "ESNext",
25-
"useDefineForClassFields": true
31+
"@recogito/react": [
32+
"src/index.ts"
33+
]
34+
}
2635
},
27-
"include": ["src"],
28-
"exclude": ["node_modules", "dist"],
29-
"references": [{ "path": "./tsconfig.node.json" }],
30-
}
36+
"include": [
37+
"src"
38+
],
39+
"exclude": [
40+
"node_modules",
41+
"dist"
42+
],
43+
"references": [
44+
{
45+
"path": "./tsconfig.node.json"
46+
}
47+
]
48+
}
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
{
22
"compilerOptions": {
3-
"allowSyntheticDefaultImports": true,
43
"composite": true,
4+
/*
5+
`bundler` allows resolving the new `exports`/`imports` syntax in the `package.json`
6+
But it doesn't enforce specifying files extensions for imports.
7+
@see https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution-is-host-defined
8+
*/
59
"module": "ESNext",
6-
"moduleResolution": "node",
10+
"moduleResolution": "bundler",
11+
"noEmit": true,
12+
"skipLibCheck": true,
713
"resolveJsonModule": true,
14+
"strict": true
815
},
9-
"include": ["vite.config.ts", "package.json"]
10-
}
16+
"include": [
17+
"vite.config.ts",
18+
"package.json"
19+
]
20+
}

0 commit comments

Comments
 (0)