Skip to content

Commit

Permalink
feat(build): move TypeScript types into a single dist/types folder (#905
Browse files Browse the repository at this point in the history
)

* 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
  • Loading branch information
ghiscoding authored Feb 17, 2023
1 parent 19b8a35 commit b139c1e
Show file tree
Hide file tree
Showing 36 changed files with 179 additions and 165 deletions.
19 changes: 10 additions & 9 deletions packages/binding/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
"module": "dist/esm/index.js",
"exports": {
".": {
"browser": "./dist/esm/index.js",
"import": "./dist/esm/index.js",
"require": "./dist/commonjs/index.js"
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/esm/index.d.ts"
"./dist/types/index.d.ts"
]
}
},
"types": "dist/esm/index.d.ts",
"types": "dist/types/index.d.ts",
"publishConfig": {
"access": "public"
},
Expand All @@ -28,14 +28,15 @@
],
"scripts": {
"prebuild": "pnpm run clean",
"build": "pnpm run bundle:esm",
"build:incremental": "tsc --incremental",
"build": "pnpm run bundle:esm && tsc --declaration",
"build:incremental": "tsc --incremental --declaration",
"clean": "rimraf dist tsconfig.tsbuildinfo",
"dev": "tsc --incremental",
"dev": "pnpm build:incremental",
"prebundle": "pnpm run clean",
"bundle": "run-p bundle:commonjs bundle:esm",
"bundle": "run-p bundle:commonjs bundle:esm bundle:types",
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018"
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
"bundle:types": "tsc --emitDeclarationOnly --declarationMap --outDir dist/types"
},
"license": "MIT",
"author": "Ghislain B.",
Expand Down
2 changes: 1 addition & 1 deletion packages/binding/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compileOnSave": false,
"compilerOptions": {
"rootDir": "src",
"declarationDir": "dist/esm",
"declarationDir": "dist/types",
"outDir": "dist/esm",
"typeRoots": [
"typings"
Expand Down
15 changes: 8 additions & 7 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
"module": "dist/esm/index.js",
"exports": {
".": {
"browser": "./dist/esm/index.js",
"import": "./dist/esm/index.js",
"require": "./dist/commonjs/index.js"
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/esm/index.d.ts"
"./dist/types/index.d.ts"
]
}
},
"types": "dist/esm/index.d.ts",
"types": "dist/types/index.d.ts",
"license": "MIT",
"author": "Ghislain B.",
"homepage": "https://github.com/ghiscoding/slickgrid-universal",
Expand All @@ -39,16 +39,17 @@
],
"scripts": {
"prebuild": "pnpm run clean",
"build": "pnpm run bundle:esm",
"build": "pnpm run bundle:esm && tsc --declaration",
"postbuild": "run-s sass:build sass:copy",
"build:incremental": "tsc --incremental",
"build:incremental": "tsc --incremental --declaration",
"clean": "rimraf dist tsconfig.tsbuildinfo",
"dev": "node build-watch.mjs",
"prebundle": "pnpm run clean",
"bundle": "run-p bundle:commonjs bundle:esm",
"bundle": "run-p bundle:commonjs bundle:esm bundle:types",
"postbundle": "run-s sass:build sass:copy",
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
"bundle:types": "tsc --emitDeclarationOnly --declarationMap --outDir dist/types",
"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",
"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",
"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",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compileOnSave": false,
"compilerOptions": {
"rootDir": "src",
"declarationDir": "dist/esm",
"declarationDir": "dist/types",
"outDir": "dist/esm",
"typeRoots": [
"typings"
Expand Down
19 changes: 10 additions & 9 deletions packages/composite-editor-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
"module": "dist/esm/index.js",
"exports": {
".": {
"browser": "./dist/esm/index.js",
"import": "./dist/esm/index.js",
"require": "./dist/commonjs/index.js"
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/esm/index.d.ts"
"./dist/types/index.d.ts"
]
}
},
"types": "dist/esm/index.d.ts",
"types": "dist/types/index.d.ts",
"publishConfig": {
"access": "public"
},
Expand All @@ -28,14 +28,15 @@
],
"scripts": {
"prebuild": "pnpm run clean",
"build": "pnpm run bundle:esm",
"build:incremental": "tsc --incremental",
"build": "pnpm run bundle:esm && tsc --declaration",
"build:incremental": "tsc --incremental --declaration",
"clean": "rimraf dist tsconfig.tsbuildinfo",
"dev": "tsc --incremental",
"dev": "pnpm build:incremental",
"prebundle": "pnpm run clean",
"bundle": "run-p bundle:commonjs bundle:esm",
"bundle": "run-p bundle:commonjs bundle:esm bundle:types",
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018"
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
"bundle:types": "tsc --emitDeclarationOnly --declarationMap --outDir dist/types"
},
"license": "MIT",
"author": "Ghislain B.",
Expand Down
2 changes: 1 addition & 1 deletion packages/composite-editor-component/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compileOnSave": false,
"compilerOptions": {
"rootDir": "src",
"declarationDir": "dist/esm",
"declarationDir": "dist/types",
"outDir": "dist/esm",
"typeRoots": [
"typings"
Expand Down
19 changes: 10 additions & 9 deletions packages/custom-footer-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
"module": "dist/esm/index.js",
"exports": {
".": {
"browser": "./dist/esm/index.js",
"import": "./dist/esm/index.js",
"require": "./dist/commonjs/index.js"
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/esm/index.d.ts"
"./dist/types/index.d.ts"
]
}
},
"types": "dist/esm/index.d.ts",
"types": "dist/types/index.d.ts",
"publishConfig": {
"access": "public"
},
Expand All @@ -28,14 +28,15 @@
],
"scripts": {
"prebuild": "pnpm run clean",
"build": "pnpm run bundle:esm",
"build:incremental": "tsc --incremental",
"build": "pnpm run bundle:esm && tsc --declaration",
"build:incremental": "tsc --incremental --declaration",
"clean": "rimraf dist tsconfig.tsbuildinfo",
"dev": "tsc --incremental",
"dev": "pnpm build:incremental",
"prebundle": "pnpm run clean",
"bundle": "run-p bundle:commonjs bundle:esm",
"bundle": "run-p bundle:commonjs bundle:esm bundle:types",
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018"
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
"bundle:types": "tsc --emitDeclarationOnly --declarationMap --outDir dist/types"
},
"license": "MIT",
"author": "Ghislain B.",
Expand Down
2 changes: 1 addition & 1 deletion packages/custom-footer-component/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compileOnSave": false,
"compilerOptions": {
"rootDir": "src",
"declarationDir": "dist/esm",
"declarationDir": "dist/types",
"outDir": "dist/esm",
"typeRoots": [
"typings"
Expand Down
19 changes: 10 additions & 9 deletions packages/custom-tooltip-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
"module": "dist/esm/index.js",
"exports": {
".": {
"browser": "./dist/esm/index.js",
"import": "./dist/esm/index.js",
"require": "./dist/commonjs/index.js"
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/esm/index.d.ts"
"./dist/types/index.d.ts"
]
}
},
"types": "dist/esm/index.d.ts",
"types": "dist/types/index.d.ts",
"publishConfig": {
"access": "public"
},
Expand All @@ -28,14 +28,15 @@
],
"scripts": {
"prebuild": "pnpm run clean",
"build": "pnpm run bundle:esm",
"build:incremental": "tsc --incremental",
"build": "pnpm run bundle:esm && tsc --declaration",
"build:incremental": "tsc --incremental --declaration",
"clean": "rimraf dist tsconfig.tsbuildinfo",
"dev": "tsc --incremental",
"dev": "pnpm build:incremental",
"prebundle": "pnpm run clean",
"bundle": "run-p bundle:commonjs bundle:esm",
"bundle": "run-p bundle:commonjs bundle:esm bundle:types",
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018"
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
"bundle:types": "tsc --emitDeclarationOnly --declarationMap --outDir dist/types"
},
"license": "MIT",
"author": "Ghislain B.",
Expand Down
2 changes: 1 addition & 1 deletion packages/custom-tooltip-plugin/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compileOnSave": false,
"compilerOptions": {
"rootDir": "src",
"declarationDir": "dist/esm",
"declarationDir": "dist/types",
"outDir": "dist/esm",
"typeRoots": [
"typings"
Expand Down
19 changes: 10 additions & 9 deletions packages/empty-warning-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
"module": "dist/esm/index.js",
"exports": {
".": {
"browser": "./dist/esm/index.js",
"import": "./dist/esm/index.js",
"require": "./dist/commonjs/index.js"
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/esm/index.d.ts"
"./dist/types/index.d.ts"
]
}
},
"types": "dist/esm/index.d.ts",
"types": "dist/types/index.d.ts",
"publishConfig": {
"access": "public"
},
Expand All @@ -28,14 +28,15 @@
],
"scripts": {
"prebuild": "pnpm run clean",
"build": "pnpm run bundle:esm",
"build:incremental": "tsc --incremental",
"build": "pnpm run bundle:esm && tsc --declaration",
"build:incremental": "tsc --incremental --declaration",
"clean": "rimraf dist tsconfig.tsbuildinfo",
"dev": "tsc --incremental",
"dev": "pnpm build:incremental",
"prebundle": "pnpm run clean",
"bundle": "run-p bundle:commonjs bundle:esm",
"bundle": "run-p bundle:commonjs bundle:esm bundle:types",
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018"
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
"bundle:types": "tsc --emitDeclarationOnly --declarationMap --outDir dist/types"
},
"license": "MIT",
"author": "Ghislain B.",
Expand Down
2 changes: 1 addition & 1 deletion packages/empty-warning-component/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compileOnSave": false,
"compilerOptions": {
"rootDir": "src",
"declarationDir": "dist/esm",
"declarationDir": "dist/types",
"outDir": "dist/esm",
"typeRoots": [
"typings"
Expand Down
19 changes: 10 additions & 9 deletions packages/event-pub-sub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
"module": "dist/esm/index.js",
"exports": {
".": {
"browser": "./dist/esm/index.js",
"import": "./dist/esm/index.js",
"require": "./dist/commonjs/index.js"
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/esm/index.d.ts"
"./dist/types/index.d.ts"
]
}
},
"types": "dist/esm/index.d.ts",
"types": "dist/types/index.d.ts",
"publishConfig": {
"access": "public"
},
Expand All @@ -28,14 +28,15 @@
],
"scripts": {
"prebuild": "pnpm run clean",
"build": "pnpm run bundle:esm",
"build:incremental": "tsc --incremental",
"build": "pnpm run bundle:esm && tsc --declaration",
"build:incremental": "tsc --incremental --declaration",
"clean": "rimraf dist tsconfig.tsbuildinfo",
"dev": "tsc --incremental",
"dev": "pnpm build:incremental",
"prebundle": "pnpm run clean",
"bundle": "run-p bundle:commonjs bundle:esm",
"bundle": "run-p bundle:commonjs bundle:esm bundle:types",
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018"
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
"bundle:types": "tsc --emitDeclarationOnly --declarationMap --outDir dist/types"
},
"license": "MIT",
"author": "Ghislain B.",
Expand Down
2 changes: 1 addition & 1 deletion packages/event-pub-sub/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compileOnSave": false,
"compilerOptions": {
"rootDir": "src",
"declarationDir": "dist/esm",
"declarationDir": "dist/types",
"outDir": "dist/esm",
"typeRoots": [
"typings"
Expand Down
Loading

0 comments on commit b139c1e

Please sign in to comment.