_Develop once, Use in both Vue 2.7 & Vue3_
English | 简体中文
Although a long time has passed since Vue 3 announced, there are also many developer still stay on vue2 because dependency compatibly, browser support requirements, or other reasons.
The Vue team also have backported some important feature from Vue 3 like composition-api in Vue 2.7 which was last minor version of Vue 2.x.
If we just want create a UI library that follows design specification and can be use on both Vue 2 and Vue 3 project, How?
Fortunately, there was a Community solution a long time ago, vue-demi, so I built a template for building your universal ui libraries on top of this. take a try 😉
Create a repo from this template on GitHub.
Clone this repo directly, or you prefer to do it manually with the cleaner git history
npx degit enpitsulin/demi-ui-template project-name
cd project-name
pnpm i # If you don't have pnpm installed, refer to the official pnpm documentation to install
When you use this template, try follow the checklist to update your info properly
- Change the author name in
LICENSE
under root of workspace - Change
@demi/
in each subpackage to the scope you want or use single package name, DON'T forget change name where be used to as dependency.- Change the private field of some subpackages for distribution (optional)
- Change some build-related constants in
constants.ts
in theinternal/build
package - Clean up the READMEs or change the content
WIP: TODO create a website to show some doc thing.
To build the library, run (in workspace root)
pnpm build
And you will see the library product file in packages/demi-ui/release/
you can direct npm publish
this directory.