-
Notifications
You must be signed in to change notification settings - Fork 26
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
0 parents
commit 63eee96
Showing
18 changed files
with
2,199 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
playground |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended" | ||
], | ||
"plugins": ["@typescript-eslint", "prettier"], | ||
"rules": { | ||
"eol-last": ["error", "always"], | ||
// "no-console": ["error"], | ||
|
||
// typescript | ||
"@typescript-eslint/ban-types": "off", | ||
"@typescript-eslint/no-explicit-any": "off" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
dist | ||
|
||
.DS_STORE | ||
|
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
shamefully-hoist=true |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/playground |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"singleQuote": true, | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"trailingComma": "all" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
}, | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
### Quickstart | ||
|
||
```vue | ||
<script setup lang="ts"> | ||
import { useForm } from '@vue-composable-form/core' | ||
const { | ||
values | ||
} = useForm({ | ||
initialValues: { | ||
firstName: '', | ||
lastName: '' | ||
} | ||
onSubmit(data) { | ||
console.log(data) | ||
} | ||
}) | ||
</script> | ||
<template> | ||
<form @submit="handleSubmit"> | ||
<input type="text" v-model="values.firstName"> | ||
<input type="text" v-model="values.lastName"> | ||
<button type="submit"> | ||
submit | ||
</button> | ||
</form> | ||
</template> | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "vue-composable-form", | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"description": "vue fome validate", | ||
"scripts": { | ||
"dev": "pnpm -r --parallel run dev", | ||
"build": "pnpm -r --parallel run build", | ||
"lint": "eslint './packages/**/*.{js,ts}'", | ||
"lint:fix": "pnpm lint -- --fix", | ||
"prepare": "husky install" | ||
}, | ||
"lint-staged": { | ||
"{packages}/**/*.{js,ts}": [ | ||
"pnpm lint:fix" | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"author": "Alex Liu <[email protected]>", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mini-ghost/vue-composable-form" | ||
}, | ||
"dependencies": { | ||
"typescript": "^4.6.3" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^5.20.0", | ||
"@typescript-eslint/parser": "^5.20.0", | ||
"eslint": "^8.13.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"husky": "^7.0.0", | ||
"lint-staged": "^12.4.1", | ||
"prettier": "^2.6.2", | ||
"vue": "^3.0.0" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "@vue-composable-form/core", | ||
"version": "0.0.0", | ||
"description": "vue fome validate", | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.esm.mjs", | ||
"source": "src/index.ts", | ||
"types": "dist/index.d.ts", | ||
"exports": { | ||
".": "./dist/index.mjs" | ||
}, | ||
"scripts": { | ||
"build": "rollup -c ./scripts/rollup/rollup.config.js", | ||
"dev": "pnpm build -- -w" | ||
}, | ||
"author": "Alex Liu <[email protected]>", | ||
"license": "MIT", | ||
"peerDependencies": { | ||
"vue": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^21.1.0", | ||
"@rollup/plugin-node-resolve": "^13.2.1", | ||
"@types/node": "^16.11.0", | ||
"rollup": "^2.70.2", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.31.2" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
import typescript from 'rollup-plugin-typescript2'; | ||
|
||
export function createRollupConfig(options, callback) { | ||
const name = options.name; | ||
|
||
// A file with the extension ".mjs" will always be treated as ESM, even when pkg.type is "commonjs" (the default) | ||
// https://nodejs.org/docs/latest/api/packages.html#packages_determining_module_system | ||
const ext = options.format === 'esm' ? 'mjs' : 'js'; | ||
const output = 'dist/' + [name, options.format, ext].join('.'); | ||
|
||
const config = { | ||
input: options.input, | ||
external: ['vue'], | ||
output: { | ||
file: output, | ||
format: options.format, | ||
name: 'VueComposableForm', | ||
sourcemap: true, | ||
globals: { | ||
vue: 'Vue', | ||
}, | ||
}, | ||
plugins: [ | ||
typescript({ | ||
tsconfig: options.tsconfig, | ||
clean: true, | ||
}), | ||
resolve({}), | ||
commonjs(), | ||
options.format !== 'esm' && | ||
terser({ | ||
output: { comments: false }, | ||
compress: { | ||
drop_console: true, | ||
}, | ||
}), | ||
], | ||
}; | ||
|
||
return callback ? callback(config) : config; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pkg from '../../package.json'; | ||
|
||
import { createRollupConfig } from './createRollupConfig'; | ||
|
||
const name = 'index'; | ||
const options = [ | ||
{ | ||
name, | ||
format: 'esm', | ||
input: pkg.source, | ||
}, | ||
{ | ||
name, | ||
format: 'cjs', | ||
input: pkg.source, | ||
}, | ||
{ | ||
name, | ||
format: 'umd', | ||
input: pkg.source, | ||
}, | ||
]; | ||
|
||
export default options.map((option) => createRollupConfig(option)); |
Empty file.
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"compilerOptions": { | ||
"sourceMap": true, | ||
"module": "es2015", | ||
"target": "es2018", | ||
"moduleResolution": "node", | ||
"outDir": "./dist", | ||
"skipLibCheck": true, | ||
"declaration": true, | ||
"declarationMap": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"include": ["src"], | ||
"exclude": [ | ||
"node_modules", | ||
] | ||
} |
Oops, something went wrong.