1.0.6 • Published 5 years ago
@privy-eng/privy-components v1.0.6
Privy Component Library:
Setup steps:
1) SETUP YOUR MACHINE:
- Make sure you have yarn installed in your machine.
- Follow this link to
install yarn: https://linuxize.com/post/how-to-install-yarn-on-ubuntu-18-04/
- Follow this link to
- Install NVM to manage the versions of node.
- Follow this link to
install NVM: https://www.liquidweb.com/kb/how-to-install-nvm-node-version-manager-for-node-js-on-ubuntu-12-04-lts/
- Follow this link to
- Clone the repo to your local machine.
git clone {ssh/https} Select the right the version of
yarnforprivy-componentsby specifying it tonvm:- Check the
nodeversion.node --version - Change nvm to use the node version
nvm run {node_version}
- Check the
2) SETUP PRIVY-COMPONENT REPO:
- In order to run
Storybookyou will have to runyarn start. - You may get an error that says you need to add the private
NPM_TOKEN, either login to npm with privy's engineering account saved in last pass, or create an account and let the admin invite you to the project. - Once you have the
NPM_TOKENfollow these steps: https://docs.npmjs.com/using-private-packages-in-a-ci-cd-workflow. - Don't forget to exit and reopen the terminal.
Run
yarn startand it should work!CLI commands:
To generate a new component boilerplate run
yarn gernerate:component component-name.- The name of the component should always be lower-dashcase (e.g
loading-componentas opposed toLoadingComponent). The generator will automatically turncomponent-nameintoconst ComponentName = (props) {..} - The generator automatically creates a webpack.config.js with proper entry and output paths.
- Adds
@babel/preset-react @babel/core webpack webpack-clitopackage.jsonand runsyarn install - The generator creates a
packages/component-name/lib/ComponentName.stories.jsfile for use with storybook. The generator creates a functional react component boilerplate code in
packages/component-name/lib/ComponentName.js- this is where you will build your component.
TODO:
- The name of the component should always be lower-dashcase (e.g
fill in Lerna commands.
Create new package
Publishing
To publish a new package, or an update that was made to an existing package you will need to do the following:
cdinto the package you want to publish- run
yarn publish - When prompted, enter a new patch/minor/major version increment that matches the update being made (modelled after semver)
- If publishing a beta feature just for testing, it is recommended to use the
--canaryflag