Skip to content

Commit acb4663

Browse files
authored
Merge pull request #2891 from cdr/jsjoeio/replace-shfmt
feat: add prettier-plugin-sh
2 parents 3f3a619 + d053898 commit acb4663

19 files changed

+52
-43
lines changed

ci/build/build-packages.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ release_gcp() {
4040
# Generates deb and rpm packages.
4141
release_nfpm() {
4242
local nfpm_config
43-
nfpm_config="$(envsubst < ./ci/build/nfpm.yaml)"
43+
nfpm_config="$(envsubst <./ci/build/nfpm.yaml)"
4444

4545
# The underscores are convention for .deb.
4646
nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server_${VERSION}_$ARCH.deb"

ci/build/build-release.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ bundle_code_server() {
4949

5050
# Adds the commit to package.json
5151
jq --slurp '.[0] * .[1]' package.json <(
52-
cat << EOF
52+
cat <<EOF
5353
{
5454
"commit": "$(git rev-parse HEAD)",
5555
"scripts": {
5656
"postinstall": "./postinstall.sh"
5757
}
5858
}
5959
EOF
60-
) > "$RELEASE_PATH/package.json"
60+
) >"$RELEASE_PATH/package.json"
6161
rsync yarn.lock "$RELEASE_PATH"
6262
rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh"
6363

@@ -89,18 +89,18 @@ bundle_vscode() {
8989

9090
# Adds the commit and date to product.json
9191
jq --slurp '.[0] * .[1]' "$VSCODE_SRC_PATH/product.json" <(
92-
cat << EOF
92+
cat <<EOF
9393
{
9494
"commit": "$(git rev-parse HEAD)",
9595
"date": $(jq -n 'now | todate')
9696
}
9797
EOF
98-
) > "$VSCODE_OUT_PATH/product.json"
98+
) >"$VSCODE_OUT_PATH/product.json"
9999

100100
# We remove the scripts field so that later on we can run
101101
# yarn to fetch node_modules if necessary without build scripts running.
102102
# We cannot use --no-scripts because we still want dependent package scripts to run.
103-
jq 'del(.scripts)' < "$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"
103+
jq 'del(.scripts)' <"$VSCODE_SRC_PATH/package.json" >"$VSCODE_OUT_PATH/package.json"
104104

105105
pushd "$VSCODE_OUT_PATH"
106106
symlink_asar

ci/build/build-standalone-release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ main() {
1212
# we use the same version it's using so we instead run a script with yarn that
1313
# will print the path to node.
1414
local node_path
15-
node_path="$(yarn -s node <<< 'console.info(process.execPath)')"
15+
node_path="$(yarn -s node <<<'console.info(process.execPath)')"
1616

1717
mkdir -p "$RELEASE_PATH/bin"
1818
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"

ci/build/code-server.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ _realpath() {
1111
cd "$(dirname "$script")"
1212

1313
while [ -L "$(basename "$script")" ]; do
14-
if [ -L "./node" ] && [ -L "./code-server" ] &&
15-
[ -f "package.json" ] &&
16-
cat package.json | grep -q '^ "name": "code-server",$'; then
14+
if [ -L "./node" ] && [ -L "./code-server" ] \
15+
&& [ -f "package.json" ] \
16+
&& cat package.json | grep -q '^ "name": "code-server",$'; then
1717
echo "***** Please use the script in bin/code-server instead!" >&2
1818
echo "***** This script will soon be removed!" >&2
1919
echo "***** See the release notes at https://github.com/cdr/code-server/releases/tag/v3.4.0" >&2

ci/build/release-github-draft.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ main() {
1010
hub release create \
1111
--file - \
1212
-t "$(git rev-parse HEAD)" \
13-
--draft "v$VERSION" << EOF
13+
--draft "v$VERSION" <<EOF
1414
v$VERSION
1515
1616
VS Code v$(vscode_version)

ci/dev/fmt.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ set -euo pipefail
44
main() {
55
cd "$(dirname "$0")/../.."
66

7-
shfmt -i 2 -w -sr $(git ls-files "*.sh" | grep -v "lib/vscode")
8-
97
local prettierExts
108
prettierExts=(
119
"*.js"
@@ -18,18 +16,19 @@ main() {
1816
"*.toml"
1917
"*.yaml"
2018
"*.yml"
19+
"*.sh"
2120
)
2221
prettier --write --loglevel=warn $(
2322
git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v 'helm-chart'
2423
)
2524

26-
doctoc --title '# FAQ' docs/FAQ.md > /dev/null
27-
doctoc --title '# Setup Guide' docs/guide.md > /dev/null
28-
doctoc --title '# Install' docs/install.md > /dev/null
29-
doctoc --title '# npm Install Requirements' docs/npm.md > /dev/null
30-
doctoc --title '# Contributing' docs/CONTRIBUTING.md > /dev/null
31-
doctoc --title '# Contributor Covenant Code of Conduct' docs/CODE_OF_CONDUCT.md > /dev/null
32-
doctoc --title '# iPad' docs/ipad.md > /dev/null
25+
doctoc --title '# FAQ' docs/FAQ.md >/dev/null
26+
doctoc --title '# Setup Guide' docs/guide.md >/dev/null
27+
doctoc --title '# Install' docs/install.md >/dev/null
28+
doctoc --title '# npm Install Requirements' docs/npm.md >/dev/null
29+
doctoc --title '# Contributing' docs/CONTRIBUTING.md >/dev/null
30+
doctoc --title '# Contributor Covenant Code of Conduct' docs/CODE_OF_CONDUCT.md >/dev/null
31+
doctoc --title '# iPad' docs/ipad.md >/dev/null
3332

3433
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
3534
echo "Files need generation or are formatted incorrectly:"

ci/dev/gen_icons.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ main() {
3535
# This escapes all newlines so that sed will accept them.
3636
favicon_dark_style="$(printf "%s\n" "$favicon_dark_style" | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/\\n/g')"
3737
sed "$(
38-
cat -n << EOF
38+
cat -n <<EOF
3939
s%<rect id="favicon"%$favicon_dark_style<rect id="favicon"%
4040
EOF
41-
)" favicon.svg > favicon-dark-support.svg
41+
)" favicon.svg >favicon-dark-support.svg
4242
}
4343

4444
main "$@"

ci/dev/lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ main() {
88
stylelint $(git ls-files "*.css" | grep -v "lib/vscode")
99
tsc --noEmit --skipLibCheck
1010
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "lib/vscode")
11-
if command -v helm && helm kubeval --help > /dev/null; then
11+
if command -v helm && helm kubeval --help >/dev/null; then
1212
helm kubeval ci/helm-chart
1313
fi
1414

ci/dev/update-vscode.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ main() {
3333

3434
# Check if the remote exists
3535
# if it doesn't, we add it
36-
if ! git config remote.vscode.url > /dev/null; then
36+
if ! git config remote.vscode.url >/dev/null; then
3737
echo "Could not find 'vscode' as a remote"
3838
echo "Adding with: git remote add vscode https://github.com/microsoft/vscode.git"
3939
git remote add vscode https://github.com/microsoft/vscode.git
@@ -52,7 +52,7 @@ main() {
5252
fi
5353

5454
# Check that they have jq installed
55-
if ! command -v jq &> /dev/null; then
55+
if ! command -v jq &>/dev/null; then
5656
echo "jq could not be found."
5757
echo "We use this when looking up the exact version to update to in the package.json in VS Code."
5858
echo -e "See docs here: https://stedolan.github.io/jq/download/"
@@ -71,7 +71,7 @@ main() {
7171
git fetch vscode
7272

7373
# Check if GitHub CLI is installed
74-
if ! command -v gh &> /dev/null; then
74+
if ! command -v gh &>/dev/null; then
7575
echo "GitHub CLI could not be found."
7676
echo "If you install it before you run this script next time, we'll open a draft PR for you!"
7777
echo -e "See docs here: https://github.com/cli/cli#installation\n"

ci/images/centos7/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ ENV PATH=/usr/local/go/bin:$GOPATH/bin:$PATH
2626

2727
# Install Go dependencies
2828
ENV GO111MODULE=on
29-
RUN go get mvdan.cc/sh/v3/cmd/shfmt
3029
RUN go get github.com/goreleaser/nfpm/cmd/nfpm@v1.9.0
3130

3231
RUN curl -fsSL https://get.docker.com | sh

0 commit comments

Comments
 (0)