Skip to content

codes-templates/npm-vue3

This branch is up to date with main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
jerrywu
May 16, 2024
11839fe Β· May 16, 2024

History

84 Commits
Jan 31, 2024
Mar 15, 2024
Aug 2, 2023
Mar 15, 2024
Sep 2, 2023
May 16, 2024
May 16, 2024
Mar 15, 2024
Apr 25, 2023
Apr 25, 2023
Jul 22, 2022
Mar 15, 2024
Nov 24, 2023
Aug 2, 2023
Jul 22, 2022
Apr 12, 2023
Nov 24, 2023
Jul 22, 2022
Jan 30, 2024
Jul 22, 2022
Nov 24, 2023
Jul 22, 2022
May 16, 2024
Nov 24, 2023
Jul 22, 2022
Apr 19, 2023
May 15, 2023
Nov 24, 2023

Repository files navigation

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

Sponsor

Special Sponsor

special sponsor appwrite