Giter Site home page Giter Site logo

davidebriscese / vite-component-library-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ignacionmiranda/vite-component-library-template

0.0 0.0 0.0 309 KB

⚛️ Vite + React Starter Component Library Template

Home Page: https://vite-component-library-template.vercel.app

License: MIT License

Shell 1.33% JavaScript 21.86% TypeScript 75.06% CSS 1.01% HTML 0.75%

vite-component-library-template's Introduction

⚛️⚡ Vite + React + Typescript Component Library Template

Features

Getting Started

  1. Create a new repository using this one as template

  2. Create 2 core branches: develop and main.

    2.1 develop will serve all your versions.

    2.2 new additions should be pushed to main when they have been approved/tested appropriately.

  3. Clone your repo

  4. Install dependencies with yarn

  5. Run yarn prepare command to setup Husky pre-commit hooks.

Main Scripts

Always prepending yarn:

  • dev: Bootstrap the Storybook preview with Hot Reload.
  • build: Builds the static storybook project.
  • build:lib: Builds the component library into the dist folder.
  • lint:fix: Applies linting based on the rules defined in .eslintrc.js.
  • format:prettier: Formats files using the prettier rules defined in .prettierrc.
  • test: Runs testing using watch mode.
  • test:cov: Runs testing displaying a coverage report.

Publishing the Library to NPM

Using Github as the hosting service:

  1. Check the Allow GitHub Actions to create and approve pull requests box under the Settings>Code and automation>Actions>General repository configuration. This will allow the release-please workflow to create a PR increasing the version.
  2. Create a repository secret called NPM_TOKEN under Settings>Security>Secrets and variables>Actions for the github action to be able to publish the library to npm.

With these 2 requirements, Pull Requests raised by release-please will have enough permissions. For more details, check the official documentation.

Versioning

Following Conventional Commits.

release-please will bump a patch version if new commits are only fixes.

It will bump a minor version if new commits include a feat.

feat!, fix!, refactor!, etc., which represent a breaking change, will result in a major version.

In order to change the version manually (i.e. force it), a new commit has to be created including Release-As: X.X.X as the description. Example: git commit -m "chore: v1.2.0" -m "Release-As: 1.2.0"

Using the library in a React frontend app

Install the library running yarn <your-library>.

To import the styles the library needs:

/* _app.tsx */
import '<your-library>/dist/style.css'
// More imports and your App component ...

To import library components:

/* pages/index.tsx */
import { AtButton } from '<your-library>'
// More imports and your Page component...

Author

Ignacio Miranda Figueroa

License

MIT

vite-component-library-template's People

Contributors

github-actions[bot] avatar ignacionmiranda avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.