@zappyrent/hundop
v1.36.1
Published
Zappyrent's design system component library
Downloads
71
Readme
Hundop
Hundop is Zappyrent's design system component library, based upon React and Styled Components. Components are developed and tested locally using Storybook and then published on Zappyrent's npm registry.
Technologies
Whirl does type checking at build time during development and also lints and prettifies code in pre-commit stage thanks to Husky. It is strongly suggested to use Visual Studio Code and its Prettier/Eslint plugins.
Getting started
#clone the project
git clone [email protected]:zappyrent-group/hundop.git
#Install all dependencies
yarn install
#Prepare husky pre-commit script for linting on pre-commit
yarn prepare
Now you should be able to start, just launch:
yarn build
to build the existing components; or launch Storybook to work on local components:
yarn storybook
Creating new components
Just use the following command:
yarn generate
and follow the configuration steps. Plop will scaffold the component folder and its necessary files for you.
Publishing design system with Chromatic
Chromatic is Storybook's recommended method to publish design systems in a publicly available repository, allowing for review by the team in a panel similar to that used by the development team, and can be used for demonstration purposes. The following script will build Storybook, run tests, and deploy to a publicly accessible link inside the Chromatic repository [dashboard] https://www.chromatic.com/builds?appId=61a9d0fb658053003a6c3313:
yarn chromatic
View the latest Storybook repo in the Chromatic repository dashboard by clicking on "Builds" and "View Storybook." Each build will create a unique link, allowing for comparison between build versions.
Adding dependencies
Please note that we're developing a library that will be consumed by other apps here; so we should make sure that some libraries (such as react
and react-dom
) are not included twice in the consumer app bundle. To do this, it is good to insert the shared libraries in the peer dependencies of the package.json
. Rollup will then take care of avoiding duplication through its plugin Rollup Plugin Peer Deps External.
Troubleshooting
I am experiencing problem while committing my changes
If you are using nvm
or other node version managers, you may have problems finishing the commit. Please have a loook at Husky's docs about this and similar problems. In particular, for the aforementioned nvm problem, you should create a .huskyrc
file in your os home and paste the following contents into it:
# ~/.huskyrc
# This loads nvm.sh and sets the correct PATH before running hook
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
Consuming Hundop in your app
To use this module in a project, just launch the following command on your terminal:
yarn add @zappyrent/hundop