Skip to content

Latest commit

 

History

History
98 lines (64 loc) · 2.99 KB

File metadata and controls

98 lines (64 loc) · 2.99 KB

Contributing to Fingerprint React SDK

Working with code

We use pnpm for installing dependencies and running scripts.

The main branch is locked for the push action. For proposing changes, use the standard pull request approach. It's recommended to discuss fixes or new functionality in the Issues first.

How to build

Just run:

pnpm install
pnpm build

Development playground

Six demo apps are available:

  1. create-react-app — a rich demo covering different caching strategies.
  2. next — a Next.js demo for testing SSR scenarios.
  3. next-appDir — the same Next.js demo using the app directory.
  4. preact — a Preact demo.
  5. vite — a Vite demo.
  6. webpack-based — a demo using raw webpack.

Build the SDK before building or starting an example app. From the repository root, run:

pnpm build

Build an example with pnpm --filter <package-name> build, or start it with pnpm --filter <package-name> dev.

For example:

pnpm --filter vite-example dev

Code style

The code style is controlled by ESLint and Prettier. Run to check that the code style is ok:

pnpm lint

You aren't required to run the check manually, the CI will do it. Run the following command to fix style issues (not all issues can be fixed automatically):

pnpm lint:fix

How to test

Tests are located in __tests__ folder and run by vitest in jsdom environment.

To run tests you can use IDE instruments or just run:

pnpm test

To run tests once with a coverage report:

pnpm test:coverage

To check the distributive TypeScript declarations, build the project and run:

pnpm test:dts

API reference docs

The API reference is generated from the source with TypeDoc. Regenerate it into the (git-ignored) docs/ folder with:

pnpm docs

How to publish

Releases are managed with changesets.

When you make a change that should be released, add a changeset to your pull request:

pnpm changeset

This prompts you to select the bump type (major, minor, or patch) and to write a summary that becomes the changelog entry. Commit the generated file in .changeset/ along with your changes.

When PRs with changesets are merged to main, the release workflow opens (or updates) a "Version Packages" pull request that bumps the version and updates the changelog. Merging that pull request builds the package and publishes it to NPM.