Package library for common React functionalities.
Storybook docs deployed on GH Pages: https://dagerikhl.github.io/primors
This project is set up with GitHub actions to trigger these actions on push to main with a new version tag.
Note: Every new version should be created using yarn version
, see Release a new version.
Actions:
release
: Triggers on push to the main branch with a new version tag.- Creates a new GitHub release with release notes taken from
CHANGELOG.md
for the current version.
- Creates a new GitHub release with release notes taken from
publish-package-and-deploy-docs
: Triggers on each new release.- Builds and publishes the library to the npm package registry.
- Builds and deploys the Storybook live documentation app to GH Pages.
To run these processes manually, please see Release below.
Assumes owner of original repo or set up with similar repo structure.
- Install:
yarn install
. - Develop and release:
- Make changes.
- Commit.
yarn version
. (Creates a new release commit and CHANGELOG.)git push --follow-tags
. (Starts GH action to publish npm packages.)yarn deploy-storybook
. (Deploys SB to GH pages.)- DONE
To install all dependencies, run:
yarn install
To build the functionalities locally, run:
yarn build
To run the Storybook app locally, which listens for changes and hotreloads, run:
yarn storybook
You can also build a production build of the Storybook app locally by running:
yarn build-storybook
To create a new version ready for publish and deploy, run:
yarn version
After creating a new version, there are two choices:
- If repo is set up with GH actions and able to publish to npm, simply push the changes, with tags:
git push --follow-tags
- If not, follow Publishing npm package locally.
Note: Because GH actions is set up, only yarn version
is necessary if pushing to a GH repo set up with this action. The action will take care of publishing the package.
That being said, to build and publish a new version of the package locally, run:
yarn version
yarn publish
yarn version
automatically generates a new changelog in CHANGELOG.md
based on all commits since last release, and bumps the version of the package in package.json
and tags the release.
yarn publish
deploys a new version to the NPM package registry.
To build and deploy the Storybook live documentation app, run:
yarn deploy-storybook
This project uses auto-changelog to automatically generate a changelog. You can use several prefixes matching the regex specified here in your commit messages to categorize commits in your changelog:
Feat(ure)?:
: New features, for the library. Changes to the Storybook app should be categorized under "Performance".Fix:
: Bug fixes, for the library.Impr?(ovement)?:
: General improvements, for the library.Perf(ormance)?:
: Performance improvements.Doc(umentation|s)?:
: Changes to documentation, e.g.README.md
or the Storybook app.Build:
: Changes to the build or deploy environments.Conf(ig(uration)?)?:
: Changes to project configuration.Test(s|ing)?:
: Changes to test setup, test files, or new tests.- Any commits not matching one of these patterns will not be categorized.
You can mark any commit as a breaking change by writing "BREAKING CHANGE" anywhere in your commit message.
This project tests its functionality with frontend unit tests, using Jest.
To run tests for the project, run:
yarn test
Testing the library also produces a test coverage report. To view this report, run the test and open /coverage/lcov-report/index.html
in your browser.
To lint the project, I suggest installing the ESLint plugin in your editor, but to run it from terminal, run:
yarn lint
This library is built using:
For testing and linting, these packages are used:
For development, these comfort-packages are used:
And for creating a view of the components for development: