@boosters/wb-ui-kit
v1.25.2
Published
This project using:
Downloads
1,180
Maintainers
Readme
Words Booster React Component Library
This project using:
It also features:
- Storybook to help you create and show off your components
- Jest and React Testing Library enabling testing of the components
Development
Testing
npm run test
Building
npm run build
Storybook
To run a live-reload Storybook server on your local machine:
npm run storybook
To export your Storybook as static files:
npm run storybook:export
You can then serve the files under storybook-static
using S3, GitHub pages, Express etc.
Generating New Components
npm run generate YourComponentName
This will generate:
/src
/YourComponentName
YourComponentName.tsx
YourComponentName.stories.tsx
YourComponentName.test.tsx
YourComponentName.types.ts
YourComponentName.scss
The default templates for each file can be modified under util/templates
.
Don't forget to add the component to your index.ts
exports if you want the library to export the component!
Installing Component Library Locally
Use node v12
- After updates generate bundle with new code
npm run build
- Let's say you have another project (
test-app
) on your machine that you want to try installing the component library into without having to first publish the component library. In thetest-app
directory, you can run:
npm i --save ../wb-ui-kit
which will install the local component library as a dependency in test-app
. It'll then appear as a dependency in package.json
like:
...
"dependencies": {
...
"@boosters/wb-ui-kit": "file:../wb-ui-kit",
...
},
...
- Then delete node_modules folder from test-app/node_modules/@boosters/wb-ui-kit folder
Your components can then be imported and used in that project.
Publishing
First, make sure you have an NPM account and are logged into NPM using the npm login
command.
Push changes to GitHub!
Push your changes to main branch with commit like below:
git commit -m “fix: …”
commit will trigger a patch update (1.0.0 → 1.0.1)
git commit -m “feat: …”
commit will trigger a minor update (1.0.0 → 1.1.0)
git commit -m “BREAKING CHANGE: …”
in the commit body and with any type of commit will trigger a major update (1.0.0 → 2.0.0)
For publish package on npmjs run:
npm publish
Usage
Usage of the component (after the library installed as a dependency into another project) will be:
import React from "react";
import { TestComponent } from "@boosters/wb-ui-kit";
const App = () => (
<div className="app-container">
<h1>Hello I'm consuming the component library</h1>
<TestComponent theme="primary" />
</div>
);
export default App;
USE GLOBAL STORY BOOK
https://6267ee827524a3004ad88eca-ywrlasoccm.chromatic.com/?path=/story/accordion--default