Skip to content

Commit 2ec7e63

Browse files
committed
fix: build command, some parts of docs
1 parent 6a48f72 commit 2ec7e63

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Then, e.g., in your code:
3939
})
4040

4141
// Perform the request, use `makeParse` to pass a transformer for the data
42-
const { data, error } = useFetch('https://httpbin.org/uuid', {
42+
const { data, error } = await useFetch('https://httpbin.org/uuid', {
4343
transform: makeParser(responseSchema),
4444
})
4545

@@ -59,7 +59,7 @@ Then, e.g., in your code:
5959
})
6060

6161
// Perform the request, use `makeParse` to pass a transformer for the data
62-
const { data, error } = useFetch('https://httpbin.org/ip', {
62+
const { data, error } = await useFetch('https://httpbin.org/ip', {
6363
transform: makeParser(responseSchema),
6464
})
6565

@@ -121,14 +121,12 @@ Then, e.g., in your code:
121121
122122
const parsedData = await parseDataAs({ test: 1 }, z.object({ test: z.number() )}))
123123
console.log(parsedData)
124-
// -> output: `1`
124+
// -> output: `{ test: 1 }`
125125
126126
127127
const parsedData = await parseDataAs({ test: "1" }, z.object({ test: z.string().transform(v => parseInt(v)) )}))
128128
console.log(parsedData)
129-
// -> output: `1` (we used `.transform` to ensure that we get a number)
130-
131-
129+
// -> output: `{ test: 1 }` (we used `.transform` to ensure that we get a number)
132130
```
133131
- Also works with async data, e.g., when fetching from another API or DB:
134132
```ts
@@ -165,3 +163,10 @@ This module exports:
165163

166164
[license-src]: https://img.shields.io/npm/l/@sidebase/nuxt-parse.svg
167165
[license-href]: https://npmjs.com/package/@sidebase/nuxt-parse
166+
167+
## Development
168+
169+
- Run `npm run test` to generate type stubs
170+
- Run `npm run lint` to run eslint
171+
- Run `npm run type` to run typescheck via tsc
172+
- Run `npm publish` to run build and publish the package

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"node": ">=16.14.2",
55
"npm": ">=8.5.0"
66
},
7-
"version": "0.2.6",
7+
"version": "0.2.7",
88
"description": "Parse, validate and transform data with confidence in nuxt using `zod`",
99
"scripts": {
1010
"test": "vitest --run",
1111
"lint": "eslint \"./src/**/*.{ts,tsx}\" --max-warnings=0",
1212
"type": "tsc --noEmit",
13-
"build": "rm -rf dist && tsup src/ --format cjs,esm --dts --dts-resolve",
13+
"prepack": "rm -rf dist && tsup src/ --format cjs,esm --dts --dts-resolve",
1414
"docs": "npx typedoc src"
1515
},
1616
"exports": {

0 commit comments

Comments
 (0)