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.
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
Just run:
pnpm build
Run:
pnpm run docs
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
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
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.
-
Create an
.env
file inside theexample
folder according to .env.example. -
Install dependencies and build the SDK (inside the root folder):
pnpm install pnpm build
-
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.
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:
- @semantic-release/commit-analyzer
- @semantic-release/release-notes-generator
- @semantic-release/changelog
- @semantic-release/npm
- @semantic-release/github
The workflow must be approved by one of the maintainers, first.