From f18a86decea934d3447f5c5d628c20812d356801 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Fri, 30 Sep 2022 13:54:56 -0700 Subject: [PATCH 1/9] docs: add toc to CODE OF CONDUCT --- docs/CODE_OF_CONDUCT.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md index fe14b3a64000..168eac481bb7 100644 --- a/docs/CODE_OF_CONDUCT.md +++ b/docs/CODE_OF_CONDUCT.md @@ -1,5 +1,18 @@ + +# Contributor Covenant Code of Conduct + +- [Contributor Covenant Code of Conduct](#contributor-covenant-code-of-conduct) + - [Our Pledge](#our-pledge) + - [Our Standards](#our-standards) + - [Our Responsibilities](#our-responsibilities) + - [Scope](#scope) + - [Enforcement](#enforcement) + - [Attribution](#attribution) + + + # Contributor Covenant Code of Conduct From dade3dd17de6e9be38948991b72bb995d98f5c11 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Fri, 30 Sep 2022 13:55:25 -0700 Subject: [PATCH 2/9] chore: add prettier ignore blocks to docs --- docs/CONTRIBUTING.md | 2 ++ docs/FAQ.md | 2 ++ docs/MAINTAINING.md | 2 ++ docs/guide.md | 5 +++-- docs/install.md | 2 ++ docs/ipad.md | 2 ++ docs/npm.md | 2 ++ docs/termux.md | 2 ++ 8 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 01e92a436a23..4bd262735ca5 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,3 +1,4 @@ + # Contributing @@ -24,6 +25,7 @@ - [Currently Known Issues](#currently-known-issues) + - [Detailed CI and build process docs](../ci) diff --git a/docs/FAQ.md b/docs/FAQ.md index ed1c51a08b4e..abc520232eb1 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -1,3 +1,4 @@ + # FAQ @@ -33,6 +34,7 @@ - [How do I change the port?](#how-do-i-change-the-port) + ## Questions? diff --git a/docs/MAINTAINING.md b/docs/MAINTAINING.md index ce8e164c6995..99ca5d4ba42f 100644 --- a/docs/MAINTAINING.md +++ b/docs/MAINTAINING.md @@ -1,3 +1,4 @@ + # Maintaining @@ -24,6 +25,7 @@ - [Troubleshooting](#troubleshooting) + This document is meant to serve current and future maintainers of code-server, as well as share our workflow for maintaining the project. diff --git a/docs/guide.md b/docs/guide.md index 8bf4e77f40c6..dc4407e76595 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -1,3 +1,4 @@ + # Setup Guide @@ -22,6 +23,7 @@ - [Option 2: ngrok tunnel](#option-2-ngrok-tunnel) + This article will walk you through exposing code-server securely once you've completed the [installation process](install.md). @@ -89,11 +91,10 @@ we recommend using another method, such as [Let's Encrypt](#let-encrypt) instead using [mutagen](https://mutagen.io/documentation/introduction/installation) to do so. Once you've installed mutagen, you can port forward as follows: - ```console + ```shell # This is the same as the above SSH command, but it runs in the background # continuously. Be sure to add `mutagen daemon start` to your ~/.bashrc to # start the mutagen daemon when you open a shell. - mutagen forward create --name=code-server tcp:127.0.0.1:8080 < instance-ip > :tcp:127.0.0.1:8080 ``` diff --git a/docs/install.md b/docs/install.md index bc9287511c5a..4b5ab4ffa994 100644 --- a/docs/install.md +++ b/docs/install.md @@ -1,3 +1,4 @@ + # Install @@ -24,6 +25,7 @@ - [Debian, Ubuntu](#debian-ubuntu-1) + This document demonstrates how to install `code-server` on various distros and operating systems. diff --git a/docs/ipad.md b/docs/ipad.md index 3d6ac2b8f464..ef951cc4e6fe 100644 --- a/docs/ipad.md +++ b/docs/ipad.md @@ -1,3 +1,4 @@ + # iPad @@ -13,6 +14,7 @@ - [Sharing a self-signed certificate with an iPad](#sharing-a-self-signed-certificate-with-an-ipad) + Once you've installed code-server, you can access it from an iPad. diff --git a/docs/npm.md b/docs/npm.md index b4750898a9f6..58f4a978b577 100644 --- a/docs/npm.md +++ b/docs/npm.md @@ -1,3 +1,4 @@ + # npm Install Requirements @@ -15,6 +16,7 @@ - [Debugging install issues with npm](#debugging-install-issues-with-npm) + If you're installing code-server via `npm`, you'll need to install additional dependencies required to build the native modules used by VS Code. This article diff --git a/docs/termux.md b/docs/termux.md index 50d2f9f595bf..852cd01a4c40 100644 --- a/docs/termux.md +++ b/docs/termux.md @@ -1,3 +1,4 @@ + # Termux @@ -14,6 +15,7 @@ - [Working with PRoot](#working-with-proot) + ## Install From 4827f81ae8d399cb56fa276d78c7513509cb02b5 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Fri, 30 Sep 2022 13:55:41 -0700 Subject: [PATCH 3/9] chore: update styles for Dockerfile --- ci/release-image/Dockerfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ci/release-image/Dockerfile b/ci/release-image/Dockerfile index c0eaa3de1176..cbc97c3ad340 100644 --- a/ci/release-image/Dockerfile +++ b/ci/release-image/Dockerfile @@ -6,7 +6,7 @@ COPY release-packages/code-server*.deb /tmp/ FROM debian:11 RUN apt-get update \ - && apt-get install -y \ + && apt-get install -y \ curl \ dumb-init \ zsh \ @@ -29,15 +29,15 @@ RUN sed -i "s/# en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen \ && locale-gen ENV LANG=en_US.UTF-8 -RUN adduser --gecos '' --disabled-password coder && \ - echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd +RUN adduser --gecos '' --disabled-password coder \ + && echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd -RUN ARCH="$(dpkg --print-architecture)" && \ - curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.5/fixuid-0.5-linux-$ARCH.tar.gz" | tar -C /usr/local/bin -xzf - && \ - chown root:root /usr/local/bin/fixuid && \ - chmod 4755 /usr/local/bin/fixuid && \ - mkdir -p /etc/fixuid && \ - printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml +RUN ARCH="$(dpkg --print-architecture)" \ + && curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.5/fixuid-0.5-linux-$ARCH.tar.gz" | tar -C /usr/local/bin -xzf - \ + && chown root:root /usr/local/bin/fixuid \ + && chmod 4755 /usr/local/bin/fixuid \ + && mkdir -p /etc/fixuid \ + && printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml COPY ci/release-image/entrypoint.sh /usr/bin/entrypoint.sh RUN --mount=from=packages,src=/tmp,dst=/tmp/packages dpkg -i /tmp/packages/code-server*$(dpkg --print-architecture).deb From 9825c132ded0aec15194de321cdff7b1e86965b5 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Fri, 30 Sep 2022 13:56:14 -0700 Subject: [PATCH 4/9] refactor: separate prettier, doctoc This does a couple things: - update `.prettierignore` - split `prettier` and `doctoc` commands. you can still run with `yarn fmt` - delete `fmt.sh` and add `doctoc.sh` By doing so, we can run tasks in parallel in CI and we should also have less false positives than before with `yarn fmt` locally. --- .prettierignore | 5 ++++- ci/dev/{fmt.sh => doctoc.sh} | 21 +-------------------- package.json | 6 ++++-- yarn.lock | 2 +- 4 files changed, 10 insertions(+), 24 deletions(-) rename ci/dev/{fmt.sh => doctoc.sh} (70%) diff --git a/.prettierignore b/.prettierignore index a65aaff4da80..8dfed8cfe020 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,4 @@ -lib/vscode \ No newline at end of file +lib/vscode +helm-chart +test/scripts +test/e2e/extensions/test-extension diff --git a/ci/dev/fmt.sh b/ci/dev/doctoc.sh similarity index 70% rename from ci/dev/fmt.sh rename to ci/dev/doctoc.sh index 447186212d2f..6a4e3a635388 100755 --- a/ci/dev/fmt.sh +++ b/ci/dev/doctoc.sh @@ -4,24 +4,6 @@ set -euo pipefail main() { cd "$(dirname "$0")/../.." - local prettierExts - prettierExts=( - "*.js" - "*.ts" - "*.tsx" - "*.html" - "*.json" - "*.css" - "*.md" - "*.toml" - "*.yaml" - "*.yml" - "*.sh" - ) - prettier --write --loglevel=warn $( - git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v 'helm-chart' - ) - doctoc --title '# FAQ' docs/FAQ.md > /dev/null doctoc --title '# Setup Guide' docs/guide.md > /dev/null doctoc --title '# Install' docs/install.md > /dev/null @@ -32,12 +14,11 @@ main() { doctoc --title '# iPad' docs/ipad.md > /dev/null doctoc --title '# Termux' docs/termux.md > /dev/null - # TODO: replace with a method that generates fewer false positives. if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then echo "Files need generation or are formatted incorrectly:" git -c color.ui=always status | grep --color=no '\[31m' echo "Please run the following locally:" - echo " yarn fmt" + echo " yarn doctoc" exit 1 fi } diff --git a/package.json b/package.json index 4d40114498ea..dee5f57e387e 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "clean": "./ci/build/clean.sh", "build": "./ci/build/build-code-server.sh", "build:vscode": "./ci/build/build-vscode.sh", + "doctoc": "./ci/dev/doctoc.sh", "release": "./ci/build/build-release.sh", "release:standalone": "./ci/build/build-standalone-release.sh", "release:prep": "./ci/build/release-prep.sh", @@ -22,11 +23,12 @@ "test:native": "./ci/dev/test-native.sh", "test:scripts": "./ci/dev/test-scripts.sh", "package": "./ci/build/build-packages.sh", + "prettier": "prettier --write --loglevel=warn .", "postinstall": "./ci/dev/postinstall.sh", "publish:npm": "./ci/steps/publish-npm.sh", "publish:docker": "./ci/steps/docker-buildx-push.sh", "_audit": "./ci/dev/audit.sh", - "fmt": "./ci/dev/fmt.sh", + "fmt": "yarn prettier && ./ci/dev/doctoc.sh", "lint:scripts": "./ci/dev/lint-scripts.sh", "lint:ts": "eslint --max-warnings=0 --fix $(git ls-files '*.ts' '*.js' | grep -v 'lib/vscode')", "test": "echo 'Run yarn test:unit or yarn test:e2e' && exit 1", @@ -59,7 +61,7 @@ "eslint-import-resolver-typescript": "^2.5.0", "eslint-plugin-import": "^2.18.2", "eslint-plugin-prettier": "^4.0.0", - "prettier": "^2.2.1", + "prettier": "2.3.2", "prettier-plugin-sh": "^0.12.0", "ts-node": "^10.0.0", "typescript": "^4.6.2" diff --git a/yarn.lock b/yarn.lock index 359e4a081fd0..cd12a9e7e7f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2583,7 +2583,7 @@ prettier-plugin-sh@^0.12.0: dependencies: mvdan-sh "^0.10.1" -prettier@^2.2.1: +prettier@2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d" integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ== From d8c6c01e3e1a756227866f677062e30c1627691f Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Fri, 30 Sep 2022 13:58:43 -0700 Subject: [PATCH 5/9] refactor: update prettier job, add doctoc This modifies the prettier job to use actionsx/prettier. It also adds a job for `doctoc`. --- .github/workflows/build.yaml | 43 +++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 72a04242bc6f..27a9c0682e73 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,7 +22,7 @@ concurrency: # will skip running `yarn install` if it successfully fetched from cache jobs: - fmt: + prettier: name: Format with Prettier runs-on: ubuntu-latest timeout-minutes: 5 @@ -30,26 +30,39 @@ jobs: - name: Checkout repo uses: actions/checkout@v3 + - name: Run prettier with actionsx/prettier + uses: actionsx/prettier@v2 + with: + args: --check --loglevel=warn . + + doctoc: + name: Doctoc markdown files + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v26.1 + with: + files: | + docs/** + - name: Install Node.js v16 + if: steps.changed-files.outputs.any_changed == 'true' uses: actions/setup-node@v3 with: node-version: "16" + cache: "yarn" - - name: Fetch dependencies from cache - id: cache-node-modules - uses: actions/cache@v3 - with: - path: "**/node_modules" - key: yarn-build-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - yarn-build- - - - name: Install dependencies - if: steps.cache-node-modules.outputs.cache-hit != 'true' - run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile + - name: Install doctoc + run: yarn global add doctoc@2.0.0 - - name: Format files with Prettier - run: yarn fmt + - name: Run doctoc + if: steps.changed-files.outputs.any_changed == 'true' + run: yarn doctoc lint-helm: name: Lint Helm chart From 97f1399d5810db7bc52a2550b8b240271741eda1 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Mon, 10 Oct 2022 14:52:46 -0700 Subject: [PATCH 6/9] chore: upgrade to prettier 2.7.1 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8ac444555e58..7224d572939d 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "eslint-import-resolver-typescript": "^2.5.0", "eslint-plugin-import": "^2.18.2", "eslint-plugin-prettier": "^4.0.0", - "prettier": "2.3.2", + "prettier": "2.7.1", "prettier-plugin-sh": "^0.12.0", "ts-node": "^10.0.0", "typescript": "^4.6.2" diff --git a/yarn.lock b/yarn.lock index cd12a9e7e7f7..155241ab7a3c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2583,10 +2583,10 @@ prettier-plugin-sh@^0.12.0: dependencies: mvdan-sh "^0.10.1" -prettier@2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d" - integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ== +prettier@2.7.1: + version "2.7.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" + integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== progress@^2.0.0: version "2.0.3" From fd4f4138bad8641cf00b6a39678b7e6c52bf05f2 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Mon, 10 Oct 2022 14:54:13 -0700 Subject: [PATCH 7/9] chore: pin doctoc to 2.0.0 --- package.json | 2 +- yarn.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 7224d572939d..ff03adad0365 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "@typescript-eslint/eslint-plugin": "^5.23.0", "@typescript-eslint/parser": "^5.23.0", "audit-ci": "^6.0.0", - "doctoc": "^2.0.0", + "doctoc": "2.0.0", "eslint": "^7.7.0", "eslint-config-prettier": "^8.5.0", "eslint-import-resolver-typescript": "^2.5.0", diff --git a/yarn.lock b/yarn.lock index 155241ab7a3c..6b393c4426a3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -952,16 +952,16 @@ dir-glob@^3.0.1: dependencies: path-type "^4.0.0" -doctoc@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/doctoc/-/doctoc-2.0.1.tgz#d5aee2bce65a438ff8717d9e51df3d540caa3b78" - integrity sha512-JsxnSVZtLCThKehjFPBDhP1+ZLmdfXQynZH/0ABAwrnd1Zf3AV6LigC9oWJyaZ+c6RXCDnlGUNJ7I+1v8VaaRg== +doctoc@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/doctoc/-/doctoc-2.0.0.tgz#3c5c51ba89acb9b8e1924cc429500d6de2dfb90e" + integrity sha512-thvCndtwVPe3GCDUG09NYPu9D72Ons3MFh/Fe5A3bePMHGa1XSMgJWyL04bkxa0DyyaylEB2UrqigbQM0fcj7w== dependencies: "@textlint/markdown-to-ast" "~6.1.7" anchor-markdown-header "~0.5.7" htmlparser2 "~4.1.0" minimist "~1.2.5" - underscore "~1.12.1" + underscore "~1.10.2" update-section "~0.3.3" doctrine@^2.1.0: @@ -3288,7 +3288,7 @@ unbox-primitive@^1.0.0: has-symbols "^1.0.2" which-boxed-primitive "^1.0.2" -underscore@^1.13.1, underscore@~1.12.1: +underscore@^1.13.1, underscore@~1.10.2: version "1.13.1" resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.1.tgz#0c1c6bd2df54b6b69f2314066d65b6cde6fcf9d1" integrity sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g== From ccb0ea3987189a275b502c6a702bb4bf89a063cf Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Mon, 10 Oct 2022 14:55:35 -0700 Subject: [PATCH 8/9] fixup!: add .pc to prettierignore --- .prettierignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.prettierignore b/.prettierignore index 8dfed8cfe020..806e0311455f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,3 +2,4 @@ lib/vscode helm-chart test/scripts test/e2e/extensions/test-extension +.pc From 73328a7694f16999064757bd1f27f51c75cb471b Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Mon, 10 Oct 2022 14:55:49 -0700 Subject: [PATCH 9/9] feat: add --cache to prettier cmd --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ff03adad0365..7247d8fab559 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "test:native": "./ci/dev/test-native.sh", "test:scripts": "./ci/dev/test-scripts.sh", "package": "./ci/build/build-packages.sh", - "prettier": "prettier --write --loglevel=warn .", + "prettier": "prettier --write --loglevel=warn --cache .", "postinstall": "./ci/dev/postinstall.sh", "publish:npm": "./ci/steps/publish-npm.sh", "publish:docker": "./ci/steps/docker-buildx-push.sh",