Skip to content

Commit

Permalink
🐿️ Use tsup to bundle libs (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
nezouse authored Jun 13, 2024
1 parent 7d1069c commit cc9ba18
Show file tree
Hide file tree
Showing 10 changed files with 726 additions and 70 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ node_modules
# build
build
dist

*.tsbuildinfo
16 changes: 10 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@
"license": "MIT",
"version": "1.3.0",
"type": "module",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"scripts": {
"typecheck": "tsc --noEmit",
"lint": "pnpm typecheck && biome check .",
"lint:fix": "biome check . --apply",
"test": "pnpm pretest && vitest run",
"pretest": "pnpm run --filter @bytecodecaller/testing generate",
"build:cjs": "tsc -p tsconfig.build.json --outDir dist/cjs",
"build:esm": "tsc -p tsconfig.build.json --module esnext --target esnext --outDir dist/esm",
"build": "pnpm run clean && pnpm run build:esm && pnpm run build:cjs",
"build": "pnpm run clean && tsup",
"clean": "rm -rf dist"
},
"devDependencies": {
Expand All @@ -25,6 +28,7 @@
"@types/node": "^20.11.30",
"@viem/anvil": "^0.0.9",
"solc": "^0.8.25",
"tsup": "^8.1.0",
"tsx": "^4.7.1",
"typescript": "^5.4.2",
"viem": "^2.9.27",
Expand Down
5 changes: 1 addition & 4 deletions packages/core/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"baseUrl": "./src",
"outDir": "./dist",
"declaration": true
"composite": false
},
"exclude": ["test"]
}
3 changes: 1 addition & 2 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"compilerOptions": {
"moduleResolution": "node",
"resolveJsonModule": true,
"module": "Preserve",
"esModuleInterop": true,
"target": "esnext",
"sourceMap": true,
Expand Down
9 changes: 9 additions & 0 deletions packages/core/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'tsup'

export default defineConfig({
entry: ['src/index.ts'],
format: 'esm',
tsconfig: 'tsconfig.build.json',
sourcemap: true,
dts: true,
})
16 changes: 10 additions & 6 deletions packages/viem/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@
"license": "MIT",
"version": "1.2.0",
"type": "module",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"scripts": {
"typecheck": "tsc --noEmit",
"lint": "pnpm typecheck && biome check .",
"lint:fix": "biome check . --apply",
"test": "pnpm pretest && vitest run",
"pretest": "pnpm run --filter @bytecodecaller/testing generate",
"build:cjs": "tsc -p tsconfig.build.json --outDir dist/cjs",
"build:esm": "tsc -p tsconfig.build.json --module esnext --target esnext --outDir dist/esm",
"build": "pnpm run clean && pnpm run build:esm && pnpm run build:cjs",
"build": "pnpm run clean && tsup",
"clean": "rm -rf dist"
},
"dependencies": {
Expand All @@ -28,6 +31,7 @@
"devDependencies": {
"@biomejs/biome": "^1.6.1",
"@bytecodecaller/testing": "link:../testing",
"tsup": "^8.1.0",
"typescript": "^5.4.2",
"vitest": "^1.5.2"
}
Expand Down
5 changes: 1 addition & 4 deletions packages/viem/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"baseUrl": "./src",
"outDir": "./dist",
"declaration": true
"composite": false
},
"exclude": ["test"]
}
13 changes: 4 additions & 9 deletions packages/viem/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
{
"compilerOptions": {
"moduleResolution": "node",
"resolveJsonModule": true,
"module": "Preserve",
"esModuleInterop": true,
"target": "esnext",
"sourceMap": true,
"skipLibCheck": true,
"baseUrl": ".",
"rootDir": "./",
"strict": true
"strict": true,
"composite": true
},
"include": ["src", "test"],
"references": [
{
"path": "../core"
}
]
"include": ["src", "test"]
}
9 changes: 9 additions & 0 deletions packages/viem/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'tsup'

export default defineConfig({
entry: ['src/index.ts'],
format: 'esm',
tsconfig: 'tsconfig.build.json',
sourcemap: true,
dts: true,
})
Loading

0 comments on commit cc9ba18

Please sign in to comment.