Skip to content

Commit b139c1e

Browse files
authored
feat(build): move TypeScript types into a single dist/types folder (#905)
* chore: add exports.default in CJS/ESM hybrid mode - also remove browser, I don't think it's needed anymore since breakpoints are working fine now that we're exporting the main as ESM * feat(build): move TypeScript types into a single dist/types folder - prior to this PR, TS Types were added to both CJS/ESM folders, but 1 common dist/types folder is easier to find and will lower our published build size by a lot
1 parent 19b8a35 commit b139c1e

File tree

36 files changed

+179
-165
lines changed

36 files changed

+179
-165
lines changed

packages/binding/package.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
"module": "dist/esm/index.js",
77
"exports": {
88
".": {
9-
"browser": "./dist/esm/index.js",
109
"import": "./dist/esm/index.js",
11-
"require": "./dist/commonjs/index.js"
10+
"require": "./dist/commonjs/index.js",
11+
"default": "./dist/esm/index.js"
1212
},
1313
"./*": "./*"
1414
},
1515
"typesVersions": {
1616
"*": {
1717
"*": [
18-
"./dist/esm/index.d.ts"
18+
"./dist/types/index.d.ts"
1919
]
2020
}
2121
},
22-
"types": "dist/esm/index.d.ts",
22+
"types": "dist/types/index.d.ts",
2323
"publishConfig": {
2424
"access": "public"
2525
},
@@ -28,14 +28,15 @@
2828
],
2929
"scripts": {
3030
"prebuild": "pnpm run clean",
31-
"build": "pnpm run bundle:esm",
32-
"build:incremental": "tsc --incremental",
31+
"build": "pnpm run bundle:esm && tsc --declaration",
32+
"build:incremental": "tsc --incremental --declaration",
3333
"clean": "rimraf dist tsconfig.tsbuildinfo",
34-
"dev": "tsc --incremental",
34+
"dev": "pnpm build:incremental",
3535
"prebundle": "pnpm run clean",
36-
"bundle": "run-p bundle:commonjs bundle:esm",
36+
"bundle": "run-p bundle:commonjs bundle:esm bundle:types",
3737
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
38-
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018"
38+
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
39+
"bundle:types": "tsc --emitDeclarationOnly --declarationMap --outDir dist/types"
3940
},
4041
"license": "MIT",
4142
"author": "Ghislain B.",

packages/binding/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compileOnSave": false,
44
"compilerOptions": {
55
"rootDir": "src",
6-
"declarationDir": "dist/esm",
6+
"declarationDir": "dist/types",
77
"outDir": "dist/esm",
88
"typeRoots": [
99
"typings"

packages/common/package.json

+8-7
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
"module": "dist/esm/index.js",
77
"exports": {
88
".": {
9-
"browser": "./dist/esm/index.js",
109
"import": "./dist/esm/index.js",
11-
"require": "./dist/commonjs/index.js"
10+
"require": "./dist/commonjs/index.js",
11+
"default": "./dist/esm/index.js"
1212
},
1313
"./*": "./*"
1414
},
1515
"typesVersions": {
1616
"*": {
1717
"*": [
18-
"./dist/esm/index.d.ts"
18+
"./dist/types/index.d.ts"
1919
]
2020
}
2121
},
22-
"types": "dist/esm/index.d.ts",
22+
"types": "dist/types/index.d.ts",
2323
"license": "MIT",
2424
"author": "Ghislain B.",
2525
"homepage": "https://github.com/ghiscoding/slickgrid-universal",
@@ -39,16 +39,17 @@
3939
],
4040
"scripts": {
4141
"prebuild": "pnpm run clean",
42-
"build": "pnpm run bundle:esm",
42+
"build": "pnpm run bundle:esm && tsc --declaration",
4343
"postbuild": "run-s sass:build sass:copy",
44-
"build:incremental": "tsc --incremental",
44+
"build:incremental": "tsc --incremental --declaration",
4545
"clean": "rimraf dist tsconfig.tsbuildinfo",
4646
"dev": "node build-watch.mjs",
4747
"prebundle": "pnpm run clean",
48-
"bundle": "run-p bundle:commonjs bundle:esm",
48+
"bundle": "run-p bundle:commonjs bundle:esm bundle:types",
4949
"postbundle": "run-s sass:build sass:copy",
5050
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
5151
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
52+
"bundle:types": "tsc --emitDeclarationOnly --declarationMap --outDir dist/types",
5253
"sass-build-task:scss-compile:bootstrap": "sass src/styles/slickgrid-theme-bootstrap.scss dist/styles/css/slickgrid-theme-bootstrap.css --style=compressed --quiet-deps --no-source-map",
5354
"sass-build-task:scss-compile:material": "sass src/styles/slickgrid-theme-material.scss dist/styles/css/slickgrid-theme-material.css --style=compressed --quiet-deps --no-source-map",
5455
"sass-build-task:scss-compile:material-bare": "sass src/styles/slickgrid-theme-material.bare.scss dist/styles/css/slickgrid-theme-material.bare.css --style=compressed --quiet-deps --no-source-map",

packages/common/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compileOnSave": false,
44
"compilerOptions": {
55
"rootDir": "src",
6-
"declarationDir": "dist/esm",
6+
"declarationDir": "dist/types",
77
"outDir": "dist/esm",
88
"typeRoots": [
99
"typings"

packages/composite-editor-component/package.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
"module": "dist/esm/index.js",
77
"exports": {
88
".": {
9-
"browser": "./dist/esm/index.js",
109
"import": "./dist/esm/index.js",
11-
"require": "./dist/commonjs/index.js"
10+
"require": "./dist/commonjs/index.js",
11+
"default": "./dist/esm/index.js"
1212
},
1313
"./*": "./*"
1414
},
1515
"typesVersions": {
1616
"*": {
1717
"*": [
18-
"./dist/esm/index.d.ts"
18+
"./dist/types/index.d.ts"
1919
]
2020
}
2121
},
22-
"types": "dist/esm/index.d.ts",
22+
"types": "dist/types/index.d.ts",
2323
"publishConfig": {
2424
"access": "public"
2525
},
@@ -28,14 +28,15 @@
2828
],
2929
"scripts": {
3030
"prebuild": "pnpm run clean",
31-
"build": "pnpm run bundle:esm",
32-
"build:incremental": "tsc --incremental",
31+
"build": "pnpm run bundle:esm && tsc --declaration",
32+
"build:incremental": "tsc --incremental --declaration",
3333
"clean": "rimraf dist tsconfig.tsbuildinfo",
34-
"dev": "tsc --incremental",
34+
"dev": "pnpm build:incremental",
3535
"prebundle": "pnpm run clean",
36-
"bundle": "run-p bundle:commonjs bundle:esm",
36+
"bundle": "run-p bundle:commonjs bundle:esm bundle:types",
3737
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
38-
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018"
38+
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
39+
"bundle:types": "tsc --emitDeclarationOnly --declarationMap --outDir dist/types"
3940
},
4041
"license": "MIT",
4142
"author": "Ghislain B.",

packages/composite-editor-component/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compileOnSave": false,
44
"compilerOptions": {
55
"rootDir": "src",
6-
"declarationDir": "dist/esm",
6+
"declarationDir": "dist/types",
77
"outDir": "dist/esm",
88
"typeRoots": [
99
"typings"

packages/custom-footer-component/package.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
"module": "dist/esm/index.js",
77
"exports": {
88
".": {
9-
"browser": "./dist/esm/index.js",
109
"import": "./dist/esm/index.js",
11-
"require": "./dist/commonjs/index.js"
10+
"require": "./dist/commonjs/index.js",
11+
"default": "./dist/esm/index.js"
1212
},
1313
"./*": "./*"
1414
},
1515
"typesVersions": {
1616
"*": {
1717
"*": [
18-
"./dist/esm/index.d.ts"
18+
"./dist/types/index.d.ts"
1919
]
2020
}
2121
},
22-
"types": "dist/esm/index.d.ts",
22+
"types": "dist/types/index.d.ts",
2323
"publishConfig": {
2424
"access": "public"
2525
},
@@ -28,14 +28,15 @@
2828
],
2929
"scripts": {
3030
"prebuild": "pnpm run clean",
31-
"build": "pnpm run bundle:esm",
32-
"build:incremental": "tsc --incremental",
31+
"build": "pnpm run bundle:esm && tsc --declaration",
32+
"build:incremental": "tsc --incremental --declaration",
3333
"clean": "rimraf dist tsconfig.tsbuildinfo",
34-
"dev": "tsc --incremental",
34+
"dev": "pnpm build:incremental",
3535
"prebundle": "pnpm run clean",
36-
"bundle": "run-p bundle:commonjs bundle:esm",
36+
"bundle": "run-p bundle:commonjs bundle:esm bundle:types",
3737
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
38-
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018"
38+
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
39+
"bundle:types": "tsc --emitDeclarationOnly --declarationMap --outDir dist/types"
3940
},
4041
"license": "MIT",
4142
"author": "Ghislain B.",

packages/custom-footer-component/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compileOnSave": false,
44
"compilerOptions": {
55
"rootDir": "src",
6-
"declarationDir": "dist/esm",
6+
"declarationDir": "dist/types",
77
"outDir": "dist/esm",
88
"typeRoots": [
99
"typings"

packages/custom-tooltip-plugin/package.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
"module": "dist/esm/index.js",
77
"exports": {
88
".": {
9-
"browser": "./dist/esm/index.js",
109
"import": "./dist/esm/index.js",
11-
"require": "./dist/commonjs/index.js"
10+
"require": "./dist/commonjs/index.js",
11+
"default": "./dist/esm/index.js"
1212
},
1313
"./*": "./*"
1414
},
1515
"typesVersions": {
1616
"*": {
1717
"*": [
18-
"./dist/esm/index.d.ts"
18+
"./dist/types/index.d.ts"
1919
]
2020
}
2121
},
22-
"types": "dist/esm/index.d.ts",
22+
"types": "dist/types/index.d.ts",
2323
"publishConfig": {
2424
"access": "public"
2525
},
@@ -28,14 +28,15 @@
2828
],
2929
"scripts": {
3030
"prebuild": "pnpm run clean",
31-
"build": "pnpm run bundle:esm",
32-
"build:incremental": "tsc --incremental",
31+
"build": "pnpm run bundle:esm && tsc --declaration",
32+
"build:incremental": "tsc --incremental --declaration",
3333
"clean": "rimraf dist tsconfig.tsbuildinfo",
34-
"dev": "tsc --incremental",
34+
"dev": "pnpm build:incremental",
3535
"prebundle": "pnpm run clean",
36-
"bundle": "run-p bundle:commonjs bundle:esm",
36+
"bundle": "run-p bundle:commonjs bundle:esm bundle:types",
3737
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
38-
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018"
38+
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
39+
"bundle:types": "tsc --emitDeclarationOnly --declarationMap --outDir dist/types"
3940
},
4041
"license": "MIT",
4142
"author": "Ghislain B.",

packages/custom-tooltip-plugin/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compileOnSave": false,
44
"compilerOptions": {
55
"rootDir": "src",
6-
"declarationDir": "dist/esm",
6+
"declarationDir": "dist/types",
77
"outDir": "dist/esm",
88
"typeRoots": [
99
"typings"

packages/empty-warning-component/package.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
"module": "dist/esm/index.js",
77
"exports": {
88
".": {
9-
"browser": "./dist/esm/index.js",
109
"import": "./dist/esm/index.js",
11-
"require": "./dist/commonjs/index.js"
10+
"require": "./dist/commonjs/index.js",
11+
"default": "./dist/esm/index.js"
1212
},
1313
"./*": "./*"
1414
},
1515
"typesVersions": {
1616
"*": {
1717
"*": [
18-
"./dist/esm/index.d.ts"
18+
"./dist/types/index.d.ts"
1919
]
2020
}
2121
},
22-
"types": "dist/esm/index.d.ts",
22+
"types": "dist/types/index.d.ts",
2323
"publishConfig": {
2424
"access": "public"
2525
},
@@ -28,14 +28,15 @@
2828
],
2929
"scripts": {
3030
"prebuild": "pnpm run clean",
31-
"build": "pnpm run bundle:esm",
32-
"build:incremental": "tsc --incremental",
31+
"build": "pnpm run bundle:esm && tsc --declaration",
32+
"build:incremental": "tsc --incremental --declaration",
3333
"clean": "rimraf dist tsconfig.tsbuildinfo",
34-
"dev": "tsc --incremental",
34+
"dev": "pnpm build:incremental",
3535
"prebundle": "pnpm run clean",
36-
"bundle": "run-p bundle:commonjs bundle:esm",
36+
"bundle": "run-p bundle:commonjs bundle:esm bundle:types",
3737
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
38-
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018"
38+
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
39+
"bundle:types": "tsc --emitDeclarationOnly --declarationMap --outDir dist/types"
3940
},
4041
"license": "MIT",
4142
"author": "Ghislain B.",

packages/empty-warning-component/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compileOnSave": false,
44
"compilerOptions": {
55
"rootDir": "src",
6-
"declarationDir": "dist/esm",
6+
"declarationDir": "dist/types",
77
"outDir": "dist/esm",
88
"typeRoots": [
99
"typings"

packages/event-pub-sub/package.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
"module": "dist/esm/index.js",
77
"exports": {
88
".": {
9-
"browser": "./dist/esm/index.js",
109
"import": "./dist/esm/index.js",
11-
"require": "./dist/commonjs/index.js"
10+
"require": "./dist/commonjs/index.js",
11+
"default": "./dist/esm/index.js"
1212
},
1313
"./*": "./*"
1414
},
1515
"typesVersions": {
1616
"*": {
1717
"*": [
18-
"./dist/esm/index.d.ts"
18+
"./dist/types/index.d.ts"
1919
]
2020
}
2121
},
22-
"types": "dist/esm/index.d.ts",
22+
"types": "dist/types/index.d.ts",
2323
"publishConfig": {
2424
"access": "public"
2525
},
@@ -28,14 +28,15 @@
2828
],
2929
"scripts": {
3030
"prebuild": "pnpm run clean",
31-
"build": "pnpm run bundle:esm",
32-
"build:incremental": "tsc --incremental",
31+
"build": "pnpm run bundle:esm && tsc --declaration",
32+
"build:incremental": "tsc --incremental --declaration",
3333
"clean": "rimraf dist tsconfig.tsbuildinfo",
34-
"dev": "tsc --incremental",
34+
"dev": "pnpm build:incremental",
3535
"prebundle": "pnpm run clean",
36-
"bundle": "run-p bundle:commonjs bundle:esm",
36+
"bundle": "run-p bundle:commonjs bundle:esm bundle:types",
3737
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
38-
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018"
38+
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
39+
"bundle:types": "tsc --emitDeclarationOnly --declarationMap --outDir dist/types"
3940
},
4041
"license": "MIT",
4142
"author": "Ghislain B.",

packages/event-pub-sub/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compileOnSave": false,
44
"compilerOptions": {
55
"rootDir": "src",
6-
"declarationDir": "dist/esm",
6+
"declarationDir": "dist/types",
77
"outDir": "dist/esm",
88
"typeRoots": [
99
"typings"

0 commit comments

Comments
 (0)