/vue-library-template

A template for creating a vue3 library which is production ready with all the required configurations.

Primary LanguageTypeScriptMIT LicenseMIT

Vue-Library-Template

Configured for all kinds of environments [prod, dev and local]

Features

  • Built with typescript support
  • Built with vite.dev (Next Generation Frontend Tooling)
  • Exports types automatically as .d.ts files using vite-plugin-dts
  • Configured with vitest for unit testing
  • Test components by importing them into index.ts file and running the command yarn run dev
  • No need to create seperate project to test the library

Tech

Vue-Library-Template uses a number of open source packages to create a production ready vue library:

  • Typescript - TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.
  • Vue.js - An approachable, performant and versatile framework for building web user interfaces.
  • vite.dev - Next Generation Frontend Tooling
  • Eslint - ESLint statically analyzes your code to quickly find problems. It is built into most text editors and you can run ESLint as part of your continuous integration pipeline.
  • Prettier - An opinionated code formatter
  • Husky - Husky improves your commits and more 🐶 woof!
  • And many other plugins

And of course Vue-Library-Template itself is open source with a public repository on GitHub.

Installation

Requires Node.js v10+ to run.

Install the dependencies and devDependencies and start the server. HTTPS:

git clone https://github.com/ssrbloginsoft/vue-library-template.git 

SSH:

git clone git@github.com:ssrbloginsoft/vue-library-template.git

Install

npm i
or
yarn install

Build

yarn run build

Test

yarn run test:unit

Development

Run development server to test the component changes by importing it in App.vue. No need to create another project to test the changes.

yarn run dev

For running linter:

yarn run lint

Creating a component

Create a new component in components folder with .vue extention and export the component in main.ts:

export { default as Image } from "@components/Image.vue";

By running the build command a dist folder will be generated

Exporting types:

export type { User } from "./types";

License

MIT

Free Software, Hell Yeah!