Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 71a127a

Browse filesBrowse files
authored
refactor: update prettier and doctoc (coder#5605)
* docs: add toc to CODE OF CONDUCT * chore: add prettier ignore blocks to docs * chore: update styles for Dockerfile * 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. * refactor: update prettier job, add doctoc This modifies the prettier job to use actionsx/prettier. It also adds a job for `doctoc`. * chore: upgrade to prettier 2.7.1 * chore: pin doctoc to 2.0.0 * fixup!: add .pc to prettierignore * feat: add --cache to prettier cmd
1 parent d4707d1 commit 71a127a
Copy full SHA for 71a127a

15 files changed

+88-60Lines changed: 88 additions & 60 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/build.yaml‎

Copy file name to clipboardExpand all lines: .github/workflows/build.yaml
+28-15Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,47 @@ concurrency:
2222
# will skip running `yarn install` if it successfully fetched from cache
2323

2424
jobs:
25-
fmt:
25+
prettier:
2626
name: Format with Prettier
2727
runs-on: ubuntu-latest
2828
timeout-minutes: 5
2929
steps:
3030
- name: Checkout repo
3131
uses: actions/checkout@v3
3232

33+
- name: Run prettier with actionsx/prettier
34+
uses: actionsx/prettier@v2
35+
with:
36+
args: --check --loglevel=warn .
37+
38+
doctoc:
39+
name: Doctoc markdown files
40+
runs-on: ubuntu-latest
41+
timeout-minutes: 5
42+
steps:
43+
- name: Checkout repo
44+
uses: actions/checkout@v3
45+
46+
- name: Get changed files
47+
id: changed-files
48+
uses: tj-actions/changed-files@v26.1
49+
with:
50+
files: |
51+
docs/**
52+
3353
- name: Install Node.js v16
54+
if: steps.changed-files.outputs.any_changed == 'true'
3455
uses: actions/setup-node@v3
3556
with:
3657
node-version: "16"
58+
cache: "yarn"
3759

38-
- name: Fetch dependencies from cache
39-
id: cache-node-modules
40-
uses: actions/cache@v3
41-
with:
42-
path: "**/node_modules"
43-
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
44-
restore-keys: |
45-
yarn-build-
46-
47-
- name: Install dependencies
48-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
49-
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
60+
- name: Install doctoc
61+
run: yarn global add doctoc@2.0.0
5062

51-
- name: Format files with Prettier
52-
run: yarn fmt
63+
- name: Run doctoc
64+
if: steps.changed-files.outputs.any_changed == 'true'
65+
run: yarn doctoc
5366

5467
lint-helm:
5568
name: Lint Helm chart
Collapse file

‎.prettierignore‎

Copy file name to clipboard
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
lib/vscode
1+
lib/vscode
2+
helm-chart
3+
test/scripts
4+
test/e2e/extensions/test-extension
5+
.pc
Collapse file

‎ci/dev/fmt.sh‎ ‎ci/dev/doctoc.sh‎ci/dev/fmt.sh renamed to ci/dev/doctoc.sh

Copy file name to clipboardExpand all lines: ci/dev/doctoc.sh
+1-20Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,6 @@ set -euo pipefail
44
main() {
55
cd "$(dirname "$0")/../.."
66

7-
local prettierExts
8-
prettierExts=(
9-
"*.js"
10-
"*.ts"
11-
"*.tsx"
12-
"*.html"
13-
"*.json"
14-
"*.css"
15-
"*.md"
16-
"*.toml"
17-
"*.yaml"
18-
"*.yml"
19-
"*.sh"
20-
)
21-
prettier --write --loglevel=warn $(
22-
git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v 'helm-chart'
23-
)
24-
257
doctoc --title '# FAQ' docs/FAQ.md > /dev/null
268
doctoc --title '# Setup Guide' docs/guide.md > /dev/null
279
doctoc --title '# Install' docs/install.md > /dev/null
@@ -32,12 +14,11 @@ main() {
3214
doctoc --title '# iPad' docs/ipad.md > /dev/null
3315
doctoc --title '# Termux' docs/termux.md > /dev/null
3416

35-
# TODO: replace with a method that generates fewer false positives.
3617
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
3718
echo "Files need generation or are formatted incorrectly:"
3819
git -c color.ui=always status | grep --color=no '\[31m'
3920
echo "Please run the following locally:"
40-
echo " yarn fmt"
21+
echo " yarn doctoc"
4122
exit 1
4223
fi
4324
}
Collapse file

‎ci/release-image/Dockerfile‎

Copy file name to clipboardExpand all lines: ci/release-image/Dockerfile
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ COPY release-packages/code-server*.deb /tmp/
66
FROM debian:11
77

88
RUN apt-get update \
9-
&& apt-get install -y \
9+
&& apt-get install -y \
1010
curl \
1111
dumb-init \
1212
zsh \
@@ -29,15 +29,15 @@ RUN sed -i "s/# en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen \
2929
&& locale-gen
3030
ENV LANG=en_US.UTF-8
3131

32-
RUN adduser --gecos '' --disabled-password coder && \
33-
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
32+
RUN adduser --gecos '' --disabled-password coder \
33+
&& echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
3434

35-
RUN ARCH="$(dpkg --print-architecture)" && \
36-
curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.5/fixuid-0.5-linux-$ARCH.tar.gz" | tar -C /usr/local/bin -xzf - && \
37-
chown root:root /usr/local/bin/fixuid && \
38-
chmod 4755 /usr/local/bin/fixuid && \
39-
mkdir -p /etc/fixuid && \
40-
printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml
35+
RUN ARCH="$(dpkg --print-architecture)" \
36+
&& curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.5/fixuid-0.5-linux-$ARCH.tar.gz" | tar -C /usr/local/bin -xzf - \
37+
&& chown root:root /usr/local/bin/fixuid \
38+
&& chmod 4755 /usr/local/bin/fixuid \
39+
&& mkdir -p /etc/fixuid \
40+
&& printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml
4141

4242
COPY ci/release-image/entrypoint.sh /usr/bin/entrypoint.sh
4343
RUN --mount=from=packages,src=/tmp,dst=/tmp/packages dpkg -i /tmp/packages/code-server*$(dpkg --print-architecture).deb
Collapse file

‎docs/CODE_OF_CONDUCT.md‎

Copy file name to clipboardExpand all lines: docs/CODE_OF_CONDUCT.md
+13Lines changed: 13 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1+
<!-- prettier-ignore-start -->
12
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
23
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
4+
# Contributor Covenant Code of Conduct
5+
6+
- [Contributor Covenant Code of Conduct](#contributor-covenant-code-of-conduct)
7+
- [Our Pledge](#our-pledge)
8+
- [Our Standards](#our-standards)
9+
- [Our Responsibilities](#our-responsibilities)
10+
- [Scope](#scope)
11+
- [Enforcement](#enforcement)
12+
- [Attribution](#attribution)
13+
14+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
15+
<!-- prettier-ignore-end -->
316

417
# Contributor Covenant Code of Conduct
518

Collapse file

‎docs/CONTRIBUTING.md‎

Copy file name to clipboardExpand all lines: docs/CONTRIBUTING.md
+2Lines changed: 2 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- prettier-ignore-start -->
12
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
23
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
34
# Contributing
@@ -24,6 +25,7 @@
2425
- [Currently Known Issues](#currently-known-issues)
2526

2627
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
28+
<!-- prettier-ignore-end -->
2729

2830
- [Detailed CI and build process docs](../ci)
2931

Collapse file

‎docs/FAQ.md‎

Copy file name to clipboardExpand all lines: docs/FAQ.md
+2Lines changed: 2 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- prettier-ignore-start -->
12
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
23
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
34
# FAQ
@@ -33,6 +34,7 @@
3334
- [How do I change the port?](#how-do-i-change-the-port)
3435

3536
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
37+
<!-- prettier-ignore-end -->
3638

3739
## Questions?
3840

Collapse file

‎docs/MAINTAINING.md‎

Copy file name to clipboardExpand all lines: docs/MAINTAINING.md
+2Lines changed: 2 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- prettier-ignore-start -->
12
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
23
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
34
# Maintaining
@@ -24,6 +25,7 @@
2425
- [Troubleshooting](#troubleshooting)
2526

2627
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
28+
<!-- prettier-ignore-end -->
2729

2830
This document is meant to serve current and future maintainers of code-server,
2931
as well as share our workflow for maintaining the project.
Collapse file

‎docs/guide.md‎

Copy file name to clipboardExpand all lines: docs/guide.md
+3-2Lines changed: 3 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- prettier-ignore-start -->
12
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
23
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
34
# Setup Guide
@@ -22,6 +23,7 @@
2223
- [Option 2: ngrok tunnel](#option-2-ngrok-tunnel)
2324

2425
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
26+
<!-- prettier-ignore-end -->
2527

2628
This article will walk you through exposing code-server securely once you've
2729
completed the [installation process](install.md).
@@ -89,11 +91,10 @@ we recommend using another method, such as [Let's Encrypt](#let-encrypt) instead
8991
using [mutagen](https://mutagen.io/documentation/introduction/installation)
9092
to do so. Once you've installed mutagen, you can port forward as follows:
9193

92-
```console
94+
```shell
9395
# This is the same as the above SSH command, but it runs in the background
9496
# continuously. Be sure to add `mutagen daemon start` to your ~/.bashrc to
9597
# start the mutagen daemon when you open a shell.
96-
9798
mutagen forward create --name=code-server tcp:127.0.0.1:8080 < instance-ip > :tcp:127.0.0.1:8080
9899
```
99100

Collapse file

‎docs/install.md‎

Copy file name to clipboardExpand all lines: docs/install.md
+2Lines changed: 2 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- prettier-ignore-start -->
12
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
23
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
34
# Install
@@ -24,6 +25,7 @@
2425
- [Debian, Ubuntu](#debian-ubuntu-1)
2526

2627
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
28+
<!-- prettier-ignore-end -->
2729

2830
This document demonstrates how to install `code-server` on various distros and
2931
operating systems.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.