diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 72a04242b..27a9c0682 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 doctoc + run: yarn global add doctoc@2.0.0 - - name: Install dependencies - if: steps.cache-node-modules.outputs.cache-hit != 'true' - run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile - - - 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 diff --git a/.prettierignore b/.prettierignore index a65aaff4d..806e03114 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,5 @@ -lib/vscode \ No newline at end of file +lib/vscode +helm-chart +test/scripts +test/e2e/extensions/test-extension +.pc 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 447186212..6a4e3a635 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/ci/release-image/Dockerfile b/ci/release-image/Dockerfile index c0eaa3de1..cbc97c3ad 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 diff --git a/docs/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md index fe14b3a64..168eac481 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 diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 01e92a436..4bd262735 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 ed1c51a08..abc520232 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 8f2d5e4a5..3300cc0d6 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 27f15f973..fee3f8b64 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 bc9287511..4b5ab4ffa 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 3d6ac2b8f..ef951cc4e 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 b4750898a..58f4a978b 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 7479c022b..d61409c55 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 diff --git a/package.json b/package.json index b624d19f2..ec5444407 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 --cache .", "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", @@ -53,13 +55,13 @@ "@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", "eslint-plugin-import": "^2.18.2", "eslint-plugin-prettier": "^4.0.0", - "prettier": "^2.2.1", + "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 12f3d7394..4b9319c36 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: @@ -2583,10 +2583,10 @@ prettier-plugin-sh@^0.12.0: dependencies: mvdan-sh "^0.10.1" -prettier@^2.2.1: - 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" @@ -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==