This is a starter template for creating a simple component library using Vue3, TypeScript, pnpm, Vite and ESLint - most loved tools in the Vue community.
- You don't need to constantly rebuild the library manually to see the changes in the demo app (included playground package). This monorepo provides a single command to start both the library and the demo app in watch mode.
- No need to use Prettier or any other code formatter. ESLint is configured
to fix all the code style issues automatically. Just enable
Run eslint --fix on save
in your IDE. - Disk space is not an issue. pnpm uses hard links to store the dependencies, so you don't need to download them every time.
- Library is configured to provide IntelliSense for the components in the demo app and after publishing. You can see proper types for the props, events and slots.
- Create a new repository from this template and clone it
- Replace all the occurrences of
yourlib
with your library name - Replace metadata in
library/package.json
like author, description, etc. with your own - Replace
LICENSE
file with your own license - Enable
Run eslint --fix on save
in your IDE - Install dependencies
pnpm i
- Start the demo app and build the library in watch mode
pnpm dev
- Add your components to
library/src/components
folder - Export them in
library/src/index.ts
- Play with them in the demo app in
playground/src/App.vue
- Stop
pnpm dev
if it's running - Bump the version in
library/package.json
- Build the library
pnpm library:build
- Publish the library to npm
pnpm library:publish
.
├── library/ library package
│ ├── dist/ build output
│ │ └── ...
│ ├── node_modules/
│ │ └── ...
│ ├── src/
│ │ ├── components/ your components
│ │ │ └── ...
│ │ └── index.ts library entry point
│ ├── env.d.ts
│ ├── package.json library package metadata
│ ├── tsconfig.json
│ └── vite.config.ts
├── node_modules/
│ └── ...
├── playground/ demo app
│ ├── node_modules/
│ │ └── ...
│ ├── src/
│ │ ├── assets/
│ │ │ └── main.css demo app global styles
│ │ ├── App.vue play with your components here
│ │ └── main.ts demo app entry point
│ ├── env.d.ts
│ ├── index.html
│ ├── package.json
│ ├── tsconfig.app.json
│ ├── tsconfig.json
│ ├── tsconfig.node.json
│ └── vite.config.ts
├── .editorconfig
├── .gitignore
├── .npmrc
├── eslint.config.js
├── LICENSE
├── package.json
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
└── README.md
MIT 2023-present Gleb Sakharov