Skip to content

Commit

Permalink
feat: bundle the library using tsup
Browse files Browse the repository at this point in the history
  • Loading branch information
cdimitroulas committed Nov 30, 2022
1 parent ddf0389 commit 083dcc2
Show file tree
Hide file tree
Showing 4 changed files with 511 additions and 15 deletions.
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"test:integration:browser": "jest --c test/jest.browser.config.js",
"clean": "rimraf lib",
"build": "yarn clean && tsc --build",
"build:new": "yarn clean && cross-env NODE_ENV=production tsup --splitting",
"prepare": "yarn simple-git-hooks init",
"release": "release publish",
"prepublishOnly": "yarn build && yarn test"
Expand Down Expand Up @@ -49,11 +50,13 @@
"body-parser": "^1.19.0",
"commitizen": "^4.2.4",
"cors": "^2.8.5",
"cross-env": "^7.0.3",
"cz-conventional-changelog": "3.3.0",
"express": "^4.17.3",
"express-rate-limit": "^6.3.0",
"follow-redirects": "^1.15.1",
"got": "^11.8.3",
"headers-polyfill": "^3.1.0",
"jest": "^27.4.3",
"node-fetch": "2.6.7",
"page-with": "^0.5.1",
Expand All @@ -62,18 +65,18 @@
"superagent": "^6.1.0",
"supertest": "^6.1.6",
"ts-jest": "^27.1.1",
"tsup": "^6.5.0",
"typescript": "4.4.4",
"wait-for-expect": "^3.0.2"
"wait-for-expect": "^3.0.2",
"web-encoding": "^1.1.5"
},
"dependencies": {
"@open-draft/until": "^1.0.3",
"@remix-run/web-fetch": "^4.3.1",
"@types/debug": "^4.1.7",
"debug": "^4.3.3",
"headers-polyfill": "^3.1.0",
"outvariant": "^1.2.1",
"strict-event-emitter": "^0.2.4",
"web-encoding": "^1.1.5"
"strict-event-emitter": "^0.2.4"
},
"keywords": [
"request",
Expand All @@ -93,4 +96,4 @@
"path": "./node_modules/cz-conventional-changelog"
}
}
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"strict": true,
"target": "ES5",
"target": "es2019",
"sourceMap": true,
"outDir": "lib",
"declaration": true,
Expand Down
59 changes: 59 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { defineConfig } from 'tsup'

export default defineConfig({
entry: [
"./src/index.ts",
"./src/interceptors/ClientRequest/index.ts",
"./src/interceptors/fetch/index.ts",
"./src/interceptors/XMLHttpRequest/index.ts"
],
outDir: "./lib"
})

// export default defineConfig([
// {
// name: 'index',
// entry: ['./src/index.ts'],
// outDir: './lib',
// format: ['esm'],
// legacyOutput: true,
// sourcemap: true,
// clean: true,
// bundle: true,
// splitting: true,
// dts: true,
// },
// {
// name: 'ClientRequest',
// entry: ['./src/interceptors/ClientRequest/index.ts'],
// outDir: './lib/interceptors/ClientRequest',
// format: ['esm'],
// legacyOutput: true,
// sourcemap: true,
// clean: true,
// bundle: true,
// splitting: true,
// dts: true,
// },
// {
// name: 'fetch',
// entry: ['./src/interceptors/fetch/index.ts'],
// outDir: './lib/interceptors/fetch',
// legacyOutput: true,
// format: ['esm'],
// bundle: true,
// sourcemap: true,
// splitting: true,
// dts: true,
// },
// {
// name: 'XMLHttpRequest',
// entry: ['./src/interceptors/XMLHttpRequest/index.ts'],
// format: ['esm'],
// outDir: './lib/interceptors/XMLHttpRequest',
// clean: true,
// sourcemap: true,
// splitting: true,
// dts: true,
// },
// ])
Loading

0 comments on commit 083dcc2

Please sign in to comment.