unifiedxp-atomic-lib v1.0.0
AirMiles ReactJS Components Library
This is a ReactJS Components Library owned by AirMiles
Tech Stack
UI: ReactJS, Material UI, StoryBook
Development: Lerna, Typescript, ESLint, Hygen, Prettier, Lint Staged, Husky, Airbnb Code Standard, Commitizen
Testing: Jest, Testing Library, Snapshot Tests
Run Locally
First of all, please make sure you are currently using node 16.0.0, if you start the installation with another version of node you will probably get errors installing dependencies
Node Version Setup (NVM)
MAC OSX
Users need to run this command to make sure they are in the correct version
nvm use
Note: if you don't have v16 of node you will need to install first
nvm install 16 nvm use
Windows
Users need to install NVM for Windows and run this command to make sure they are in the correct version
Note: NVM for Windows: Link
nvm install 16.0.0 nvm use 16.0.0
Installation
npm run setup
This setup script will run some other scripts at the time, if you get an error you can try to run one by one
npm install --legacy-peer-deps npm run bootstrap npm run build
Run StoryBook
npm run storybook
Create New components
We are using Hygen to avoid errors creating components manually, you just need to run this command and fill out the required information
npm run create:component
Build components
npm run build
npm run build --scope=button
Build options
if you dont use parameters, the command will be build all components of the library
Parameter | type | Description |
---|---|---|
--scope | string: component name | to build an specific component |
Test
npm run test
npm run test --u
npm run test --scope=button
npm run test --scope=button --u
Test options
if you dont use parameters, the test command will be excecuted to all components
Parameter | type | Description |
---|---|---|
--scope | string: component name | to run a test for an specific component |
--u | boolean | default true, to update the snapshot test |
** You can use --scope and --u at the same time to update an specific test snapshot npm run test --scope=button --u
Make builder executable
Sometimes you could get an error if the rollup builder script is not executable, if so please run the following command
chmod +x packages/builder/lib/builder.js
2 years ago