| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 250281d commit 6514ba4
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,8 +5,6 @@ | |||
| 5 | 5 | ||
| 6 | 6 | - [Requirements](#requirements) | |
| 7 | 7 | - [Linux-specific requirements](#linux-specific-requirements) | |
| 8 | - - [Creating pull requests](#creating-pull-requests) | ||
| 9 | - - [Commits and commit history](#commits-and-commit-history) | ||
| 10 | 8 | - [Development workflow](#development-workflow) | |
| 11 | 9 | - [Version updates to Code](#version-updates-to-code) | |
| 12 | 10 | - [Patching Code](#patching-code) | |
@@ -28,13 +26,10 @@ | |||
| 28 | 26 | <!-- END doctoc generated TOC please keep comment here to allow auto update --> | |
| 29 | 27 | <!-- prettier-ignore-end --> | |
| 30 | 28 | ||
| 31 | - - [Detailed CI and build process docs](../ci) | ||
| 32 | - | ||
| 33 | 29 | ## Requirements | |
| 34 | 30 | ||
| 35 | 31 | 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). | ||
| 38 | 33 | Here is what is needed: | |
| 39 | 34 | ||
| 40 | 35 | - `node` v20.x | |
@@ -60,30 +55,15 @@ Here is what is needed: | |||
| 60 | 55 | ||
| 61 | 56 | ### Linux-specific requirements | |
| 62 | 57 | ||
| 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: | ||
| 64 | 60 | ||
| 65 | 61 | ```shell | |
| 66 | 62 | sudo apt-get install build-essential g++ libx11-dev libxkbfile-dev libsecret-1-dev libkrb5-dev python-is-python3 | |
| 67 | 63 | ``` | |
| 68 | 64 | ||
| 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. | ||
| 87 | 67 | ||
| 88 | 68 | ## Development workflow | |
| 89 | 69 | ||
@@ -99,55 +79,62 @@ need to apply them with `quilt`. If you pull down changes that update the | |||
| 99 | 79 | `vscode` submodule you will need to run `git submodule update --init` and | |
| 100 | 80 | re-apply the patches. | |
| 101 | 81 | ||
| 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. | ||
| 103 | 84 | ||
| 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. | ||
| 116 | 87 | ||
| 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. | ||
| 119 | 90 | ||
| 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 | ||
| 123 | 96 | ||
| 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. | ||
| 125 | 108 | ||
| 126 | 109 | ### Patching Code | |
| 127 | 110 | ||
| 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 | ||
| 131 | 114 | **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 | ||
| 133 | 116 | each patch must result in a working code-server without any broken in-between | |
| 134 | 117 | 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 | ||
| 137 | 120 | reproduce the behavior it fixes or adds. Every patch should have an e2e test | |
| 138 | 121 | as well. | |
| 139 | 122 | ||
| 140 | 123 | ### Build | |
| 141 | 124 | ||
| 142 | - You can build as follows: | ||
| 125 | + You can build a full production as follows: | ||
| 143 | 126 | ||
| 144 | 127 | ```shell | |
| 128 | + git submodule update --init | ||
| 129 | + quilt push -a | ||
| 130 | + yarn install | ||
| 145 | 131 | yarn build | |
| 146 | - yarn build:vscode | ||
| 132 | + VERSION=0.0.0 yarn build:vscode | ||
| 147 | 133 | yarn release | |
| 148 | 134 | ``` | |
| 149 | 135 | ||
| 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` | ||
| 151 | 138 | ||
| 152 | 139 | Run your build: | |
| 153 | 140 | ||
@@ -158,7 +145,7 @@ npm install --omit=dev # Skip if you used KEEP_MODULES=1 | |||
| 158 | 145 | node . | |
| 159 | 146 | ``` | |
| 160 | 147 | ||
| 161 | - Build the release packages (make sure that you run `yarn release` first): | ||
| 148 | + Then, to build the release package: | ||
| 162 | 149 | ||
| 163 | 150 | ```shell | |
| 164 | 151 | yarn release:standalone | |
@@ -167,7 +154,7 @@ yarn package | |||
| 167 | 154 | ``` | |
| 168 | 155 | ||
| 169 | 156 | > 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. | ||
| 171 | 158 | > If you need your builds to support older distros, run the build commands | |
| 172 | 159 | > inside a Docker container with all the build requirements installed. | |
| 173 | 160 | ||
@@ -181,27 +168,32 @@ writing, we do this for the following platforms/architectures: | |||
| 181 | 168 | - Linux arm7l (.tar.gz) | |
| 182 | 169 | - Linux armhf.deb | |
| 183 | 170 | - Linux armhf.rpm | |
| 184 | - - macOS amd64 (Intel-based) | ||
| 171 | + - macOS arm64.tar.gz | ||
| 185 | 172 | ||
| 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 | ||
| 187 | 174 | in the `release.yaml` workflow. We then upload them to the draft release and | |
| 188 | 175 | distribute via GitHub Releases. | |
| 189 | 176 | ||
| 190 | 177 | ### Troubleshooting | |
| 191 | 178 | ||
| 192 | 179 | #### I see "Forbidden access" when I load code-server in the browser | |
| 193 | 180 | ||
| 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. | ||
| 195 | 183 | ||
| 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`. | ||
| 197 | 186 | ||
| 198 | 187 | #### "Can only have one anonymous define call per script" | |
| 199 | 188 | ||
| 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`. | ||
| 201 | 191 | ||
| 202 | 192 | ### Help | |
| 203 | 193 | ||
| 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. | ||
| 205 | 197 | ||
| 206 | 198 | ## Test | |
| 207 | 199 | ||
@@ -219,20 +211,24 @@ Our unit tests are written in TypeScript and run using | |||
| 219 | 211 | ||
| 220 | 212 | These live under [test/unit](../test/unit). | |
| 221 | 213 | ||
| 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. | ||
| 223 | 217 | ||
| 224 | 218 | ### Script tests | |
| 225 | 219 | ||
| 226 | 220 | Our script tests are written in bash and run using [bats](https://github.com/bats-core/bats-core). | |
| 227 | 221 | ||
| 228 | 222 | These tests live under `test/scripts`. | |
| 229 | 223 | ||
| 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`). | ||
| 231 | 226 | ||
| 232 | 227 | ### Integration tests | |
| 233 | 228 | ||
| 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. | ||
| 236 | 232 | ||
| 237 | 233 | Our integration tests look at components that rely on one another. For example, | |
| 238 | 234 | 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 | |||
| 253 | 249 | We also have a model where you can create helpers to use within tests. See | |
| 254 | 250 | [models/CodeServer.ts](../test/e2e/models/CodeServer.ts) for an example. | |
| 255 | 251 | ||
| 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 | - | ||
| 261 | 252 | ## Structure | |
| 262 | 253 | ||
| 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. | ||
| 265 | 256 | ||
| 266 | 257 | The CLI code is in [src/node](../src/node) and the HTTP routes are implemented | |
| 267 | 258 | in [src/node/routes](../src/node/routes). | |
| Back | FazBrowse Home | New Git URL |
0 commit comments