Thanks you for considering a contribution to FocusTrap!
FocusTrap is built using tools written for nodejs. We recommend installing Node with nvm. Dependencies are managed through package.json
.
You use the same node version we are developing with by running
nvm use
You may need to run
nvm install
if you haven't installed the node version we require.
All commands should be run using yarn. If you haven't switched to yarn yet, now's a great time!
If you are familiar with npm then using yarn should be a breeze. You can keep using npm if you'd prefer but you will miss out on the safety and security of yarn
A production build can be built by running:
yarn build
However most of the time developing with FocusTrap, you will want to work from the example app. Boot that up with:
yarn start
This will host a local development server at http://localhost:8080
.
FocusTrap uses Karma. You can run tests with:
yarn test
We use prettier to ensure consistent style across all packages. Automated tests continually check that code formatting is consistent, failing the build if it is not. Make sure this doesn't happen by running:
yarn format
Additionally, we aspire for 100% code coverage. However 100% code coverage is not a foolproof indicator of good testing. Tests that cover as much surface area as possible (for the sake of coverage) should be avoided. This is a much softer measure than a style guide, and will fall to code review for enforcement.
All changes should be submitted through pull request. Ideally, at least two 👍s should be given before a pull request is merge.