falseLuffy / npm-vue3

npm package template for vue3

Home Page:https://vue3-npm-template.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README

Features

It is recommended to use jsx to develop components, If you want to develop with .vue

do change with pacckage.json:

"scripts": {
-  "prepublishOnly": "npm run build",
+  "prepublishOnly": "npm run build:vite",
},
  • πŸ’» Vue suport >=3.2.0

  • ✈️ Project init with vite

  • πŸ“¦ Support cjs & esm

  • πŸ›Ž you can write componet with .vue or .tsx


how to use

replace my-custom-vue3-package with your package name

Directory structure

Project
β”œβ”€β”€ __tests__           # Unit Testing
β”œβ”€β”€ babel.config.js     # babel config
β”œβ”€β”€ package.json
β”œβ”€β”€ playground          # dev environment folder (can use source code)
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ public
β”‚   β”œβ”€β”€ src
β”‚   β”œβ”€β”€ tsconfig.json
β”‚   β”œβ”€β”€ vite-env.d.ts
β”‚   └── vite.config.ts
β”œβ”€β”€ postcss.config.js  # build styles with postcss
β”œβ”€β”€ global.d.ts # global componet type declaration (TIPS: Manual maintenance is required)
β”œβ”€β”€ src                # Package source code
β”‚   β”œβ”€β”€ index.ts       # Package source entry
β”‚   β”œβ”€β”€ stories        # storybook for building UI components and pages
β”‚   β”œβ”€β”€ styles         # styles for Package
β”‚   └── types.ts       # ts type declaration for Package
β”œβ”€β”€ tsconfig.json      # ts config
└── tsup.config.ts     # build package with tsup

Register Components Globally

// main.ts
import InstallPlugin from 'my-custom-vue3-package';

app.use(InstallPlugin());
// tsconfig.json
{
  "compilerOptions": {
    "types": [
      "my-custom-vue3-package/global"
    ]
  }
}

How to add GITHUB_TOKEN

How to add NPM_TOKEN

  1. update project setting

settings -> actions -> General

./token.png

  1. create npm auth token

  2. then copy npm token, add to github project settings

    • project -> settings -> secrets -> actions -> create new token with name:NPM_TOKEN

How to add NETLIFY_TOKEN

  1. create netlify auth token

  2. then copy netlify token, add to github project settings

    • project -> settings -> secrets -> actions -> create new token with name:NETLIFY_TOKEN
  3. create a site on netlify

  4. copy the site_id from your netlify site settings, add it to github project settings

    • project -> settings -> secrets -> actions -> create new token with name:NETLIFY_SITE_ID
  5. Stop Build from Build settings of site

How to generate VERCEL_ORG_ID / VERCEL_PROJECT_ID

  1. run npx vercel in project root folder

  2. open .vercel/project.json

  3. copy orgId & projectId, add it to github project settings

    • project -> settings -> secrets -> actions -> create new token with name:VERCEL_ORG_ID & VERCEL_PROJECT_ID
  4. create vercel token, add it to github project settings

    • project -> settings -> secrets -> actions -> create new token with name:VERCEL_TOKEN
  5. change project build setting

    setting

About

npm package template for vue3

https://vue3-npm-template.netlify.app

License:MIT License


Languages

Language:TypeScript 31.1%Language:MDX 27.7%Language:Vue 16.3%Language:JavaScript 14.6%Language:CSS 6.0%Language:HTML 2.0%Language:SCSS 1.7%Language:Shell 0.5%