Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aladin002dz/react-library
https://github.com/aladin002dz/react-library
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/aladin002dz/react-library
- Owner: aladin002dz
- License: mit
- Created: 2024-06-02T15:59:43.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-06-05T09:36:58.000Z (5 months ago)
- Last Synced: 2024-10-07T04:42:48.838Z (about 1 month ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# React Component Library
## Step 1
- Create a component inside a folder like `lib/Modal`.
- Inside `lib`, create an index.js file that import and export all the components, in out example it is `Modal.jsx`.## Step 2
- Copy the lib file into a root folder like `dist`, you can create a script to copy the files automatically.
## Step 3
- Inside `package.json` file in the root folder, and add the following lines:
```json
{
"name": "react-component-library", // the name of your library, be sure it is unique
"private": false, //change to false if you want to publish it
"version": "1.0.0", //change to the version of the library on every update to publish
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": ["dist"],
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
}
```## Step 4
- Create an account on [https://www.npmjs.com/](https://www.npmjs.com/).
- Run:```bash
npm login
```- Enter your credentials.
- Run:
```bash
npm publish
```- You will receive an update on your npmjs profile and on your email.
## Step 5
- You can now use the library in any project by running:
```bash
npm install react-component-library
```- You can, also, find the files inside `node_modules` folder.