Hello! Thanks for your interest in contributing! Before implementing new features and changes please create an issue so we can have a discussion about it!
Unlike other libraries, most of the code here is not handwritten. We actually use @ordercloud/oc-codegen to generate the code based on a set of templates located in /codegen/
. This tool uses OrderCloud's OpenAPI specification along with the templates to generate the full SDK. That means most of your time should be spent in the /codegen/
folder. Any direct changes in /src/
will simply be overwritten when you run npm run build
.
The source of the data comes from the open api spec but then the oc-codegen library massages the data to make it easier to work with. That library exposes "hooks" which allow us to step in and do our own processind during that data massage layer. In our case we add javascript/typescript specific properties that allow us to build a rich SDK. All of our hooks are available in a single file codegen/hooks.ts
To view the template data simply run the following command which will output the data to templateData.json
at the root of the project.
npm run debug-template-data
After updating the templates/hooks you can generate the code which will be output in the src/
directory
npm run generate-sdk
- Fork this repository
- Create a new branch with the name of the feature you plan to work on
- Install dependencies
- Make your changes. Note: all of your changes should be to files in
/codegen
and not directly to any of the files insrc/
as those files get overwritten when the code is generated. - Run
npm run build
to regenerate the sdk, compile the code, run the tests, and generate the docs - Verify your changes work as expected. Run
npm install /path/to/this/folder
in a different project to install locally and test - Update the changelog
- Commit your changes. We adhere to the gitmoji standard
- Update the sdk version in the package.json and make a separate version commit in the format
:bookmark: v{newVersionHere}
- Create a pull request
- Have a beer! 🍺
Assuming you or a contributor followed the instructions for submitting a pull request and are a maintainer you can follow these instructions to release a new version of the sdk.
- Verify the version has been bumped and adheres to semantic versioning
- Verify the changelog has been updated
- Merge the pull request
- Create a new release on github with a new git tag.
- Run
npm publish --dry-run
for a preview, ornpm publish
. - Have a beer! 🍻