A template to help you create vue3.x component
You can create yourself component quickly with it.
- ⚡️ Serve and build based on vite
- ✨ Format with pretty-quick
- 🤙🏻 Eslint support
- ⚙️ Unit Testing with Vitest
- 🦾 TypeScript, of course
- 🎈 Release package easily with bumpp
- 📦 Deploy demo with gh-pages
vue-component-starter require Node >=16
Create repo from this template on Github
$ pnpm create un
# or
$ pnpm create un [my-component] -t vue-component-starter
Init git hook(optional)
$ pnpm git-hook-init
Just run and visit http://localhost:3000
$ pnpm dev
To build the Component, run:
$ pnpm build
And you will see the generated fie in dist
that ready to be served.
Before you publish your component, you must give your component a new name in order to prevent conflicts with other people's component names.
You better update the registered component name in src/index.ts
:
export function install(app: App) {
- app.component('MyComponent', MyComponent)
+ app.component('yourComponentName', MyComponent)
}
Run pnpm build
again to get the right files.
Make sure your are logged into npm, and run:
$ pnpm release
$ npm publish
For more details about publish, please check bumpp.
-
Create a public repository in github. And keep the repository's name same as the
package.json
's name -
Link the repository to the github repo
$ git init
$ git remote add origin [email protected]:xxx/xxxx.git
- You can debug your components online in
demo/App.vue
, and they can be deployed directly.
Just run:
$ pnpm deploy:demo
Then visit https://[your-username].github.io/[your-component-name]/
, such as https://peterroe.github.io/vue-component-starter/