ui-x-library v1.1.26
UI Components Library
Build and upload ReactJS components to NPM
Rationale
In essence, this application allows you to build UI components library in isolation using Styleguidist - in other words you can build and preview them independently from any particular brand. Also generates a dist
folder ready to be pushed to the NPM using a few familiar commands.
Building and Running
:warning: Check
.env.example
file for required variables!
Install all required dependencies:
yarn
Launch Styleguidist ( initial load takes time, subsequently webpack cache kicks in )
yarn styleguide
Launch Create React App if you want to preview components outside of Styleguidist
yarn start
Generate NPM dist
package using Rollup:
yarn build-for-npm
Run tests:
yarn test
How to test your NPM module without publishing!
Use yalc
!
Better workflow than npm | yarn link
for package authors - read docs.
Install yalc
globally:
yarn global add yalc
Inside ui-library
root execute:
yarn build-for-npm
Then publish to yalc (located ~/.yalc):
yalc publish
Add to another local FE project:
yalc add ui-library
To update library after some changes
yarn build-for-npm && yalc publish --push
Publish to NPM
:warning: Don't forget to bump ui-library package version!
Versioning
Command | Description |
---|---|
yarn version --patch | Bump version in package.json -> patch |
yarn version --minor | Bump version in package.json -> minor |
yarn version --major | Bump version in package.json -> major |
Then run npm publish
- assuming you have \${NPM_TOKEN} set on your local machine in your ~/.profile
or logged into npm via CLI.
See npm docs for more info.
Project Structure
Name | Description |
---|---|
.vscode | Contains VS Code specific settings |
dist | Contains built output for the NPM registry |
node_modules | Contains all npm dependencies |
public | React application public folder |
src/lib | Component in this folder will become dist package |
src/styleguide | Styleguidist specific files e.g ContextProvider |
.env.example | Defines ENV variables that you need to set in .env file |
.eslintignore | Contain patterns that should be ignored by ESLint |
.eslintrc | Config settings for ESLint code style checking |
.gitignore | Contain patterns that should be ignored in Git |
.npmignore | File to keep stuff out of your dist package |
.npmrc | Contains config settings for the NPM |
.prettierrc | Prettier configuration file |
CHANGELOG.md | All notable NPM package changes will be documented in this file |
package.json | File that or orchestrates this project |
README.md | File you are reading right now |
rollup.config.js | Rollup bundler configuration file, creates dist folder |
styleguide.config.js | Styleguidist configuration file |
styleguide.styles.js | Styleguidist theme file |
tsconfig.json | Config settings for compiling code written in TypeScript |
yarn.lock | Auto-generated file to get consistent installs across machines |
Changelogs
Use a CHANGELOG
markdown file to keep changes of repository in an ordered and structured way.
Recommended template to use for each bullet of the changelog.
## [1.0.0] - YYYY-MM-DD
### Changes
- commit message
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago