Skip to content

xmj-alliance/pit-template-vue-component

Repository files navigation

pit-template-vue-component

Template for Vue component library

Featuring Vite, Vue, Jest, TypeScript.

Use the template

Follow the _Dummy example to create your component library.

Add import and export in index.ts

Replace dummy-component with your component names in these locations:

  • package.json
  • vite.config.ts

Build

pnpm install
npm run build

Publish

  1. Create or Edit ~/.npmrc (Attention: Not the one in this repository!)

    //npm.pkg.github.com/:_authToken={YOUR_GIT_REPO_AUTH_TOKEN}
  2. Edit .npmrc in this repository if you are publishing to somewhere else

    @xmj-alliance:registry=https://npm.pkg.github.com

Import this module

Create the .npmrc file in the target repository. Change the registry URL if necessary.

@xmj-alliance:registry=https://npm.pkg.github.com

Import the esm (by referencing this module should be enough),

  • and the style.css
import { Dummy } from "@xmj-alliance/pit-template-vue-component";
// usually the global style.scss
@import "~@xmj-alliance/pit-template-vue-component/style.css";
// => or alternatively import in the JS way in main.ts

Vite readmes

This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup> SFCs, check out the script setup docs to learn more.

Recommended IDE Setup

Type Support For .vue Imports in TS

TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue types.

If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:

  1. Disable the built-in TypeScript Extension
    1. Run Extensions: Show Built-in Extensions from VSCode's command palette
    2. Find TypeScript and JavaScript Language Features, right click and select Disable (Workspace)
  2. Reload the VSCode window by running Developer: Reload Window from the command palette.

About

Starter for Vue component distribution

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages