Skip to content

Commit

Permalink
Generate both CommonJS and ES modules
Browse files Browse the repository at this point in the history
  • Loading branch information
cbenz committed Oct 31, 2020
1 parent 17f0e15 commit 70a9a4a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"name": "zod",
"version": "2.0.0-beta.15",
"description": "TypeScript-first schema declaration and validation library with static type inference",
"main": "./lib/src/index.js",
"types": "./lib/src/index.d.ts",
"main": "./lib/cjs/src/index.js",
"module": "./lib/esm/src/index.js",
"types": "./lib/esm/src/index.d.ts",
"files": [
"lib"
],
Expand Down Expand Up @@ -35,7 +36,7 @@
],
"scripts": {
"clean": "rm -rf lib/*",
"build": "yarn run clean && tsc --p tsconfig.package.json",
"build": "yarn run clean && tsc --p tsconfig.package.json && tsc --p tsconfig.commonjs.json",
"buildall": "yarn add typescript@3.4 && yarn build && yarn add typescript@3.5 && yarn build && yarn add typescript@3.6 && yarn build && yarn add typescript@3.7 && yarn build && yarn add typescript@3.8 && yarn build && yarn add typescript@3.9 && yarn build && yarn add typescript@4 && yarn build && yarn add typescript@3.4",
"buildallv2": "yarn add typescript@3.7 && yarn build && yarn add typescript@3.8 && yarn build && yarn add typescript@3.9 && yarn build && yarn add typescript@4.0 && yarn build && yarn add typescript@4.1 && yarn build && yarn add typescript@3.7",
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
Expand Down
7 changes: 7 additions & 0 deletions tsconfig.commonjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.package.json",
"compilerOptions": {
"module": "CommonJS",
"outDir": "./lib/cjs"
}
}
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
"dom"
],
"target": "es5",
"module": "commonjs",
"module": "ESNext",
"declaration": true,
"outDir": "./lib",
"outDir": "./lib/esm",
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"strict": true,
"skipLibCheck": true,
Expand Down

0 comments on commit 70a9a4a

Please sign in to comment.