Skip to content

Commit

Permalink
Migrate to tsup (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
zoontek authored Apr 4, 2024
1 parent e4d844c commit 462e4f0
Show file tree
Hide file tree
Showing 5 changed files with 891 additions and 3,140 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.eslintrc.js
dist/
tsup.config.ts
vite.config.mts
vitest-setup.ts
website/
13 changes: 4 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@swan-io/use-form",
"version": "2.0.0-rc.2",
"version": "2.0.0",
"license": "MIT",
"description": "A simple, fast and opinionated form library for React & React Native focusing on UX.",
"author": "Mathieu Acthernoene <[email protected]>",
Expand Down Expand Up @@ -33,20 +33,14 @@
"registry": "https://registry.npmjs.org"
},
"scripts": {
"clean": "rm -rf dist",
"format": "prettier '**/*' --ignore-unknown --write",
"lint": "eslint --ext ts,tsx __tests__ src",
"test": "vitest --run",
"test:watch": "vitest --watch",
"typecheck": "tsc --noEmit",
"build": "yarn clean && microbundle -f cjs,es --tsconfig tsconfig.build.json",
"build": "tsup",
"prepack": "yarn typecheck && yarn lint && yarn test && yarn build"
},
"browserslist": [
">0.2%",
"not op_mini all",
"not dead"
],
"prettier": {
"printWidth": 100,
"plugins": [
Expand All @@ -61,17 +55,18 @@
},
"devDependencies": {
"@testing-library/react": "^14.2.1",
"@types/node": "^20.12.3",
"@types/react": "^18.2.63",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"jsdom": "^24.0.0",
"microbundle": "^0.15.1",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tsup": "^8.0.2",
"typescript": "^5.3.3",
"vitest": "^1.3.1"
}
Expand Down
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
"include": ["src", "__tests__"],
"compilerOptions": {
"module": "ESNext",
"target": "ES2018",
"lib": ["DOM", "DOM.Iterable", "ES2018"],
"target": "ES2019",
"lib": ["DOM", "DOM.Iterable", "ES2019"],
"jsx": "react",
"moduleResolution": "Node",
"outDir": "dist/",

"allowJs": false,
"declaration": true,
Expand Down
22 changes: 22 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Options, defineConfig } from "tsup";

const commonOptions: Partial<Options> = {
entry: { index: "src/index.ts" },
tsconfig: "./tsconfig.build.json",
target: "es2019",
sourcemap: true,
treeshake: true,
};

export default defineConfig([
{
...commonOptions,
clean: true,
format: "esm",
},
{
...commonOptions,
dts: true,
format: "cjs",
},
]);
Loading

0 comments on commit 462e4f0

Please sign in to comment.