Skip to content

Commit dea020b

Browse files
committed
fix: modify the package type
1 parent bf0f613 commit dea020b

File tree

7 files changed

+44
-40
lines changed

7 files changed

+44
-40
lines changed

packages/class-validator/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "@vue-hooks-form/class-validator",
33
"version": "0.0.0",
4-
"type": "module",
54
"description": "class-validator resolver for vue-hooks-form",
65
"keywords": [
76
"class-validator",
@@ -10,12 +9,12 @@
109
"license": "MIT",
1110
"author": "Elone Hoo <hi@gmail.com>",
1211
"main": "./dist/index.js",
13-
"module": "./dist/index.cjs",
12+
"module": "./dist/index.mjs",
1413
"types": "./dist/index.d.ts",
1514
"exports": {
1615
".": {
1716
"require": "./dist/index.js",
18-
"import": "./dist/index.cjs"
17+
"import": "./dist/index.mjs"
1918
}
2019
},
2120
"files": [

packages/core/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "@vue-hooks-form/core",
3-
"type": "module",
43
"version": "0.0.0",
54
"description": "Vue Composition API for validating form.",
65
"author": "Elone Hoo <hi@elonehoo.me>",
@@ -14,12 +13,12 @@
1413
"dist"
1514
],
1615
"main": "./dist/index.js",
17-
"module": "./dist/index.cjs",
16+
"module": "./dist/index.mjs",
1817
"types": "./dist/index.d.ts",
1918
"exports": {
2019
".": {
2120
"require": "./dist/index.js",
22-
"import": "./dist/index.cjs"
21+
"import": "./dist/index.mjs"
2322
}
2423
},
2524
"scripts": {

packages/yup/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "@vue-hooks-form/yup",
33
"version": "0.0.0",
4-
"type": "module",
54
"description": "yup resolver for vue-hooks-form",
65
"keywords": [
76
"yup",
@@ -11,12 +10,12 @@
1110
"license": "MIT",
1211
"author": "Elone Hoo <hi@elonehoo.me>",
1312
"main": "./dist/index.js",
14-
"module": "./dist/index.cjs",
13+
"module": "./dist/index.mjs",
1514
"types": "./dist/index.d.ts",
1615
"exports": {
1716
".": {
1817
"require": "./dist/index.js",
19-
"import": "./dist/index.cjs"
18+
"import": "./dist/index.mjs"
2019
}
2120
},
2221
"files": [

playground/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12+
"@vue-hooks-form/class-validator": "workspace:*",
13+
"@vue-hooks-form/core": "workspace:*",
14+
"@vue-hooks-form/yup": "workspace:*",
1215
"@vitejs/plugin-vue": "^4.0.0",
1316
"vite": "^4.0.0",
1417
"vue-tsc": "^1.0.11"

playground/src/App.vue

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
<script setup lang="ts">
2-
import HelloWorld from './components/HelloWorld.vue'
3-
</script>
2+
import { createErrorHandler, createSubmitHandler, useForm } from '@vue-hooks-form/core'
3+
4+
const {
5+
register,
6+
formState: { errors },
7+
isExistInErrors,
8+
handleSubmit,
9+
} = useForm({
10+
mode: 'onChange'
11+
})
12+
13+
const onSubmit = createSubmitHandler((data:any) => {
14+
alert('submit success')
15+
})
416
17+
const onError = createErrorHandler((errors:any) => {
18+
alert('submit failed')
19+
})
20+
</script>
521
<template>
6-
<div>
7-
<a href="https://vitejs.dev" target="_blank">
8-
<img src="/vite.svg" class="logo" alt="Vite logo" />
9-
</a>
10-
<a href="https://vuejs.org/" target="_blank">
11-
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
12-
</a>
13-
</div>
14-
<HelloWorld msg="Vite + Vue" />
22+
{{ errors }}
23+
<form @submit.prevent="handleSubmit(onSubmit, onError)()">
24+
name: <input :="register('name', { required: true })"/>
25+
<button type="submit">submit</button>
26+
</form>
1527
</template>
16-
17-
<style scoped>
18-
.logo {
19-
height: 6em;
20-
padding: 1.5em;
21-
will-change: filter;
22-
}
23-
.logo:hover {
24-
filter: drop-shadow(0 0 2em #646cffaa);
25-
}
26-
.logo.vue:hover {
27-
filter: drop-shadow(0 0 2em #42b883aa);
28-
}
29-
</style>

pnpm-lock.yaml

Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
},
1717
"dependencies": {
1818
"@vitejs/plugin-vue": "^4.0.0",
19-
"@vue-hooks-form/class-validator": "workspace:^0.0.0",
20-
"@vue-hooks-form/core": "workspace:^0.0.0",
21-
"@vue-hooks-form/yup": "workspace:^0.0.0",
19+
"@vue-hooks-form/class-validator": "workspace:*",
20+
"@vue-hooks-form/core": "workspace:*",
21+
"@vue-hooks-form/yup": "workspace:*",
2222
"@vue/test-utils": "^2.2.7",
2323
"vite": "^4.0.4",
2424
"vitest": "^0.26.3"

0 commit comments

Comments
 (0)