https://github.com/eruptionjs/react-lib
🌋 lib/components boilerplate for projects made with React/Typescript, on top of Vite ⚡
https://github.com/eruptionjs/react-lib
Last synced: about 1 year ago
JSON representation
🌋 lib/components boilerplate for projects made with React/Typescript, on top of Vite ⚡
- Host: GitHub
- URL: https://github.com/eruptionjs/react-lib
- Owner: eruptionjs
- License: other
- Created: 2023-10-25T14:14:29.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-25T14:45:36.000Z (over 2 years ago)
- Last Synced: 2025-04-12T00:49:03.565Z (about 1 year ago)
- Language: JavaScript
- Size: 121 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Eruption🌋 React Lib
Your production go-to model to easily publish a lib/components to npm and github package registry, for your React/Typescript projects.
## how to use
The project is ready to be used as a template for your own lib. You can clone it or use the Eruption🌋 CLI to create a new project (available soon).
## how to develop
The project have two separated structures: `lib` is for the lib itself where the components will be developed and will bundle to publish into github/npm, and the `src` where you should use as your usual development mode to develop the library itself. Since we use absolute paths to import the components, you can import the libs/components using `@lib/` prefix, the same way you would do with `@src/`.
## how to publish
Before you publish, don't forget to change the lib name in the `package.json` file. The name is the one that will be used to install the package in other projects. Also, don't forget to change the `package.json` version, description and author, too. Homepage, bugs and repository, should be changed as well and reflect the repository that your project lives in (aka github).
A friendly reminder that you can't publish a package with the same version twice, and you can't publish a private package to npm with a free account. In addition, to publish via github, you need to have a personal access token with the right access to publish packages. You can create one in your github account settings. Check the docs for further details.
This project takes a lot of opinions of how a lib should be structured, developed and published. If you want to change the structure, take your time to understand each config under `vite.config.ts` and `tsconfig.json` files. You should be able to follow with the official vite and rollup docs.
## how to publish to github/npm
- run
```bash
npm login --scope=@ --registry=https://npm.pkg.github.com
```
- authenticate with your github `username` and your `personal access token`:
```bash
Username:
Password:
```
- If you have the right access with your token, you can then publish your package:
```bash
npm publish
```
Then, if everything if your access is right, ti will be published to your github package registry and be available to install as a dependency in other projects:
```bash
npm install @/
```