-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e276a1b
commit ad46f6e
Showing
8 changed files
with
58 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,6 @@ on: | |
pull_request: | ||
push: | ||
|
||
env: | ||
DENO_VERSION: v1.x | ||
|
||
jobs: | ||
test: | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
|
@@ -15,7 +12,7 @@ jobs: | |
- uses: actions/checkout@v3 | ||
- uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: ${{ env.DENO_VERSION }} | ||
deno-version: 1.x | ||
- run: deno fmt --check | ||
- run: deno test --coverage=./coverage | ||
- run: deno coverage ./coverage --lcov --output=coverage/lcov.info | ||
|
@@ -29,26 +26,12 @@ jobs: | |
env: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
|
||
publish: | ||
publish-jsr: | ||
needs: test | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: 7 | ||
- uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: ${{ env.DENO_VERSION }} | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: echo ${{ github.ref_name }} > VERSION | ||
- run: cat VERSION | ||
- run: deno run -A bin/build_npm.ts ${{ github.ref_name }} | ||
- run: npm publish --access=public | ||
working-directory: ./npm | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- uses: actions/checkout@v4 | ||
- run: npx jsr publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
# Zod Friendly Forms | ||
|
||
[](https://deno.land/x/zod_ff) | ||
[](https://www.npmjs.com/package/zod-ff) | ||
[](https://jsr.io/@jmondi/zod-friendly-forms) | ||
[](https://jsr.io/@jmondi/zod-friendly-forms) | ||
[](https://github.com/jasonraimondi/zod-friendly-forms) | ||
[](https://codeclimate.com/github/jasonraimondi/zod-friendly-forms/test_coverage) | ||
[](https://www.npmjs.com/package/zod-ff) | ||
|
||
Returns an object containing `errors` and `validData`. The `errors` object | ||
contains user-friendly error messages, making it easy to display validation | ||
|
@@ -16,13 +15,14 @@ submissions. | |
## Install (npm) | ||
|
||
```bash | ||
pnpm add zod-ff zod | ||
pnpm add zod | ||
pnpm dlx jsr add @jmondi/zod-friendly-forms | ||
``` | ||
|
||
### Deno | ||
|
||
```ts | ||
import { parseForm } from "https://deno.land/x/zod_ff"; | ||
```bash | ||
deno add @jmondi/zod-friendly-forms | ||
``` | ||
|
||
## Usage | ||
|
@@ -40,7 +40,7 @@ When you're ready to validate your input data, go ahead and run the `parseForm` | |
function. If there are any errors, they will be available by input key. | ||
|
||
```ts | ||
import { parseForm } from "zod-ff"; | ||
import { parseForm } from "@jmondi/zod-friendly-forms"; | ||
|
||
const data = { | ||
email: "invalid-email", | ||
|
@@ -57,7 +57,7 @@ If errors are undefined, the input was valid. A returned `validData` object will | |
be typed with your response. | ||
|
||
```ts | ||
import { parseForm } from "zod-ff"; | ||
import { parseForm } from "@jmondi/zod-friendly-forms"; | ||
|
||
const data = { | ||
email: "[email protected]", | ||
|
@@ -117,7 +117,7 @@ This library will work on the server or client, in any framework. | |
```html | ||
<script lang="ts"> | ||
import { z } from "zod"; | ||
import { parseForm } from "zod-ff"; | ||
import { parseForm } from "@jmondi/zod-friendly-forms"; | ||
import { handleLogin } from "./my-login-function"; | ||
|
@@ -173,7 +173,7 @@ This library will work on the server or client, in any framework. | |
```ts | ||
import React, { useState } from "react"; | ||
import { z } from "zod"; | ||
import { parseForm } from "zod-ff"; | ||
import { parseForm } from "@jmondi/zod-friendly-forms"; | ||
import { handleLogin } from "./my-login-function"; | ||
|
||
const LoginSchema = z.object({ | ||
|
@@ -319,7 +319,3 @@ export default { | |
}; | ||
</script> | ||
``` | ||
|
||
[deno-package]: https://deno.land/x/zod_ff | ||
[npm-package]: https://www.npmjs.com/package/zod-ff | ||
[zod]: https://github.com/colinhacks/zod |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { z } from "https://deno.land/x/zod@v3.22.4/mod.ts"; | ||
export { z } from "npm:zod@3.22.4"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters