Skip to content

Commit 6514ba4

Browse files
committed
Update contributing docs
1 parent 250281d commit 6514ba4

File tree

2 files changed

+103
-217
lines changed

2 files changed

+103
-217
lines changed

docs/CONTRIBUTING.md

+63-72
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
- [Requirements](#requirements)
77
- [Linux-specific requirements](#linux-specific-requirements)
8-
- [Creating pull requests](#creating-pull-requests)
9-
- [Commits and commit history](#commits-and-commit-history)
108
- [Development workflow](#development-workflow)
119
- [Version updates to Code](#version-updates-to-code)
1210
- [Patching Code](#patching-code)
@@ -28,13 +26,10 @@
2826
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
2927
<!-- prettier-ignore-end -->
3028

31-
- [Detailed CI and build process docs](../ci)
32-
3329
## Requirements
3430

3531
The prerequisites for contributing to code-server are almost the same as those
36-
for [VS
37-
Code](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites).
32+
for [VS Code](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites).
3833
Here is what is needed:
3934

4035
- `node` v20.x
@@ -60,30 +55,15 @@ Here is what is needed:
6055

6156
### Linux-specific requirements
6257

63-
If you're developing code-server on Linux, make sure you have installed or install the following dependencies:
58+
If you're developing code-server on Linux, make sure you have installed or
59+
install the following dependencies:
6460

6561
```shell
6662
sudo apt-get install build-essential g++ libx11-dev libxkbfile-dev libsecret-1-dev libkrb5-dev python-is-python3
6763
```
6864

69-
These are required by Code. See [their Wiki](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites) for more information.
70-
71-
## Creating pull requests
72-
73-
Please create a [GitHub Issue](https://github.com/coder/code-server/issues) that
74-
includes context for issues that you see. You can skip this if the proposed fix
75-
is minor.
76-
77-
In your pull requests (PR), link to the issue that the PR solves.
78-
79-
Please ensure that the base of your PR is the **main** branch.
80-
81-
### Commits and commit history
82-
83-
We prefer a clean commit history. This means you should squash all fixups and
84-
fixup-type commits before asking for a review (e.g., clean up, squash, then force
85-
push). If you need help with this, feel free to leave a comment in your PR, and
86-
we'll guide you.
65+
These are required by Code. See [their Wiki](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites)
66+
for more information.
8767

8868
## Development workflow
8969

@@ -99,55 +79,62 @@ need to apply them with `quilt`. If you pull down changes that update the
9979
`vscode` submodule you will need to run `git submodule update --init` and
10080
re-apply the patches.
10181

102-
### Version updates to Code
82+
When you make a change that affects people deploying the marketplace please
83+
update the changelog as part of your PR.
10384

104-
1. Update the `lib/vscode` submodule to the desired upstream version branch.
105-
1. `cd lib/vscode && git checkout release/1.66 && cd ../..`
106-
2. `git add lib && git commit -m "chore: update Code"`
107-
2. Apply the patches (`quilt push -a`) or restore your stashed changes. At this
108-
stage you may need to resolve conflicts. For example use `quilt push -f`,
109-
manually apply the rejected portions, then `quilt refresh`.
110-
3. From the code-server **project root**, run `yarn install`.
111-
4. Test code-server locally to make sure everything works.
112-
5. Check the Node.js version that's used by Electron (which is shipped with VS
113-
Code. If necessary, update your version of Node.js to match.
114-
6. Commit the updated submodule and patches to `code-server`.
115-
7. Open a PR.
85+
Note that building code-server takes a very, very long time, and loading it in
86+
the browser in development mode also takes a very, very long time.
11687

117-
Tip: if you're certain all patches are applied correctly and you simply need to
118-
refresh, you can use this trick:
88+
Display language (Spanish, etc) support only works in a full build; it will not
89+
work in development mode.
11990

120-
```shell
121-
while quilt push; do quilt refresh; done
122-
```
91+
Generally we prefer that PRs be squashed into `main` but you can rebase or merge
92+
if it is important to keep the individual commits (make sure to clean up the
93+
commits first if you are doing this).
94+
95+
### Version updates to Code
12396

124-
[Source](https://raphaelhertzog.com/2012/08/08/how-to-use-quilt-to-manage-patches-in-debian-packages/)
97+
1. Remove any patches with `quilt pop -a`.
98+
2. Update the `lib/vscode` submodule to the desired upstream version branch.
99+
1. `cd lib/vscode && git checkout release/1.66 && cd ../..`
100+
2. `git add lib && git commit -m "chore: update to Code <version>"`
101+
3. Apply the patches one at a time (`quilt push`). If the application succeeds
102+
but the lines changed, update the patch with `quilt refresh`. If there are
103+
conflicts, then force apply with `quilt push -f`, manually add back the
104+
rejected code, then run `quilt refresh`.
105+
4. From the code-server **project root**, run `yarn install`.
106+
5. Check the Node.js version that's used by Electron (which is shipped with VS
107+
Code. If necessary, update our version of Node.js to match.
125108

126109
### Patching Code
127110

128-
0. You can go through the patch stack with `quilt push` and `quilt pop`.
129-
1. Create a new patch (`quilt new {name}.diff`) or use an existing patch.
130-
1. Add the file(s) you are patching (`quilt add [-P patch] {file}`). A file
111+
1. You can go through the patch stack with `quilt push` and `quilt pop`.
112+
2. Create a new patch (`quilt new {name}.diff`) or use an existing patch.
113+
3. Add the file(s) you are patching (`quilt add [-P patch] {file}`). A file
131114
**must** be added before you make changes to it.
132-
1. Make your changes. Patches do not need to be independent of each other but
115+
4. Make your changes. Patches do not need to be independent of each other but
133116
each patch must result in a working code-server without any broken in-between
134117
states otherwise they are difficult to test and modify.
135-
1. Add your changes to the patch (`quilt refresh`)
136-
1. Add a comment in the patch about the reason for the patch and how to
118+
5. Add your changes to the patch (`quilt refresh`)
119+
6. Add a comment in the patch about the reason for the patch and how to
137120
reproduce the behavior it fixes or adds. Every patch should have an e2e test
138121
as well.
139122

140123
### Build
141124

142-
You can build as follows:
125+
You can build a full production as follows:
143126

144127
```shell
128+
git submodule update --init
129+
quilt push -a
130+
yarn install
145131
yarn build
146-
yarn build:vscode
132+
VERSION=0.0.0 yarn build:vscode
147133
yarn release
148134
```
149135

150-
_NOTE: this does not keep `node_modules`. If you want them to be kept, use `KEEP_MODULES=1 yarn release` (if you're testing in Coder, you'll want to do this)_
136+
This does not keep `node_modules`. If you want them to be kept, use
137+
`KEEP_MODULES=1 yarn release`
151138

152139
Run your build:
153140

@@ -158,7 +145,7 @@ npm install --omit=dev # Skip if you used KEEP_MODULES=1
158145
node .
159146
```
160147

161-
Build the release packages (make sure that you run `yarn release` first):
148+
Then, to build the release package:
162149

163150
```shell
164151
yarn release:standalone
@@ -167,7 +154,7 @@ yarn package
167154
```
168155

169156
> On Linux, the currently running distro will become the minimum supported
170-
> version. In our GitHub Actions CI, we use CentOS 7 for maximum compatibility.
157+
> version. In our GitHub Actions CI, we use CentOS 8 for maximum compatibility.
171158
> If you need your builds to support older distros, run the build commands
172159
> inside a Docker container with all the build requirements installed.
173160
@@ -181,27 +168,32 @@ writing, we do this for the following platforms/architectures:
181168
- Linux arm7l (.tar.gz)
182169
- Linux armhf.deb
183170
- Linux armhf.rpm
184-
- macOS amd64 (Intel-based)
171+
- macOS arm64.tar.gz
185172

186-
Currently, these are compiled in CI using the `yarn release-standalone` command
173+
Currently, these are compiled in CI using the `yarn release:standalone` command
187174
in the `release.yaml` workflow. We then upload them to the draft release and
188175
distribute via GitHub Releases.
189176

190177
### Troubleshooting
191178

192179
#### I see "Forbidden access" when I load code-server in the browser
193180

194-
This means your patches didn't apply correctly. We have a patch to remove the auth from vanilla Code because we use our own.
181+
This means your patches didn't apply correctly. We have a patch to remove the
182+
auth from vanilla Code because we use our own.
195183

196-
Try popping off the patches with `quilt pop -a` and reapplying with `quilt push -a`.
184+
Try popping off the patches with `quilt pop -a` and reapplying with `quilt push
185+
-a`.
197186

198187
#### "Can only have one anonymous define call per script"
199188

200-
Code might be trying to use a dev or prod HTML in the wrong context. You can try re-running code-server and setting `VSCODE_DEV=1`.
189+
Code might be trying to use a dev or prod HTML in the wrong context. You can try
190+
re-running code-server and setting `VSCODE_DEV=1`.
201191

202192
### Help
203193

204-
If you get stuck or need help, you can always start a new GitHub Discussion [here](https://github.com/coder/code-server/discussions). One of the maintainers will respond and help you out.
194+
If you get stuck or need help, you can always start a new GitHub Discussion
195+
[here](https://github.com/coder/code-server/discussions). One of the maintainers
196+
will respond and help you out.
205197

206198
## Test
207199

@@ -219,20 +211,24 @@ Our unit tests are written in TypeScript and run using
219211

220212
These live under [test/unit](../test/unit).
221213

222-
We use unit tests for functions and things that can be tested in isolation. The file structure is modeled closely after `/src` so it's easy for people to know where test files should live.
214+
We use unit tests for functions and things that can be tested in isolation. The
215+
file structure is modeled closely after `/src` so it's easy for people to know
216+
where test files should live.
223217

224218
### Script tests
225219

226220
Our script tests are written in bash and run using [bats](https://github.com/bats-core/bats-core).
227221

228222
These tests live under `test/scripts`.
229223

230-
We use these to test anything related to our scripts (most of which live under `ci`).
224+
We use these to test anything related to our scripts (most of which live under
225+
`ci`).
231226

232227
### Integration tests
233228

234-
These are a work in progress. We build code-server and run tests with `yarn test:integration`, which ensures that code-server builds work on their respective
235-
platforms.
229+
These are a work in progress. We build code-server and run tests with `yarn
230+
test:integration`, which ensures that code-server builds work on their
231+
respective platforms.
236232

237233
Our integration tests look at components that rely on one another. For example,
238234
testing the CLI requires us to build and package code-server.
@@ -253,15 +249,10 @@ Take a look at `codeServer.test.ts` to see how you would use it (see
253249
We also have a model where you can create helpers to use within tests. See
254250
[models/CodeServer.ts](../test/e2e/models/CodeServer.ts) for an example.
255251

256-
Generally speaking, e2e means testing code-server while running in the browser
257-
and interacting with it in a way that's similar to how a user would interact
258-
with it. When running these tests with `yarn test:e2e`, you must have
259-
code-server running locally. In CI, this is taken care of for you.
260-
261252
## Structure
262253

263-
The `code-server` script serves as an HTTP API for login and starting a remote
264-
Code process.
254+
code-server essentially serves as an HTTP API for logging in and starting a
255+
remote Code process.
265256

266257
The CLI code is in [src/node](../src/node) and the HTTP routes are implemented
267258
in [src/node/routes](../src/node/routes).

0 commit comments

Comments
 (0)