@procurifieddxb/react-components
v0.21.13
Published
## Introduction
Readme
@procurifieddxb/react-components
Introduction
This library contains React components for Procurified projects. Figma Designs
Technologies Used
- React: A JavaScript library for building user interfaces.
- Vitest: A blazing fast unit test framework powered by Vite.
- React Testing Library: Simple and complete React DOM testing utilities that encourage good testing practices.
- Storybook: An open source tool for developing UI components in isolation. It makes building stunning UIs organized and efficient.
- SCSS Modules: For styling components in a modular and maintainable way.
Getting Started
Installation:
npm installRunning Storybook (for local development and documentation):
npm run devThis will start Storybook, where you can view and interact with the components in isolation.
Running Tests:
npm run testThis will run the component tests using Vitest and React Testing Library.
Running Lint:
npm run lint
Working with the Project
Clone the repository:
git clone [email protected]:Procurified-Core/react-components.git cd react-componentsInstall dependencies:
npm installStart developing:
- Use Storybook to develop and test components in isolation (
npm run dev). - Write unit tests for your components using Vitest and React Testing Library.
- Use Storybook to develop and test components in isolation (
Build the library:
npm run buildThis will create a
distdirectory with the compiled components.
Local Development with boq-ui (npm link)
Use this workflow when developing react-components and testing changes in boq-ui simultaneously.
Initial Setup (one-time)
In react-components, create a global link:
cd /path/to/react-components npm linkIn boq-ui, link to react-components:
cd /path/to/boq-ui npm link @procurifieddxb/react-componentsVerify the symlink was created:
ls -la node_modules/@procurifieddxb/react-components # Should show: react-components -> ../../../react-components
Development Workflow
Start boq-ui dev server:
cd /path/to/boq-ui npm run devMake changes in react-components, then build:
cd /path/to/react-components npm run buildOr use watch mode for auto-rebuild:
npm run dev:watchRefresh browser to see changes in boq-ui
Troubleshooting
Changes not reflecting? Clear Vite cache:
rm -rf /path/to/boq-ui/node_modules/.viteThen restart the boq-ui dev server.
Link lost after npm install? Re-run step 2 of Initial Setup:
cd /path/to/boq-ui npm link @procurifieddxb/react-componentsVite pre-bundling issues? The
optimizeDeps.excludeconfig in boq-ui'svite.config.mtsshould already exclude react-components from pre-bundling.
When Done Developing
- Commit and push changes in react-components
- Run CI - tests and lint will run automatically on push
- Publish - trigger "Publish to NPM" workflow in GitHub Actions
- Update boq-ui - change dependency back to version number:
npm install @procurifieddxb/react-components@<new-version>
Alternative: Yalc (if npm link doesn't work)
Setup Yalc
- Install Yalc (
npm i yalc -g)
- Install Yalc (
Set the path in boq-ui
- In boq-ui's package.json, change:
to:"@procurifieddxb/react-components": "0.20.44""@procurifieddxb/react-components": "file:.yalc/@procurifieddxb/react-components"
- In boq-ui's package.json, change:
Run this command after making changes in react-components
npm run update-componentsThis builds, publishes to yalc, and clears boq-ui's vite cache.
Restart boq-ui to see the changes
