Contribution Workflow
The project uses Node.js v14.x LTS.
This is a monorepo maintained with Lerna.
Setting up
To install repository dependencies and bootstrap repository packages:
npm install
Post-installation, the packages source code is compiled.
Compiling
The packages interdependencies, testing, the playground, and the website use the compiled/transpiled CommonJS code of the packages, not the actual source code.
So the packages need to be compiled for the packages dependencies, testing, and the applications to work.
npm run compile-commonjs
The UMD compiled code is only required when the project is to be released.
npm run compile-umd
Testing
jest, and @testing-library/react are used for tools and components unit testing.
npm run test # test oncenpm run test-watch # test with watchernpm run test-coverage # test with coverage
ESLint and markdownlint are used for linting.
# lint all JS/TS/MD filesnpm run lint# JavaScript/TypeScript lintingnpm run lint-js # lintnpm run lint-js-fix # fix lint issues# Markdown lintingnpm run lint-md # lintnpm run lint-md-fix # fix lint issues
For a continuous integration environment, the installation, setup, linting, and testing processes can be executed with:
npm run ci
Git commit messages
Conventional Commits v1.0.0 is used for commit message format along with the Conventional Changelog specification.
An interactive git commit message guide is already setup to ensure the convention is followed every time there is a new commit.
Releasing
The following conditions are required to release the project:
- Current git branch is
main
. - Local branch is synced with remote branch.
- Git working directory is clean.
- User is located at project root path.
- Lints and tests must pass to prevent issues.
Then the release can be started:
npm run release
As of writing, Lerna v3.22.1 has an issue with the commit message linter so the process gets blocked halfway. The solution is to wait a minute until this happens and press
Ctrl+C
to skip the linter.
It will execute the following processes:
- Bootstrap packages.
- Compile the code.
- Run linter.
- Run tests.
- Lerna publish.
Lerna will take care of publishing to NPM and releasing in GitHub.
To update the changelog after release:
npm run changeloggit add CHANGELOG.mdgit commit -m "chore: changelog"