Skip to content

Commit

Permalink
moving to tsup for building. checking output with @arethetypeswrong
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreardon committed May 27, 2024
1 parent b25f8ab commit 9810d69
Show file tree
Hide file tree
Showing 5 changed files with 625 additions and 151 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ jobs:
run: yarn install

# Validates project
- name: Typescript, prettier checks
- name: Typescript, prettier, dist checks
run: yarn check
24 changes: 14 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
"sideEffects": false,
"type": "module",
"exports": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.cjs",
"types": "./dist/esm/index.d.ts"
"types": {
"import": "./dist/index.d.js",
"require": "./dist/index.d.cjs"
},
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"config": {
"prettier_target": "src/**/*.ts test/**/*.ts"
Expand All @@ -33,36 +36,36 @@
],
"size-limit": [
{
"path": "./dist/esm/bind.js",
"path": "./dist/bind.js",
"limit": "95B"
},
{
"path": "./dist/esm/bind-all.js",
"path": "./dist/bind-all.js",
"limit": "211B"
}
],
"engines": {
"node": ">=18"
},
"scripts": {
"build": "yarn build:clean && yarn build:dist:esm && yarn build:dist:cjs",
"build": "yarn build:clean && yarn build:dist",
"build:clean": "rimraf dist",
"build:dist:esm": "tsc",
"build:dist:cjs": "esbuild ./src/* --outdir=./dist/cjs --format=cjs --out-extension:.js=.cjs",
"check": "yarn check:typescript && yarn check:prettier",
"build:dist": "tsup",
"check": "yarn check:typescript && yarn check:prettier && yarn check:dist",
"check:prettier": "prettier --debug-check $npm_package_config_prettier_target",
"check:typescript": "tsc --noEmit && tsc --noEmit --project ./test/tsconfig.json",
"check:dist": "attw --pack . --ignore-rules no-resolution",
"prettier:write": "prettier --write $npm_package_config_prettier_target",
"test": "yarn jest",
"test:size": "size-limit",
"prepublishOnly": "yarn build"
},
"dependencies": {},
"devDependencies": {
"@arethetypeswrong/cli": "^0.15.3",
"@size-limit/preset-small-lib": "^8.2.4",
"@types/jest": "^29.5.1",
"@types/node": "^18.16.0",
"esbuild": "^0.21.3",
"expect-type": "^0.15.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
Expand All @@ -71,6 +74,7 @@
"size-limit": "^8.2.4",
"ts-expect": "^1.3.0",
"ts-jest": "^29.1.0",
"tsup": "^8.0.2",
"typescript": "^5.0.4"
}
}
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"noImplicitOverride": true,
/* If transpiling with TypeScript: */
"module": "es2022",
"outDir": "dist/esm",
/* AND if you're building for a library: */
"declaration": true,
/* If your code runs in the DOM: */
Expand Down
10 changes: 10 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['src/*'],
bundle: false,
clean: true,
format: ['cjs', 'esm'],
dts: true,
tsconfig: './tsconfig.json',
});
Loading

0 comments on commit 9810d69

Please sign in to comment.