Skip to content

Latest commit

 

History

History
96 lines (62 loc) · 2.91 KB

contributing.md

File metadata and controls

96 lines (62 loc) · 2.91 KB

Contributing to FingerprintJS Server API Node.js SDK

Working with code

We prefer using 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 regenerate the types

Run the following command that will regenerate types:

pnpm generateTypes

It uses schema stored in res/schema.json. To fetch the latest schema run:

./sync.sh

How to build

Just run:

pnpm build

How to build API reference documentation

Run:

pnpm run docs

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

Running tests

Tests are located in tests folder and run by jest in node environment.

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

pnpm test

Testing the local source code of the SDK

Use the example folder to make API requests using the local version of the SDK. The example/package.json file reroutes the SDK import references to the project root folder.

  1. Create an .env file inside the example folder according to .env.example.

  2. Install dependencies and build the SDK (inside the root folder):

    pnpm install
    pnpm build
  3. Install dependencies and run the examples (inside the example folder)):

    cd example
    pnpm install
    node getEvent.mjs
    node getVisitorHistory.mjs

Every time you change the SDK code, you need to rebuild it in the root folder using pnpm build and then run the example again.

How to publish

The library is automatically released and published to NPM on every push to the main branch if there are relevant changes using semantic-release with following plugins:

The workflow must be approved by one of the maintainers, first.