Skip to content

Commit 9825c13

Browse files
committed
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.
1 parent 4827f81 commit 9825c13

File tree

4 files changed

+10
-24
lines changed

4 files changed

+10
-24
lines changed

.prettierignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
lib/vscode
1+
lib/vscode
2+
helm-chart
3+
test/scripts
4+
test/e2e/extensions/test-extension

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

+1-20
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
}

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"clean": "./ci/build/clean.sh",
1313
"build": "./ci/build/build-code-server.sh",
1414
"build:vscode": "./ci/build/build-vscode.sh",
15+
"doctoc": "./ci/dev/doctoc.sh",
1516
"release": "./ci/build/build-release.sh",
1617
"release:standalone": "./ci/build/build-standalone-release.sh",
1718
"release:prep": "./ci/build/release-prep.sh",
@@ -22,11 +23,12 @@
2223
"test:native": "./ci/dev/test-native.sh",
2324
"test:scripts": "./ci/dev/test-scripts.sh",
2425
"package": "./ci/build/build-packages.sh",
26+
"prettier": "prettier --write --loglevel=warn .",
2527
"postinstall": "./ci/dev/postinstall.sh",
2628
"publish:npm": "./ci/steps/publish-npm.sh",
2729
"publish:docker": "./ci/steps/docker-buildx-push.sh",
2830
"_audit": "./ci/dev/audit.sh",
29-
"fmt": "./ci/dev/fmt.sh",
31+
"fmt": "yarn prettier && ./ci/dev/doctoc.sh",
3032
"lint:scripts": "./ci/dev/lint-scripts.sh",
3133
"lint:ts": "eslint --max-warnings=0 --fix $(git ls-files '*.ts' '*.js' | grep -v 'lib/vscode')",
3234
"test": "echo 'Run yarn test:unit or yarn test:e2e' && exit 1",
@@ -59,7 +61,7 @@
5961
"eslint-import-resolver-typescript": "^2.5.0",
6062
"eslint-plugin-import": "^2.18.2",
6163
"eslint-plugin-prettier": "^4.0.0",
62-
"prettier": "^2.2.1",
64+
"prettier": "2.3.2",
6365
"prettier-plugin-sh": "^0.12.0",
6466
"ts-node": "^10.0.0",
6567
"typescript": "^4.6.2"

yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -2583,7 +2583,7 @@ prettier-plugin-sh@^0.12.0:
25832583
dependencies:
25842584
mvdan-sh "^0.10.1"
25852585

2586-
prettier@^2.2.1:
2586+
prettier@2.3.2:
25872587
version "2.3.2"
25882588
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
25892589
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==

0 commit comments

Comments
 (0)