Skip to content

Latest commit

 

History

History
83 lines (58 loc) · 1.25 KB

README.md

File metadata and controls

83 lines (58 loc) · 1.25 KB

react-package-template

  • Template for react library package

consisted of

  • react

  • typescript

  • rollup

  • storybook

  • eslint

  • prettier

usage

  • node >= 16
  • for ui library -> use storybook
  • for library -> remove storybook

how to publish

  1. export files
// src/index.ts
// export files here
export { default as Button } from '~~`;
export { default as Radio } from '~~';
export const colors = { ... };
  1. set token at github repository or make .npmrc file at rook and set token
// .npmrc for github package
//npm.pkg.github.com/:_authToken=ghp_xxxxxxs
  1. edit publish.yml
// .github/worksflows/publish.yml
// 1. publish on github package
- name: Setup Node
  uses: actions/setup-node@v3
  with:
     node-version: 16.x
     registry-url: https://npm.pkg.github.com/

...

   env:
      NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

// 2. publish on npm package
- name: Setup Node
  uses: actions/setup-node@v3
  with:
     node-version: 16.x
     registry-url: https://registry.npmjs.org/

...

   env:
      NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
  1. change package.json's version before merge to main
// package.json
{
    ...
    "version": "x.x.x"
}
  1. make release at github, then publish on github or npm by action