Skip to content

Commit 92e1ea5

Browse files
committed
build: changes build to microbundle
tsdx was failing with a typescript error but tsc passes. This seemed to be a false positive that I could do nothing about. This is probably why useModal was left out of the build. Trying microbundle as very easy to set up. Worked well.
1 parent 492eb44 commit 92e1ea5

File tree

5 files changed

+1204
-60
lines changed

5 files changed

+1204
-60
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
env:
16-
NODE_VERSION: 16
16+
NODE_VERSION: 14
1717

1818
jobs:
1919
build:

package.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
"license": "MIT",
77
"private": false,
88
"repository": "git://github.com/commitd/hooks.git",
9-
"main": "dist/index.js",
9+
"source": "src/index.ts",
10+
"main": "dist/hooks.js",
11+
"umd:main": "dist/hooks.umd.js",
12+
"module": "dist/hooks.esm.js",
1013
"typings": "dist/index.d.ts",
1114
"publishConfig": {
1215
"registry": "https://registry.npmjs.org/"
@@ -20,8 +23,8 @@
2023
"scripts": {
2124
"clean": "shx rm -rf dist",
2225
"commit": "cz",
23-
"start": "tsdx watch",
24-
"build": "tsdx build",
26+
"start": "microbundle watch",
27+
"build": "yarn clean ; microbundle",
2528
"test": "tsdx test",
2629
"lint": "tsdx lint",
2730
"size": "size-limit",
@@ -32,7 +35,7 @@
3235
"format:check": "prettier --check '**/{src,test,stories}/**/{*.js,*.ts,*.tsx,*.json,*.md,*.mdx}'",
3336
"deploy-storybook": "storybook-to-ghpages",
3437
"generate": "plop --plopfile ./generators/plopfile.js",
35-
"prepare": "husky install && tsdx build",
38+
"postinstall": "husky install",
3639
"semantic-release": "semantic-release"
3740
},
3841
"peerDependencies": {
@@ -48,10 +51,9 @@
4851
"semi": false,
4952
"singleQuote": true
5053
},
51-
"module": "dist/hooks.esm.js",
5254
"size-limit": [
5355
{
54-
"path": "dist/hooks.cjs.production.min.js",
56+
"path": "dist/hooks.js",
5557
"limit": "10 KB"
5658
},
5759
{
@@ -119,6 +121,7 @@
119121
"eslint-plugin-storybook": "^0.5.10",
120122
"husky": "^7.0.4",
121123
"jest-sonar-reporter": "^2.0.0",
124+
"microbundle": "^0.15.0",
122125
"plop": "^2.7.4",
123126
"prettier": "^2.1.2",
124127
"prettier-plugin-organize-imports": "^2.3.4",
@@ -132,8 +135,8 @@
132135
"storybook-dark-mode": "^1.0.9",
133136
"swr": "^0.3.8",
134137
"tsdx": "^0.14.1",
135-
"tslib": "^2.3.1",
136-
"typescript": "^4.6.3"
138+
"tslib": "^2.4.0",
139+
"typescript": "^4.6.4"
137140
},
138141
"dependencies": {}
139-
}
142+
}

src/usePoll/usePoll.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function usePoll(
2323
}, [callback])
2424

2525
useEffect(() => {
26-
let id: NodeJS.Timeout | null = null
26+
let id: ReturnType<typeof setTimeout> | null = null
2727

2828
function call() {
2929
const current = savedCallback.current

tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
3-
"include": ["src", "types"],
4-
"exclude": ["**/*.stories.tsx"],
3+
"exclude": ["**/*.stories.tsx", "**/*.test.ts"],
54
"compilerOptions": {
6-
"module": "esnext",
5+
"module": "ESnext",
6+
"target": "ESnext",
77
"lib": ["dom", "esnext"],
88
"importHelpers": true,
99
// output .d.ts declaration files for consumers

0 commit comments

Comments
 (0)