You can find a full video tutorial on how to contribute to thirdweb below:
https://www.youtube.com/watch?v=TXsQ3qok3B0
To get started, read the How this repo works section below to learn about the structure of this repo.
From there, you can take a look at our Good First Issues board and find an issue that interests you!
If you have any questions about the issue, feel free to ask on our Discord server in the #contributors
channel; where you'll be able to get help from our team and other contributors.
@thirdweb-dev/js is a monorepo, meaning it contains many projects within it.
We use Turborepo to manage the monorepo, and help speed up the CI/CD pipeline to ship to production faster 🚢.
You can see a quick outline of each of the projects within this repo below, each living within the /packages directory:
Package | Description | Latest Version |
---|---|---|
/sdk | Best in class web3 SDK for Browser, Node and Mobile apps | |
/react | Ultimate collection of React hooks for your web3 apps | |
/auth | Best in class wallet authentication for Node backends | |
/storage | Best in class decentralized storage SDK for Browser and Node | |
/cli | Publish and deploy smart contracts without dealing with private keys |
Let's explore how you can set up the repo on your local machine and start contributing!
This section requires some existing knowledge of Git, Node.js and pnpm.
For OSS contributions, we use a Forking Workflow, meaning each developer will fork the repo and work on their own fork; and then submit a PR to the main repo when they're ready to merge their changes.
To begin:
-
Create a fork of this repository to your own GitHub account.
-
Clone your fork to your local device.
-
Create a new branch on your fork to start working on your changes:
git checkout -b MY_BRANCH_NAME
-
Install the dependencies:
pnpm install
If you are on windows, use the
--ignore-scripts
flagpnpm install --ignore-scripts
Now you have got the repo on your local machine, and you're ready to start making your changes!
We use yalc to test changes locally.
Install the yalc CLI globally:
pnpm add yalc -g
First, create a test project where you can experiment with your changes:
You can create a basic starter project with the sdk
and react
packages installed using the CLI:
npx thirdweb create --app
Use yalc
to link your local changes in the monorepo to the test project, by running the following command from your test repo:
yalc add @thirdweb-dev/react # Link the react package
yalc add @thirdweb-dev/sdk # Link the sdk package
# etc...
From the monorepo, run the following command to publish your local changes to the test project:
pnpm push
Now, each time you make a change to the monorepo, you can run pnpm push
to publish your changes to the test project.
In your test project, you need to:
- Delete the dependencies cache. If you're using Next.js, that is the
.next
directory, and if you're using CRA, that is thenode_modules/.cache
directory. - Restart the development server.
You can also test your changes by publishing a dev package to npm and adding your package as you normally do in your projects.
Once you have your PR up you can add a comment with the text: /release-pr
. This will trigger a GitHub action that will publish a dev version to npm.
You can see the action progress in GitHub's Actions
tab, look for the workflow: release-pr
.
Once the action finishes executing, select it, click on deploy and look for the Deploy pre-release
item. Scroll all the way to the bottom and you should see something like:
success packages published successfully:
🦋 @***-dev/[email protected]
🦋 @***-dev/[email protected]
...
These are the versions the GH action published to npm for testing purposes. Let's assume you're working on the @thirdweb-dev/react
package, you can then run:
yarn add @thirdweb-dev/[email protected]
to install the dev package.
Once you're satisfied with your changes, you are ready to submit them for review!
- Use changeset to generate a changeset file:
pnpm changeset
We follow semantic versioning for generating versioned releases of our packages (i.e. version = MAJOR.MINOR.PATCH
)
- Update
major
for breaking changes - Update
minor
for new features, - Update
patch
for non-breaking bug fixes, etc)
- Commit the changeset along with your changes:
git commit -am "My commit message"
- Push your changes to the SDK:
git push origin MY_BRANCH_NAME
- Create a pull request to the
main
branch of the official (not your fork) SDK repo.
It's helpful to tag PRs with [SDK]
, [REACT]
, [AUTH]
, (the name of the package you're modifying) to indicate the package that you are engaging with.