Contributing

How can you contribute to this project? Guidelines for PRs, suggestions, etc.

Setup development environment

Use the Node version defined in the .nvmrc file in the project root. If you use NVM you can do:

nvm use

Install dependencies:

yarn && yarn husky

Build code into ./dist directory:

yarn build

Build code with watch:

yarn dev

Naming branches

A branch should be called what it does or what it is, e.g. you created a random number function so the branch could be called add-random-number-function. Keep it simple, understandable, and somewhat short.

Testing

Everything should be tested. The recommended approach is to think what you want to do and author unit tests using jest that will confirm that you have successfully done it. In addition to unit testing you should also ensure that all of the end-to-end (e2e) tests powered by playwright are still green, and in the instance where you have made modifications to the flow add or update the tests accordingly.

Run both unit and e2e tests once:

yarn test

Unit tests

Any and all unit tests should be created in /test/unit and be named according to what you are testing, e.g. the createStorageModule.test.ts is a test for createStorageModule.ts.

Run unit tests:

# Once
yarn test:unit

# Watch for changes
yarn test:unit --watch

e2e tests

e2e tests should be created in /test/e2e and be named to indicate what it is supposed to test, e.g. oauthPkceFlowIdentityServer.spec.ts.

Run e2e tests:

yarn test:e2e

Sadly playwright does not currently support a watch mode like jest does so when you want to check if you have broken something or made something work for the very first time you need to rerun yarn test:e2e.

Release

The library is published to npm and the documentation is published to GitHub pages when a new release tag is created.

To create a new release, create a new branch and set it's upstream origin. Then run:

yarn version patch|minor|major # This bumps the version in the versioned files, e.g. yarn version minor will bump version to the next minor version number
yarn tag # This will commit the version bump and create a tag in git with the new version. The commit and the tag will be pushed to the origin remote.

Create a pull request for the new branch into main.

After the pull request is merged, create a new release tag (with automated changlog in the description).