Skip to content

Commit a0e26a8

Browse files
authored
Contributing guide updates (#2833)
1 parent 2c8bdfd commit a0e26a8

File tree

1 file changed

+49
-39
lines changed

1 file changed

+49
-39
lines changed

.github/contributing.md

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Contributing to thirdweb
22

3-
You can find a full video tutorial on how to contribute to thirdweb below:
4-
5-
https://www.youtube.com/watch?v=TXsQ3qok3B0
6-
73
## Getting Started
84

95
To get started, read the [How this repo works](#how-this-repo-works) section below to learn about the structure of this repo.
@@ -12,31 +8,27 @@ From there, you can take a look at our [Good First Issues](https://github.com/th
128

139
If you have any questions about the issue, feel free to ask on our [Discord server](https://discord.gg/thirdweb) in the `#contributors` channel; where you'll be able to get help from our team and other contributors.
1410

15-
<br/>
11+
<br />
1612

1713
## How this repo works
1814

19-
[@thirdweb-dev/js](https://github.com/thirdweb-dev/js) is a monorepo, meaning it contains many projects within it.
15+
We use [Turborepo](https://turbo.build/repo/docs) to manage the repository, and help speed up the [CI/CD](https://www.atlassian.com/continuous-delivery/principles/continuous-integration-vs-delivery-vs-deployment) pipeline to ship to production faster 🚢. Turborepo is a project dependency, and doesn't need to be installed separately.
2016

21-
We use [Turborepo](https://turborepo.org/docs/getting-started) to manage the monorepo, and help speed up the [CI/CD](https://www.atlassian.com/continuous-delivery/principles/continuous-integration-vs-delivery-vs-deployment) pipeline to ship to production faster 🚢.
17+
We use [pnpm](https://pnpm.io) for package management across the repo. `pnpm` is similar to `npm` or `yarn` but with more efficient disk space usage.
2218

23-
You can see a quick outline of each of the projects within this repo below, each living within the [/packages](/packages) directory:
19+
**With the v5 SDK, we've consolidated everything into a single project at [/packages/thirdweb](./packages/thirdweb). You can still find the legacy packages at [/legacy_packages](./legacy_packages).**
2420

25-
| Package | Description | Latest Version |
26-
| ------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
27-
| [/sdk](./legacy_packages/sdk) | Best in class web3 SDK for Browser, Node and Mobile apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/sdk"><img src="https://img.shields.io/npm/v/@thirdweb-dev/sdk?color=red&label=npm&logo=npm" alt="npm version"/></a> |
28-
| [/react](./legacy_packages/react) | Ultimate collection of React hooks for your web3 apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/react"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react?color=red&label=npm&logo=npm" alt="npm version"/></a> |
29-
| [/auth](./legacy_packages/auth) | Best in class wallet authentication for Node backends | <a href="https://www.npmjs.com/package/@thirdweb-dev/auth"><img src="https://img.shields.io/npm/v/@thirdweb-dev/auth?color=red&label=npm&logo=npm" alt="npm version"/></a> |
30-
| [/storage](./legacy_packages/storage) | Best in class decentralized storage SDK for Browser and Node | <a href="https://www.npmjs.com/package/@thirdweb-dev/storage"><img src="https://img.shields.io/npm/v/@thirdweb-dev/storage?color=red&label=npm&logo=npm" alt="npm version"/></a> |
31-
| [/cli](./legacy_packages/cli) | Publish and deploy smart contracts without dealing with private keys | <a href="https://www.npmjs.com/package/thirdweb"><img src="https://img.shields.io/npm/v/thirdweb?color=red&label=npm&logo=npm" alt="npm version"/></a> |
21+
This single package provides a performant & lightweight SDK to interact with any EVM chain across Node, React, and React Native. Learn more about how to use the thirdweb SDK in our [documentation](https://portal.thirdweb.com/typescript/v5).
22+
23+
<br />
3224

3325
## How to contribute
3426

3527
Let's explore how you can set up the repo on your local machine and start contributing!
3628

3729
This section requires some existing knowledge of [Git](https://git-scm.com/), [Node.js](https://nodejs.org/en/) and [pnpm](https://pnpm.io/).
3830

39-
<br/>
31+
<br />
4032

4133
### Getting the repo
4234

@@ -50,67 +42,86 @@ To begin:
5042

5143
3. Create a new branch on your fork to start working on your changes:
5244

53-
```
54-
git checkout -b MY_BRANCH_NAME
45+
```bash
46+
git checkout -b <YOUR BRANCH NAME>
5547
```
5648

5749
4. Install the dependencies:
58-
```
50+
```bash
5951
pnpm install
6052
```
6153
If you are on windows, use the `--ignore-scripts` flag
62-
```
54+
```bash
6355
pnpm install --ignore-scripts
6456
```
6557

66-
Now you have got the repo on your local machine, and you're ready to start making your changes!
58+
Now you have the repo on your local machine, and you're ready to start making your changes!
6759

6860
<br/>
6961

7062
### Test Your Changes
7163

72-
We use [yalc](https://github.com/wclr/yalc) to test changes locally.
64+
#### Writing Unit Tests
7365

74-
Install the yalc CLI globally:
66+
Try to include unit test coverage with your changes where appropriate. We use `vitest` for testing, look for files with the `.test.ts` extension for examples of how to structure your unit tests.
67+
68+
To run your tests, run the following from the package directory (most likely /packages/thirdweb):
7569

7670
```bash
77-
pnpm add yalc -g
71+
pnpm test:dev <YOUR TEST FILE PATH>
72+
```
73+
74+
> Specifying your test file path is optional, but will save time by only running specific tests each time. Before opening your PR, run `pnpm test` from the monorepo root (without specifying your test file) to ensure your changes didn't break any existing tests.
75+
76+
#### Linting
77+
78+
We use a linter to maintain best practices across projects. Once your changes are complete (or periodically while making changes), run the linter with the following command from the repo root:
79+
80+
```bash
81+
pnpm lint
7882
```
7983

80-
First, create a test project where you can experiment with your changes:
84+
If there are errors, try running `pnpm fix` to auto-fix any basic errors. Other linter errors, like missing documentation, will need to be fixed manually. See existing files for examples of inline documentation.
85+
86+
#### Creating a Local Test Project
8187

82-
You can create a basic starter project with the `sdk` and `react` packages installed using the CLI:
88+
You can use [yalc](https://github.com/wclr/yalc) to test changes on a local project.
89+
90+
Install the yalc CLI globally:
8391

8492
```bash
85-
npx thirdweb create --app
93+
pnpm add yalc -g
8694
```
8795

88-
Use `yalc` to link your local changes in the monorepo to the test project, by running the following command from your test repo:
96+
First, create a test project where you can experiment with your changes. This can be any node project that uses your changes.
97+
98+
99+
Push your local version to your `yalc` store with:
89100

90101
```bash
91-
yalc add @thirdweb-dev/react # Link the react package
92-
yalc add @thirdweb-dev/sdk # Link the sdk package
93-
# etc...
102+
pnpm build && pnpm push
94103
```
95104

96-
From the monorepo, run the following command to publish your local changes to the test project:
105+
Link your local changes in the monorepo to the test project by running the following command from your test repo:
97106

98107
```bash
99-
pnpm push
108+
yalc add thirdweb
100109
```
101110

102-
Now, each time you make a change to the monorepo, you can run `pnpm push` to publish your changes to the test project.
111+
Now, each time you make a change to the monorepo, you can run `pnpm push` from the monorepo then `yalc update thirdweb` from your test project to publish your latest changes to the test project.
112+
113+
If your changes modify dependencies, you may need to reinstall dependencies on your test project with `pnpm install`
103114

104-
In your test project, you need to:
115+
To make sure your latest changes are used, in your test project you may need to:
105116

106-
1. Delete the dependencies cache. If you're using Next.js, that is the `.next` directory, and if you're using CRA, that is the `node_modules/.cache` directory.
117+
1. Delete the dependencies cache. If you're using Next.js, that's the `.next` directory, and if you're using CRA, that's the `node_modules/.cache` directory.
107118
2. Restart the development server.
108119

109120
#### Testing from npm
110121

111122
You can also test your changes by publishing a dev package to npm and adding your package as you normally do in your projects.
112123

113-
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.
124+
**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.
114125

115126
You can see the action progress in GitHub's `Actions` tab, look for the workflow: `release-pr`.
116127

@@ -154,9 +165,8 @@ git commit -am "My commit message"
154165
3. Push your changes to the SDK:
155166

156167
```
157-
git push origin MY_BRANCH_NAME
168+
git push origin <YOUR BRANCH NAME>
158169
```
159170

160171
4. Create a [pull request](https://www.atlassian.com/git/tutorials/making-a-pull-request) to the `main` branch of the official (not your fork) SDK repo.
161172

162-
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.

0 commit comments

Comments
 (0)