You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/contributing.md
+49-39Lines changed: 49 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,5 @@
1
1
# Contributing to thirdweb
2
2
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
-
7
3
## Getting Started
8
4
9
5
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
12
8
13
9
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.
14
10
15
-
<br/>
11
+
<br/>
16
12
17
13
## How this repo works
18
14
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.
20
16
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.
22
18
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).**
|[/sdk](./legacy_packages/sdk)| Best in class web3 SDK for Browser, Node and Mobile apps | <ahref="https://www.npmjs.com/package/@thirdweb-dev/sdk"><imgsrc="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 | <ahref="https://www.npmjs.com/package/@thirdweb-dev/react"><imgsrc="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 | <ahref="https://www.npmjs.com/package/@thirdweb-dev/auth"><imgsrc="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 | <ahref="https://www.npmjs.com/package/@thirdweb-dev/storage"><imgsrc="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 | <ahref="https://www.npmjs.com/package/thirdweb"><imgsrc="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 />
32
24
33
25
## How to contribute
34
26
35
27
Let's explore how you can set up the repo on your local machine and start contributing!
36
28
37
29
This section requires some existing knowledge of [Git](https://git-scm.com/), [Node.js](https://nodejs.org/en/) and [pnpm](https://pnpm.io/).
38
30
39
-
<br/>
31
+
<br/>
40
32
41
33
### Getting the repo
42
34
@@ -50,67 +42,86 @@ To begin:
50
42
51
43
3. Create a new branch on your fork to start working on your changes:
52
44
53
-
```
54
-
git checkout -b MY_BRANCH_NAME
45
+
```bash
46
+
git checkout -b <YOUR BRANCH NAME>
55
47
```
56
48
57
49
4. Install the dependencies:
58
-
```
50
+
```bash
59
51
pnpm install
60
52
```
61
53
If you are on windows, use the `--ignore-scripts` flag
62
-
```
54
+
```bash
63
55
pnpm install --ignore-scripts
64
56
```
65
57
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!
67
59
68
60
<br/>
69
61
70
62
### Test Your Changes
71
63
72
-
We use [yalc](https://github.com/wclr/yalc) to test changes locally.
64
+
#### Writing Unit Tests
73
65
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):
75
69
76
70
```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
78
82
```
79
83
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
81
87
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:
83
91
84
92
```bash
85
-
npx thirdweb create --app
93
+
pnpm add yalc -g
86
94
```
87
95
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:
89
100
90
101
```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
94
103
```
95
104
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:
97
106
98
107
```bash
99
-
pnpm push
108
+
yalc add thirdweb
100
109
```
101
110
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`
103
114
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:
105
116
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.
107
118
2. Restart the development server.
108
119
109
120
#### Testing from npm
110
121
111
122
You can also test your changes by publishing a dev package to npm and adding your package as you normally do in your projects.
112
123
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.
114
125
115
126
You can see the action progress in GitHub's `Actions` tab, look for the workflow: `release-pr`.
116
127
@@ -154,9 +165,8 @@ git commit -am "My commit message"
154
165
3. Push your changes to the SDK:
155
166
156
167
```
157
-
git push origin MY_BRANCH_NAME
168
+
git push origin <YOUR BRANCH NAME>
158
169
```
159
170
160
171
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.
161
172
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