👋 Hey there! We're thrilled that you're interested in contributing to lemonsqueezy.js. Before submitting your contribution, please take a moment to read through this guide.
This repo is managed with Bun. We recommend reading the Bun documentation to learn more about it.
We utilize a variety of tools to ensure code quality, consistency, and smooth development processes.
-
Bun: for managing the repo and testing.
-
Prettier: for code formatting. Our codebase adheres to the configuration specified in
prettier.config.js
. -
ESLint: for code linting. Make sure to check and fix any linting issues before submitting your code. Our codebase linting rules are defined in
.eslintrc.cjs
. -
husky: for Git hooks. It ensures that linters, and other checks are passed before commits and pushes.
-
tsup: for bundling the library files. We bundle both ESM and CJS versions of the library.
-
Changesets: for changelog generation and release management.
Our project follows the Conventional Commits specification for commit messages.
When preparing your commits for a Pull Request, ensure they adhere to our commit message format: type(scope): description
.
Your commits should fall into one of the following categories:
-
feat
(orfeature
): Introduces new code or functionality to the project. -
fix
: Addresses and resolves a bug. Linking to an issue if available is highly encouraged. -
refactor
: Code changes that neither fix a bug nor add a feature, but improve the existing codebase. -
docs
: Updates or additions to documentation, such as README files, usage guides, etc. -
build
: Changes affecting the build system, including dependency updates and additions. -
test
: Modifications involving tests, including adding new tests or refining existing ones. -
ci
: Adjustments to our continuous integration setup, like GitHub Actions or other CI tools. -
chore
: General maintenance and organizational tasks that don't fit other categories.
For example, a commit message might look like: feat: add activateLicense function
.
Make sure you have the latest version of Bun installed in your system.
Clone this repo to your local computer and install the dependencies.
bun install
To run the development version, you can start it locally by:
bun run dev
-
Copy
.env.example
to.env
(.env
has been added to.gitignore
). -
Configure the three environment variables in the
.env
file.:LEMON_SQUEEZY_API_KEY
LEMON_SQUEEZY_STORE_ID
LEMON_SQUEEZY_LICENSE_KEY
To run all the test, you can start it locally by:
bun test
To run a specific test, you can start it locally by:
bun test test/<test-file>.ts
-
Develop in dedicated branches, not directly on the
main
branch. -
Use descriptive names for your branches. Make sure the branch name adheres to the format
[type/scope]
, likefeat/button-enhancement
ordocs/update-readme
.
-
Provide tests for new features.
-
Discuss new features in an issue or discussion topic before coding.
-
Describe the bug in detail in your PR.
-
Include steps to reproduce or a live demo if possible.
-
Link the issue your PR fixes, using the format
fix #issue_number
.
Remember, clear and detailed PRs help us efficiently review and integrate your contributions!
-
Fork and Clone: Begin by forking the main repository and cloning your fork.
-
Branching: Create a new branch off
main
using the format[type/scope]
, likefeat/button-enhancement
ordocs/update-readme
. Thetype
should align with conventional commit types. -
Development: Make your changes and commit them adhering to the commit guidelines. Use
bun run typecheck
to test your changes. -
Document Changes: Run
bun changeset
for a detailed change description. For minor updates (like CI changes), usebun changeset add --empty
. -
Submit PR: Push your branch and open a PR to the
main
branch of the main repository. Ensure all tests pass and the package builds correctly.
The functions of a category should be placed in a folder.
src
checkouts/ - the functions for `checkouts`
customers/ - the functions for `customers`
internal/ - the some `internal` methods
.../ - the other functions folders
A function folder typically contains these 2 files:
index.ts - function source code itself
types.ts - type definition
Test cases for a category of functions should be placed in a folder. There is a one-to-one correspondence with the functions folder.
test
checkouts/ - Unit tests for `checkouts` functions
customers/ - Unit tests for `customers` functions
internal/ - Unit tests for `internal` functions
.../ - Unit Tests for other functions
Thanks for all your contributions and efforts towards improving this project! You are awesome ✨!