Skip to content

Commit 15d4af9

Browse files
authored
chore: migrate to TSUp (#446)
* chore: migrate to TSUp * chore: fix build
1 parent 081a228 commit 15d4af9

18 files changed

+217
-999
lines changed

package.json

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
"concurrently": "^8.2.1",
6767
"cpy-cli": "^5.0.0",
6868
"current-git-branch": "^1.1.0",
69+
"esbuild": "^0.18.13",
70+
"esbuild-plugin-file-path-extensions": "^1.0.0",
6971
"eslint": "^8.48.0",
7072
"eslint-config-prettier": "^9.0.0",
7173
"eslint-import-resolver-typescript": "^3.6.0",
@@ -86,18 +88,11 @@
8688
"react-dom": "^18.2.0",
8789
"react-dom-17": "npm:react-dom@^17.0.2",
8890
"rimraf": "^5.0.1",
89-
"rollup": "^3.23.0",
90-
"rollup-plugin-esbuild": "^5.0.0",
91-
"rollup-plugin-node-externals": "^6.1.0",
92-
"rollup-plugin-preserve-directives": "^0.2.0",
93-
"rollup-plugin-size": "^0.2.2",
94-
"rollup-plugin-terser": "^7.0.2",
95-
"rollup-plugin-visualizer": "^5.9.0",
96-
"rollup-preset-solid": "^2.0.1",
9791
"semver": "^7.3.8",
92+
"fs-extra": "^11.1.1",
9893
"solid-js": "^1.6.13",
9994
"stream-to-array": "^2.3.0",
100-
"tsup": "^7.0.0",
95+
"tsup": "^7.1.0",
10196
"type-fest": "^3.11.0",
10297
"typescript": "^5.2.2",
10398
"vitest": "^0.34.3",
@@ -110,11 +105,6 @@
110105
}
111106
]
112107
},
113-
"dependencies": {
114-
"@tanstack/store": "0.1.3",
115-
"fs-extra": "^11.1.1",
116-
"rollup-plugin-dts": "^5.3.0"
117-
},
118108
"pnpm": {
119109
"patchedDependencies": {
120110

packages/form-core/package.json

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,44 @@
1111
"url": "https://github.com/sponsors/tannerlinsley"
1212
},
1313
"type": "module",
14-
"types": "build/lib/index.d.ts",
15-
"main": "build/lib/index.legacy.cjs",
16-
"module": "build/lib/index.legacy.js",
14+
"types": "build/legacy/index.d.ts",
15+
"main": "build/legacy/index.cjs",
16+
"module": "build/legacy/index.js",
1717
"exports": {
1818
".": {
19-
"types": "./build/lib/index.d.ts",
20-
"import": "./build/lib/index.js",
21-
"require": "./build/lib/index.cjs",
22-
"default": "./build/lib/index.cjs"
19+
"import": {
20+
"types": "./build/modern/index.d.ts",
21+
"default": "./build/modern/index.js"
22+
},
23+
"require": {
24+
"types": "./build/modern/index.d.cts",
25+
"default": "./build/modern/index.cjs"
26+
}
2327
},
2428
"./package.json": "./package.json"
2529
},
2630
"sideEffects": false,
2731
"files": [
28-
"build/lib/*",
32+
"build",
2933
"src"
3034
],
35+
"nx": {
36+
"targets": {
37+
"test:build": {
38+
"dependsOn": [
39+
"build"
40+
]
41+
}
42+
}
43+
},
3144
"scripts": {
3245
"clean": "rimraf ./build && rimraf ./coverage",
3346
"test:eslint": "eslint --ext .ts,.tsx ./src",
3447
"test:types": "tsc --noEmit && vitest typecheck",
3548
"test:lib": "vitest run --coverage",
3649
"test:lib:dev": "pnpm run test:lib --watch",
3750
"test:build": "publint --strict",
38-
"build": "pnpm build:rollup && pnpm build:types",
39-
"build:rollup": "rollup --config rollup.config.js",
40-
"build:types": "tsc --emitDeclarationOnly"
51+
"build": "tsup"
4152
},
4253
"dependencies": {
4354
"@tanstack/store": "0.1.3"

packages/form-core/rollup.config.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/form-core/tsup.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @ts-check
2+
3+
import { defineConfig } from 'tsup'
4+
import { legacyConfig, modernConfig } from '../../scripts/getTsupConfig.js'
5+
6+
export default defineConfig([
7+
modernConfig({ entry: ['src/*.ts'] }),
8+
legacyConfig({ entry: ['src/*.ts'] }),
9+
])

packages/react-form/package.json

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,6 @@
1010
"type": "github",
1111
"url": "https://github.com/sponsors/tannerlinsley"
1212
},
13-
"type": "module",
14-
"types": "build/lib/index.d.ts",
15-
"main": "build/lib/index.legacy.cjs",
16-
"module": "build/lib/index.legacy.js",
17-
"exports": {
18-
".": {
19-
"types": "./build/lib/index.d.ts",
20-
"import": "./build/lib/index.js",
21-
"require": "./build/lib/index.cjs",
22-
"default": "./build/lib/index.cjs"
23-
},
24-
"./package.json": "./package.json"
25-
},
2613
"sideEffects": false,
2714
"scripts": {
2815
"clean": "rimraf ./build && rimraf ./coverage",
@@ -31,19 +18,38 @@
3118
"test:lib": "vitest run --coverage",
3219
"test:lib:dev": "pnpm run test:lib --watch",
3320
"test:build": "publint --strict",
34-
"build": "pnpm build:rollup && pnpm build:codemods && pnpm build:types",
35-
"build:rollup": "rollup --config rollup.config.js",
36-
"build:codemods": "cpy ../codemods/src/**/* ./build/codemods",
37-
"build:types": "tsc --emitDeclarationOnly"
21+
"build": "tsup"
3822
},
3923
"files": [
40-
"build/lib/*",
41-
"src",
42-
"build/codemods",
43-
"!build/codemods/jest.config.js",
44-
"!build/codemods/**/__testfixtures__",
45-
"!build/codemods/**/__tests__"
24+
"build",
25+
"src"
4626
],
27+
"type": "module",
28+
"types": "build/legacy/index.d.ts",
29+
"main": "build/legacy/index.cjs",
30+
"module": "build/legacy/index.js",
31+
"exports": {
32+
".": {
33+
"import": {
34+
"types": "./build/modern/index.d.ts",
35+
"default": "./build/modern/index.js"
36+
},
37+
"require": {
38+
"types": "./build/modern/index.d.cts",
39+
"default": "./build/modern/index.cjs"
40+
}
41+
},
42+
"./package.json": "./package.json"
43+
},
44+
"nx": {
45+
"targets": {
46+
"test:build": {
47+
"dependsOn": [
48+
"build"
49+
]
50+
}
51+
}
52+
},
4753
"devDependencies": {
4854
"@types/jscodeshift": "^0.11.3",
4955
"@types/react": "^18.0.14",

packages/react-form/rollup.config.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/react-form/tsup.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @ts-check
2+
3+
import { defineConfig } from 'tsup'
4+
import { legacyConfig, modernConfig } from '../../scripts/getTsupConfig.js'
5+
6+
export default defineConfig([
7+
modernConfig({ entry: ['src/*.ts', 'src/*.tsx'] }),
8+
legacyConfig({ entry: ['src/*.ts', 'src/*.tsx'] }),
9+
])

packages/vue-form/package.json

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@
1111
"url": "https://github.com/sponsors/tannerlinsley"
1212
},
1313
"type": "module",
14-
"types": "build/lib/index.d.ts",
15-
"main": "build/lib/index.legacy.cjs",
16-
"module": "build/lib/index.legacy.js",
14+
"types": "build/legacy/index.d.ts",
15+
"main": "build/legacy/index.cjs",
16+
"module": "build/legacy/index.js",
1717
"exports": {
1818
".": {
19-
"types": "./build/lib/index.d.ts",
20-
"import": "./build/lib/index.js",
21-
"require": "./build/lib/index.cjs",
22-
"default": "./build/lib/index.cjs"
19+
"import": {
20+
"types": "./build/modern/index.d.ts",
21+
"default": "./build/modern/index.js"
22+
},
23+
"require": {
24+
"types": "./build/modern/index.d.cts",
25+
"default": "./build/modern/index.cjs"
26+
}
2327
},
2428
"./package.json": "./package.json"
2529
},
@@ -35,10 +39,16 @@
3539
"test:3": "vue-demi-switch 3 && vitest",
3640
"test:lib:dev": "pnpm run test:lib --watch",
3741
"test:build": "publint --strict",
38-
"build": "pnpm build:rollup && pnpm build:codemods && pnpm build:types",
39-
"build:rollup": "rollup --config rollup.config.js",
40-
"build:codemods": "cpy ../codemods/src/**/* ./build/codemods",
41-
"build:types": "tsc --emitDeclarationOnly"
42+
"build": "tsup"
43+
},
44+
"nx": {
45+
"targets": {
46+
"test:build": {
47+
"dependsOn": [
48+
"build"
49+
]
50+
}
51+
}
4252
},
4353
"files": [
4454
"build",

packages/vue-form/rollup.config.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/vue-form/src/sfc.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/vue-form/src/tests/useForm.test.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference lib="dom" />
22
import { h, defineComponent, ref } from 'vue-demi'
3-
import { render } from '@testing-library/vue'
3+
import { render, waitFor } from '@testing-library/vue'
44
import '@testing-library/jest-dom'
55
import {
66
createFormFactory,
@@ -10,7 +10,6 @@ import {
1010
} from '../index'
1111
import userEvent from '@testing-library/user-event'
1212
import * as React from 'react'
13-
import { waitFor } from '@testing-library/react'
1413

1514
const user = userEvent.setup()
1615

packages/vue-form/tsup.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @ts-check
2+
3+
import { defineConfig } from 'tsup'
4+
import { legacyConfig, modernConfig } from '../../scripts/getTsupConfig.js'
5+
6+
export default defineConfig([
7+
modernConfig({ entry: ['src/*.ts'] }),
8+
legacyConfig({ entry: ['src/*.ts'] }),
9+
])

0 commit comments

Comments
 (0)