chore: update formatting w/new prettier sh plugin

This commit is contained in:
Joe Previte 2021-03-15 15:36:31 -07:00
parent 0ba53b6adf
commit d05389880a
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24
15 changed files with 45 additions and 46 deletions

View File

@ -40,7 +40,7 @@ release_gcp() {
# Generates deb and rpm packages. # Generates deb and rpm packages.
release_nfpm() { release_nfpm() {
local nfpm_config local nfpm_config
nfpm_config="$(envsubst < ./ci/build/nfpm.yaml)" nfpm_config="$(envsubst <./ci/build/nfpm.yaml)"
# The underscores are convention for .deb. # The underscores are convention for .deb.
nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server_${VERSION}_$ARCH.deb" nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server_${VERSION}_$ARCH.deb"

View File

@ -49,7 +49,7 @@ bundle_code_server() {
# Adds the commit to package.json # Adds the commit to package.json
jq --slurp '.[0] * .[1]' package.json <( jq --slurp '.[0] * .[1]' package.json <(
cat << EOF cat <<EOF
{ {
"commit": "$(git rev-parse HEAD)", "commit": "$(git rev-parse HEAD)",
"scripts": { "scripts": {
@ -57,7 +57,7 @@ bundle_code_server() {
} }
} }
EOF EOF
) > "$RELEASE_PATH/package.json" ) >"$RELEASE_PATH/package.json"
rsync yarn.lock "$RELEASE_PATH" rsync yarn.lock "$RELEASE_PATH"
rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh" rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh"
@ -89,18 +89,18 @@ bundle_vscode() {
# Adds the commit and date to product.json # Adds the commit and date to product.json
jq --slurp '.[0] * .[1]' "$VSCODE_SRC_PATH/product.json" <( jq --slurp '.[0] * .[1]' "$VSCODE_SRC_PATH/product.json" <(
cat << EOF cat <<EOF
{ {
"commit": "$(git rev-parse HEAD)", "commit": "$(git rev-parse HEAD)",
"date": $(jq -n 'now | todate') "date": $(jq -n 'now | todate')
} }
EOF EOF
) > "$VSCODE_OUT_PATH/product.json" ) >"$VSCODE_OUT_PATH/product.json"
# We remove the scripts field so that later on we can run # We remove the scripts field so that later on we can run
# yarn to fetch node_modules if necessary without build scripts running. # yarn to fetch node_modules if necessary without build scripts running.
# We cannot use --no-scripts because we still want dependent package scripts to run. # We cannot use --no-scripts because we still want dependent package scripts to run.
jq 'del(.scripts)' < "$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json" jq 'del(.scripts)' <"$VSCODE_SRC_PATH/package.json" >"$VSCODE_OUT_PATH/package.json"
pushd "$VSCODE_OUT_PATH" pushd "$VSCODE_OUT_PATH"
symlink_asar symlink_asar

View File

@ -12,7 +12,7 @@ main() {
# we use the same version it's using so we instead run a script with yarn that # we use the same version it's using so we instead run a script with yarn that
# will print the path to node. # will print the path to node.
local node_path local node_path
node_path="$(yarn -s node <<< 'console.info(process.execPath)')" node_path="$(yarn -s node <<<'console.info(process.execPath)')"
mkdir -p "$RELEASE_PATH/bin" mkdir -p "$RELEASE_PATH/bin"
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server" rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"

View File

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

View File

@ -10,7 +10,7 @@ main() {
hub release create \ hub release create \
--file - \ --file - \
-t "$(git rev-parse HEAD)" \ -t "$(git rev-parse HEAD)" \
--draft "v$VERSION" << EOF --draft "v$VERSION" <<EOF
v$VERSION v$VERSION
VS Code v$(vscode_version) VS Code v$(vscode_version)

View File

@ -22,13 +22,13 @@ main() {
git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v 'helm-chart' git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v 'helm-chart'
) )
doctoc --title '# FAQ' docs/FAQ.md > /dev/null doctoc --title '# FAQ' docs/FAQ.md >/dev/null
doctoc --title '# Setup Guide' docs/guide.md > /dev/null doctoc --title '# Setup Guide' docs/guide.md >/dev/null
doctoc --title '# Install' docs/install.md > /dev/null doctoc --title '# Install' docs/install.md >/dev/null
doctoc --title '# npm Install Requirements' docs/npm.md > /dev/null doctoc --title '# npm Install Requirements' docs/npm.md >/dev/null
doctoc --title '# Contributing' docs/CONTRIBUTING.md > /dev/null doctoc --title '# Contributing' docs/CONTRIBUTING.md >/dev/null
doctoc --title '# Contributor Covenant Code of Conduct' docs/CODE_OF_CONDUCT.md > /dev/null doctoc --title '# Contributor Covenant Code of Conduct' docs/CODE_OF_CONDUCT.md >/dev/null
doctoc --title '# iPad' docs/ipad.md > /dev/null doctoc --title '# iPad' docs/ipad.md >/dev/null
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
echo "Files need generation or are formatted incorrectly:" echo "Files need generation or are formatted incorrectly:"

View File

@ -35,10 +35,10 @@ main() {
# This escapes all newlines so that sed will accept them. # This escapes all newlines so that sed will accept them.
favicon_dark_style="$(printf "%s\n" "$favicon_dark_style" | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/\\n/g')" favicon_dark_style="$(printf "%s\n" "$favicon_dark_style" | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/\\n/g')"
sed "$( sed "$(
cat -n << EOF cat -n <<EOF
s%<rect id="favicon"%$favicon_dark_style<rect id="favicon"% s%<rect id="favicon"%$favicon_dark_style<rect id="favicon"%
EOF EOF
)" favicon.svg > favicon-dark-support.svg )" favicon.svg >favicon-dark-support.svg
} }
main "$@" main "$@"

View File

@ -8,7 +8,7 @@ main() {
stylelint $(git ls-files "*.css" | grep -v "lib/vscode") stylelint $(git ls-files "*.css" | grep -v "lib/vscode")
tsc --noEmit --skipLibCheck tsc --noEmit --skipLibCheck
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "lib/vscode") shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "lib/vscode")
if command -v helm && helm kubeval --help > /dev/null; then if command -v helm && helm kubeval --help >/dev/null; then
helm kubeval ci/helm-chart helm kubeval ci/helm-chart
fi fi

View File

@ -33,7 +33,7 @@ main() {
# Check if the remote exists # Check if the remote exists
# if it doesn't, we add it # if it doesn't, we add it
if ! git config remote.vscode.url > /dev/null; then if ! git config remote.vscode.url >/dev/null; then
echo "Could not find 'vscode' as a remote" echo "Could not find 'vscode' as a remote"
echo "Adding with: git remote add vscode https://github.com/microsoft/vscode.git" echo "Adding with: git remote add vscode https://github.com/microsoft/vscode.git"
git remote add vscode https://github.com/microsoft/vscode.git git remote add vscode https://github.com/microsoft/vscode.git
@ -52,7 +52,7 @@ main() {
fi fi
# Check that they have jq installed # Check that they have jq installed
if ! command -v jq &> /dev/null; then if ! command -v jq &>/dev/null; then
echo "jq could not be found." echo "jq could not be found."
echo "We use this when looking up the exact version to update to in the package.json in VS Code." echo "We use this when looking up the exact version to update to in the package.json in VS Code."
echo -e "See docs here: https://stedolan.github.io/jq/download/" echo -e "See docs here: https://stedolan.github.io/jq/download/"
@ -71,7 +71,7 @@ main() {
git fetch vscode git fetch vscode
# Check if GitHub CLI is installed # Check if GitHub CLI is installed
if ! command -v gh &> /dev/null; then if ! command -v gh &>/dev/null; then
echo "GitHub CLI could not be found." echo "GitHub CLI could not be found."
echo "If you install it before you run this script next time, we'll open a draft PR for you!" echo "If you install it before you run this script next time, we'll open a draft PR for you!"
echo -e "See docs here: https://github.com/cli/cli#installation\n" echo -e "See docs here: https://github.com/cli/cli#installation\n"

View File

@ -2,11 +2,11 @@
set -euo pipefail set -euo pipefail
pushd() { pushd() {
builtin pushd "$@" > /dev/null builtin pushd "$@" >/dev/null
} }
popd() { popd() {
builtin popd > /dev/null builtin popd >/dev/null
} }
pkg_json_version() { pkg_json_version() {
@ -75,7 +75,7 @@ download_artifact() {
local tmp_file local tmp_file
tmp_file="$(mktemp)" tmp_file="$(mktemp)"
curl -fsSL "$(get_artifact_url "$artifact_name")" > "$tmp_file" curl -fsSL "$(get_artifact_url "$artifact_name")" >"$tmp_file"
unzip -q -o "$tmp_file" -d "$dst" unzip -q -o "$tmp_file" -d "$dst"
rm "$tmp_file" rm "$tmp_file"
} }

View File

@ -6,7 +6,7 @@ set -eu
eval "$(fixuid -q)" eval "$(fixuid -q)"
if [ "${DOCKER_USER-}" ] && [ "$DOCKER_USER" != "$USER" ]; then if [ "${DOCKER_USER-}" ] && [ "$DOCKER_USER" != "$USER" ]; then
echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd >/dev/null
# Unfortunately we cannot change $HOME as we cannot move any bind mounts # Unfortunately we cannot change $HOME as we cannot move any bind mounts
# nor can we bind mount $HOME into a new home as that requires a privileged container. # nor can we bind mount $HOME into a new home as that requires a privileged container.
sudo usermod --login "$DOCKER_USER" coder sudo usermod --login "$DOCKER_USER" coder

View File

@ -8,7 +8,7 @@ main() {
./ci/release-image/build.sh ./ci/release-image/build.sh
mkdir -p release-images mkdir -p release-images
docker save "codercom/code-server-$ARCH:$VERSION" > "release-images/code-server-$ARCH-$VERSION.tar" docker save "codercom/code-server-$ARCH:$VERSION" >"release-images/code-server-$ARCH-$VERSION.tar"
} }
main "$@" main "$@"

View File

@ -6,7 +6,7 @@ main() {
source ./ci/lib.sh source ./ci/lib.sh
if [[ ${CI-} ]]; then if [[ ${CI-} ]]; then
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >~/.npmrc
fi fi
download_artifact npm-package ./release-npm-package download_artifact npm-package ./release-npm-package

View File

@ -2,14 +2,13 @@
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# Contributing # Contributing
- [Contributing](#contributing) - [Pull Requests](#pull-requests)
- [Pull Requests](#pull-requests) - [Requirements](#requirements)
- [Requirements](#requirements) - [Development Workflow](#development-workflow)
- [Development Workflow](#development-workflow)
- [Updating VS Code](#updating-vs-code) - [Updating VS Code](#updating-vs-code)
- [Notes about Changes](#notes-about-changes) - [Notes about Changes](#notes-about-changes)
- [Build](#build) - [Build](#build)
- [Structure](#structure) - [Structure](#structure)
- [Modifications to VS Code](#modifications-to-vs-code) - [Modifications to VS Code](#modifications-to-vs-code)
- [Currently Known Issues](#currently-known-issues) - [Currently Known Issues](#currently-known-issues)

View File

@ -13,7 +13,7 @@ usage() {
" "
fi fi
cath << EOF cath <<EOF
Installs code-server for Linux, macOS and FreeBSD. Installs code-server for Linux, macOS and FreeBSD.
It tries to use the system package manager if possible. It tries to use the system package manager if possible.
After successful installation it explains how to start using code-server. After successful installation it explains how to start using code-server.
@ -81,7 +81,7 @@ echo_latest_version() {
echo_npm_postinstall() { echo_npm_postinstall() {
echoh echoh
cath << EOF cath <<EOF
The npm package has been installed successfully! The npm package has been installed successfully!
Please extend your path to use code-server: Please extend your path to use code-server:
PATH="$NPM_BIN_DIR:\$PATH" PATH="$NPM_BIN_DIR:\$PATH"
@ -92,7 +92,7 @@ EOF
echo_standalone_postinstall() { echo_standalone_postinstall() {
echoh echoh
cath << EOF cath <<EOF
Standalone release has been installed into $STANDALONE_INSTALL_PREFIX/lib/code-server-$VERSION Standalone release has been installed into $STANDALONE_INSTALL_PREFIX/lib/code-server-$VERSION
Please extend your path to use code-server: Please extend your path to use code-server:
PATH="$STANDALONE_INSTALL_PREFIX/bin:\$PATH" PATH="$STANDALONE_INSTALL_PREFIX/bin:\$PATH"
@ -103,7 +103,7 @@ EOF
echo_systemd_postinstall() { echo_systemd_postinstall() {
echoh echoh
cath << EOF cath <<EOF
To have systemd start code-server now and restart on boot: To have systemd start code-server now and restart on boot:
sudo systemctl enable --now code-server@\$USER sudo systemctl enable --now code-server@\$USER
Or, if you don't want/need a background service you can run: Or, if you don't want/need a background service you can run:
@ -509,7 +509,7 @@ arch() {
} }
command_exists() { command_exists() {
command -v "$@" > /dev/null command -v "$@" >/dev/null
} }
sh_c() { sh_c() {
@ -571,7 +571,7 @@ prefix() {
fifo="$(mktemp -d)/fifo" fifo="$(mktemp -d)/fifo"
mkfifo "$fifo" mkfifo "$fifo"
sed -e "s#^#$PREFIX: #" "$fifo" & sed -e "s#^#$PREFIX: #" "$fifo" &
"$@" > "$fifo" 2>&1 "$@" >"$fifo" 2>&1
} }
main "$@" main "$@"