Skip to content

Commit

Permalink
feat: ✨ support both esm & cjs
Browse files Browse the repository at this point in the history
* feat: ✨ build for esm and cjs

* chore(temp): πŸ”§ disable tests requirement for prerelease

* fix: πŸ› esm & cjs hybrid

* chore(version): πŸ”§ πŸ“¦οΈ prerelease version bump to 0.0.7-feat-support-commonjs.0

* fix: πŸ› esm & cjs hybrid

* chore(version): πŸ”§ πŸ“¦οΈ prerelease version bump to 0.0.7-feat-support-commonjs.1

---------

Co-authored-by: Evert De Spiegeleer <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 12, 2024
1 parent 4c1ba79 commit b58fa54
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
needs:
- lint
- build
- test
# - test
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
14 changes: 8 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/evertdespiegeleer/zhttp.git"
},
"version": "0.0.6",
"version": "0.0.7-feat-support-commonjs.1",
"type": "module",
"engines": {
"node": "^20.10.x",
Expand Down
20 changes: 13 additions & 7 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
"type": "git",
"url": "https://github.com/evertdespiegeleer/zhttp.git"
},
"version": "0.0.6",
"type": "module",
"main": "./dist/main.js",
"types": "./dist/main.d.ts",
"version": "0.0.7-feat-support-commonjs.1",
"main": "./dist/cjs/main.js",
"module": "./dist/esm/index.js",
"types": "./dist/esm/main.d.ts",
"exports": {
"import": "./dist/esm/main.js",
"require": "./dist/cjs/main.js"
},
"files": [
"./dist",
"./readme.md"
Expand All @@ -20,12 +24,14 @@
"npm": "^10.2.3"
},
"scripts": {
"build": "tsc -p tsconfig.build.json",
"build": "npm run build:esm && npm run build:cjs",
"build:esm": "tsc -p tsconfig.build.esm.json",
"build:cjs": "tsc -p tsconfig.build.cjs.json",
"test": "node --test --test-reporter spec --test-reporter-destination stdout --test-reporter junit --test-reporter-destination=./test-report.xml --loader ts-node/esm ./src/**/*.test.ts"
},
"dependencies": {
"@asteasolutions/zod-to-openapi": "^6.3.1",
"@zhttp/errors": "0.0.6",
"@zhttp/errors": "0.0.7-feat-support-commonjs.1",
"body-parser": "^1.20.2",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
Expand All @@ -51,7 +57,7 @@
"typescript": "^4.4.4"
},
"peerDependencies": {
"@zhttp/errors": "0.0.6",
"@zhttp/errors": "0.0.7-feat-support-commonjs.1",
"zod": "^3.22.4"
}
}
10 changes: 10 additions & 0 deletions packages/core/tsconfig.build.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist/cjs",
"module": "commonjs"
},
"include": ["src/**/*"],
"exclude": ["src/**/*.test.ts"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist"
"outDir": "./dist/esm"
},
"include": ["src/**/*"],
"exclude": ["src/**/*.test.ts"]
Expand Down
16 changes: 11 additions & 5 deletions packages/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
"type": "git",
"url": "https://github.com/evertdespiegeleer/zhttp.git"
},
"version": "0.0.6",
"type": "module",
"main": "./dist/main.js",
"types": "./dist/main.d.ts",
"version": "0.0.7-feat-support-commonjs.1",
"main": "./dist/cjs/main.js",
"module": "./dist/esm/index.js",
"types": "./dist/esm/main.d.ts",
"exports": {
"import": "./dist/esm/main.js",
"require": "./dist/cjs/main.js"
},
"files": [
"./dist",
"./readme.md"
Expand All @@ -20,7 +24,9 @@
"npm": "^10.2.3"
},
"scripts": {
"build": "tsc -p tsconfig.build.json",
"build": "npm run build:esm && npm run build:cjs",
"build:esm": "tsc -p tsconfig.build.esm.json",
"build:cjs": "tsc -p tsconfig.build.cjs.json",
"test": "echo \"No tests here :)\""
},
"dependencies": {
Expand Down
10 changes: 10 additions & 0 deletions packages/errors/tsconfig.build.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist/cjs",
"module": "commonjs"
},
"include": ["src/**/*"],
"exclude": ["src/**/*.test.ts"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist"
"outDir": "./dist/esm"
},
"include": ["src/**/*"],
"exclude": ["src/**/*.test.ts"]
Expand Down

0 comments on commit b58fa54

Please sign in to comment.