diff --git a/.dependency-cruiser.js b/.dependency-cruiser.js index 2292a3a84f..dfab3b9931 100644 --- a/.dependency-cruiser.js +++ b/.dependency-cruiser.js @@ -118,8 +118,7 @@ module.exports = { "from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration", from: { path: "^(src)", - pathNot: - "\\.(spec|test)\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\.md)$", + pathNot: ["^src/__tests__/", "^src/benchmarks/"], }, to: { dependencyTypes: ["npm-dev"], diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000000..2bf25de9d1 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,11 @@ +# Zod Pull Request + +**IMPORTANT:** Development of the next major version of Zod (`v4`) is currently ongoing. If your PR implements new functionality, it should target the `v4` branch, NOT the `master` branch. (If it's a bugfix, the `master` branch is fine.) + +## Overview + +Thank you for your contribution to our project! Before submitting your pull request, please ensure the following: + +- [ ] Your code changes are well-documented. +- [ ] You have tested your changes. +- [ ] You have updated any relevant documentation. diff --git a/.github/workflows/release-canary.yml b/.github/workflows/release-canary.yml index 61ece30e3c..119dbe054f 100644 --- a/.github/workflows/release-canary.yml +++ b/.github/workflows/release-canary.yml @@ -11,16 +11,19 @@ on: jobs: build_and_publish: runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: read + id-token: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - submodules: true - name: Set up Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 20 - name: Install dependencies run: | @@ -38,8 +41,9 @@ jobs: - id: publish name: Publish to NPM - uses: JS-DevTools/npm-publish@v1 + uses: JS-DevTools/npm-publish@v3 with: token: ${{ secrets.NPM_TOKEN }} dry-run: false tag: canary + provenance: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b0cb37e6ec..b0f1abcdf3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,19 +11,22 @@ on: jobs: build_and_publish: runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: read + id-token: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - submodules: true - name: Set up Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: - node-version: 16 - + node-version: 20 + - name: Checkout zod-deno - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: token: ${{ secrets.ZOD_BOT_TOKEN }} repository: colinhacks/zod-deno @@ -42,10 +45,11 @@ jobs: - id: publish name: Publish to NPM - uses: JS-DevTools/npm-publish@v1 + uses: JS-DevTools/npm-publish@v3 with: token: ${{ secrets.NPM_TOKEN }} dry-run: false + provenance: true - name: Post-publish if: steps.publish.outputs.type != 'none' @@ -91,7 +95,7 @@ jobs: - name: Create release if: steps.publish.outputs.type != 'none' id: create_release - uses: actions/create-release@latest + uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -105,7 +109,7 @@ jobs: - name: Create Deno release if: steps.publish.outputs.type != 'none' id: create_deno_release - uses: actions/create-release@latest + uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.ZOD_BOT_TOKEN }} with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0e6e5c2177..0405f5fd55 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,12 +13,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: ["18"] - typescript: ["4.5", "4.6", "4.7", "4.8", "4.9", "5.0"] + node: ["18", "20"] + typescript: ["4.5", "4.6", "4.7", "4.8", "4.9", "5.0", "5.3"] name: Test with TypeScript ${{ matrix.typescript }} on Node ${{ matrix.node }} steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - run: yarn install @@ -33,10 +33,10 @@ jobs: deno: ["v1.x"] name: Test with Deno ${{ matrix.deno }} steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 20 - uses: denolib/setup-deno@v2 with: deno-version: ${{ matrix.deno }} @@ -61,8 +61,8 @@ jobs: node: ["18"] name: Lint on Node ${{ matrix.node }} steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - run: yarn install diff --git a/ERROR_HANDLING.md b/ERROR_HANDLING.md index f2e0b8e628..21d05d2ccf 100644 --- a/ERROR_HANDLING.md +++ b/ERROR_HANDLING.md @@ -26,7 +26,7 @@ Each ZodError has an `issues` property that is an array of `ZodIssues`. Each iss `ZodIssue` is _not_ a class. It is a [discriminated union](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions). -The link above is the best way to learn about the concept. Discriminated unions are an ideal way to represent a data structures that may be one of many possible variants. You can see all the possible variants defined [here](./src/ZodError.ts). They are also described in the table below if you prefer. +The link above is the best way to learn about the concept. Discriminated unions are an ideal way to represent a data structures that may be one of many possible variants. You can see all the possible variants defined [here](https://github.com/colinhacks/zod/blob/master/src/ZodError.ts). They are also described in the table below if you prefer. _Every_ ZodIssue has these fields: diff --git a/README.md b/README.md index 490265fc86..53ea5f66f2 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,9 @@ - [Coercion for primitives](#coercion-for-primitives) - [Literals](#literals) - [Strings](#strings) - - [ISO datetimes](#iso-datetimes) + - [Datetimes](#datetimes) + - [Dates](#dates) + - [Times](#times) - [IP addresses](#ip-addresses) - [Numbers](#numbers) - [BigInts](#bigints) @@ -185,88 +187,146 @@ Sponsorship at any level is appreciated and encouraged. For individual developer
|
-
+
Speakeasy - speakeasyapi.dev + speakeasyapi.dev - SDKs, Terraform, Docs. SDKs, Terraform, Docs. |
-
-
-
- - Glow Wallet - - glow.app - - Your new favorite
- |
-
|
-
+
Deletype - deletype.com + deletype.com |
+ |
|
-
+
Trigger.dev - trigger.dev + trigger.dev - Effortless automation for developers. +Effortless automation for developers |
- |
|
-
+
Transloadit - transloadit.com + transloadit.com - Simple file processing for developers. +Simple file processing for developers |
+ |
|
-
+
Infisical - infisical.com + infisical.com - Open-source platform for secret Open-source platform for secret |
- |
|
-
+
Whop - whop.com + whop.com + + A marketplace for really cool internet products + |
+ |
|
+
+ + CryptoJobsList + + cryptojobslist.com + + The biggest list of crypto, blockchain and Web3 jobs + |
+
+
+ + Plain. + + plain.com + + How developers support their users + |
+
|
+
+ + Inngest + + inngest.com + + Serverless queues + durable workflows for TypeScript + |
+
+
+ + Storyblok + + storyblok.com + + The only headless CMS with a visual editor + |
+
|
+
+ + Mux + + mux.com + + The internet's video infrastructure + |
+
+
+ + Scalar + + scalar.com - A marketplace for really cool internet products. +Document, discover & test APIs with Scalar |
+
-
+
Numeric - numeric.io + numeric.io |
-
+
Marcato Partners - marcatopartners.com + marcatopartners.com |
|
|
-
+
Interval - interval.com + interval.com |
-
+
Seasoned Software - seasoned.cc + seasoned.cc |
-
+
Bamboo Creative - bamboocreative.nz + bamboocreative.nz |
|
-
+
Brandon Bayer - @flybayer, + @flybayer, creator of Blitz.js |
-
+
Jiří Brabec - @brabeji + @brabeji |
-
+
Alex Johansson - @alexdotjs + @alexdotjs |
|
|
-
+
Fungible Systems - fungible.systems + fungible.systems |
-
+
Adaptable - adaptable.io + adaptable.io |
-
+
Avana Wallet - avanawallet.com + avanawallet.com Solana non-custodial wallet |
|
|
-
+
Jason Lengstorf - learnwithjason.dev + learnwithjason.dev |
-
+
Global Illumination, Inc. - ill.inc + ill.inc |
- - + |
+
MasterBorn - masterborn.com + masterborn.com + + |
+
|
+
+ + Ryan Palmer + + @kronodeus + + |
+
+
+ + Michael Sweeney + + @overthemike + + |
+
+
+
+
+ + Nextbase + + usenextbase.com + + |
+ |
|
+
+ + Remotion + + remotion.dev + + |
+
+
+ + Connor Sinnott + + @ConnorSinnott + + |
+
+
+ + Mohammad-Ali A'râbi + + aerabi.com + + |
+ |
|
+
+ + Supatool + + supatool.io |