A JavaScript client library for the Duffel API.
Content
- Node >= 18.16.0
You can install the dependencies for this library by executing the following command:
yarn install
You can run the test suite for this library by executing the following command:
yarn test
You can run the linters configured for this library by executing the following command:
yarn lint
You can install this library into your current project by executing the following command:
yarn add @duffel/api
If you need to create a new API operation class, just type yarn generate:operation
and you will be prompted with a few questions. This script will create the relevant operation folder and files for you.
To be able to publish the correct version to npm, this project is currently following Angular conventional commit message guidelines which is based on conventional commits. This commit message guideline allows the semantic-release GitHub action to be triggered.
Before creating a commit you should run a husky hook which will check if the commit structure is valid or not. If you don't want to create the commit manually, you can use yarn commit
which will use commitzen
to help you out creating the message.
Every time a commit is merged to main, a GitHub Action is run to analyse the commit messages with semantic-release
and automatically update the current version to be deployed by following semantic versioning. When the deployment is complete, the action updates the package version, using Duffel's machine user (@duffel-bot
) as the author, and this change will be automatically approved by the GitHub Action via the [autoapprove
workflow] (../.github/workflows/autoapprove.yml).
- Developer opens pull request to main
- Pull request is merged
- GitHub Actions are triggered and the commits are analysed
- if there's a breaking change, bump the major version
- if there's a feature commit, bump the minor version
- if there's a fix, bump the patch version
- Deploy the new version a. Publish to npm b. Create and push a git tag c. Publish a GitHub release with the relevant commits and descriptions
- After the release is published then a pull request is automatically created and approved via a GitHub Action to bump the package version
You can learn more about the Duffel API and this library in our documentation.