@afzalh/pattern-library v0.0.41
Introduction
Welcome to the @dhl/pattern-library
repository. In here you will find the React codebase of the components used by DHL. This library was created to 1) ensure consistency between different projects and 2) increase the development speed of the teams.
Installing and Running
To install the project and all it dependencies, you can simply run the standard script:
npm install
To run the project, please run:
npm start
Scripts
There are 5 scripts you need to know in order to be able to start developing.
Development
Build
npm run build
Builds the library to the dist/
directory. This is what is pushed to the package registry when the library is published.
Lint
npm run lint
Runs eslint
to statically analyze the code. The project uses prettier
in the standard configuration to account for formatting rules.
npm run lint:fix
Tries to automatically fix any issues raised by the linter.
Starting
npm start
Starts the project.
Testing
npm test
Runs the unit tests. The tests are run with -coverage
enabled.
Continuous Integration
Storybook
CI server automatically pushes the generated storybook build to a remote static server - scoping to the current branch name - for every commit.
npm run storybook:build
Builds the storybook
project to the styleguide-site/
directory. The build contain only static assets, so running any static server rooting to that folder is enought to see how it looks.
Publishing Beta
CI server run the script for every commit, checking and publishing a beta version of the package if needed.
npm run publish:beta
Publishes the library to the package registry if its version contains a well formated beta version number. The published version is tagged with the branch name. It can be referenced by @dhl/pattern-library@branch-name
.
Publishing
CI server runs the script whenever a new change is made to the master
branch.
npm run publish:official
Publishes a new version of the library to the package registry if it was never published before. The published version is tagged latest
.
❤️ Contributing
We welcome contributions!
They are made possible via pull requests. To enhance the codebase, please create a separate branch and raise a pull request against the master
branch.
When creating your own branch please ensure that you follow the correct namespace describing what the change is about. There are 6 types of changes that we currently support.
Feature
feature/branch-name major | minor
For adding new features to the library, regardless if a major, minor or patch update. Should be used whenever the change afects the library API or style.
Examples
Change | Branch Name | Version |
---|---|---|
Adding a new component to the library | feature/new-toggle-component | minor |
Adding a new property to a component | feature/support-aria-live-in-component | minor |
Removing a component | feature/remove-component | major |
Removing a property from a component | feature/remove-aria-live-in-component | major |
Documentation
docs/branch-name
For a documentation only change. Should be used whenever the change is only updating MD files or the storybook
stories.
Examples
Change | Branch Name | Version |
---|---|---|
Updating the README file | docs/update-readme-section | - |
Add knob support to a story | docs/add-knobs-to-component | - |
Create a new story for component | docs/add-story-to-component | - |
Remove story for component | docs/remove-component-story | - |
Fix
fix/branch-name minor | patch
For fixing a bug. Usually the API won't change after the fix. Should be used whenever the change is only about fixing an issue in the library and it's not adding any new feature.
Examples
Change | Branch Name | Version |
---|---|---|
Fix component | fix/component | patch |
Fix a bug in a property | fix/property-in-component | patch |
Fix a styling issue | fix/component-style | patch |
Fix a property that is not exposed | fix/expose-property | minor |
Test
test/branch-name
For adding tests only changes. Should be used when the change is only about writing new tests. The API of the library is not affected.
Examples
Change | Branch Name | Version |
---|---|---|
Add tests to component | test/add-for-component | - |
Remove tests from component | test/remove-from-component | - |
Update tests is component | test/component | - |
Update testing library | test/update-library | - |
Refactoring
refactoring/branch-name minor
For refactoring the code. Should be used for internal code changes that doesn't affect the library's API.
Change | Branch Name | Version |
---|---|---|
Increase component performance | refactoring/performance-component | minor |
Add react-hooks to component | refactoring/component-support-hooks | minor |
Update dependencies | refactoring/update-dependencies | minor |
Reduce function complexity | refactoring/update-function | minor |
Infrastructure
infra/branch-name
For changing the file structure or the build process. Should be used when the change is only related to infrastructure.
Change | Branch Name | Version |
---|---|---|
Update build process | infra/update-build-process | - |
Remove unused code | infra/remove-code-from-component | - |
Change directory structure | infra/update-structure | - |
Update bundler process | infra/update-webpack | - |
Code of Conduct
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery
- Personal attacks
- Trolling or insulting/derogatory comments
- Public or private harassment
- Publishing other's private information, such as physical or electronic - addresses, without explicit permission
- Other unethical or unprofessional conduct
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
This Code of Conduct is adapted from the Contributor Covenant, version 1.3.0, available at https://www.contributor-covenant.org/version/1/3/0/