chore: Add .editorconfig, shfmt, shellcheck and subshell dir changes (#1649)

This commit is contained in:
Mathias Fredriksson
2022-05-27 20:15:19 +03:00
committed by GitHub
parent 1a70298b5c
commit 608eb322a8
11 changed files with 191 additions and 103 deletions
+22 -16
View File
@@ -2,23 +2,29 @@
set -euo pipefail
FILES="$(git ls-files --other --modified --exclude-standard)"
if [[ "$FILES" != "" ]]; then
mapfile -t files <<<"$FILES"
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
PROJECT_ROOT=$(cd "$SCRIPT_DIR" && git rev-parse --show-toplevel)
echo "The following files contain unstaged changes:"
echo
for file in "${files[@]}"; do
echo " - $file"
done
echo
(
cd "${PROJECT_ROOT}"
echo "These are the changes:"
echo
for file in "${files[@]}"; do
git --no-pager diff "$file"
done
exit 1
fi
FILES="$(git ls-files --other --modified --exclude-standard)"
if [[ "$FILES" != "" ]]; then
mapfile -t files <<<"$FILES"
echo "The following files contain unstaged changes:"
echo
for file in "${files[@]}"; do
echo " - $file"
done
echo
echo "These are the changes:"
echo
for file in "${files[@]}"; do
git --no-pager diff "$file"
done
exit 1
fi
)
exit 0
+8 -6
View File
@@ -2,8 +2,8 @@
set -euo pipefail
PROJECT_ROOT="$(git rev-parse --show-toplevel)"
cd "${PROJECT_ROOT}"
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
PROJECT_ROOT=$(cd "$SCRIPT_DIR" && git rev-parse --show-toplevel)
echo '== Run "make build" before running this command to build binaries.'
echo '== Without these binaries, workspaces will fail to start!'
@@ -19,8 +19,10 @@ export CODER_DEV_ADMIN_PASSWORD=password
# to kill both at the same time. For more details, see:
# https://stackoverflow.com/questions/3004811/how-do-you-run-multiple-programs-in-parallel-from-a-bash-script
(
trap 'kill 0' SIGINT
CODERV2_HOST=http://127.0.0.1:3000 INSPECT_XSTATE=true yarn --cwd=./site dev &
go run -tags embed cmd/coder/main.go server --dev --tunnel=true &
wait
cd "${PROJECT_ROOT}"
trap 'kill 0' SIGINT
CODERV2_HOST=http://127.0.0.1:3000 INSPECT_XSTATE=true yarn --cwd=./site dev &
go run -tags embed cmd/coder/main.go server --dev --tunnel=true &
wait
)
+18 -12
View File
@@ -1,17 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
codesign -s $AC_APPLICATION_IDENTITY -f -v --timestamp --options runtime $1
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
PROJECT_ROOT=$(cd "$SCRIPT_DIR" && git rev-parse --show-toplevel)
config="$(mktemp -d)/gon.json"
jq -r --null-input --arg path "$(pwd)/$1" '{
"notarize": [
{
"path": $path,
"bundle_id": "com.coder.cli"
}
]
}' > $config
gon $config
(
cd "${PROJECT_ROOT}"
codesign -s "$AC_APPLICATION_IDENTITY" -f -v --timestamp --options runtime "$1"
config=$(mktemp -d)/gon.json
jq -r --null-input --arg path "$(pwd)/$1" '{
"notarize": [
{
"path": $path,
"bundle_id": "com.coder.cli"
}
]
}' >"$config"
gon "$config"
)
+31 -27
View File
@@ -7,33 +7,37 @@
set -euo pipefail
PROJECT_ROOT=$(git rev-parse --show-toplevel)
cd "$PROJECT_ROOT/site"
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
PROJECT_ROOT=$(cd "$SCRIPT_DIR" && git rev-parse --show-toplevel)
yarn_flags=(
# Do not execute install scripts
# TODO: check if build works properly with this enabled
# --ignore-scripts
(
cd "$PROJECT_ROOT/site"
# Check if existing node_modules are valid
# TODO: determine if this is necessary
# --check-files
yarn_flags=(
# Do not execute install scripts
# TODO: check if build works properly with this enabled
# --ignore-scripts
# Check if existing node_modules are valid
# TODO: determine if this is necessary
# --check-files
)
if [ -n "${CI:-}" ]; then
yarn_flags+=(
# Install dependencies from lockfile, ensuring builds are fully
# reproducible
--frozen-lockfile
# Suppress progress information
--silent
# Disable interactive prompts for build
--non-interactive
)
fi
# Append whatever is specified on the command line
yarn_flags+=("$@")
echo "+ yarn install ${yarn_flags[*]}"
yarn install "${yarn_flags[@]}"
)
if [ -n "${CI:-}" ]; then
yarn_flags+=(
# Install dependencies from lockfile, ensuring builds are fully
# reproducible
--frozen-lockfile
# Suppress progress information
--silent
# Disable interactive prompts for build
--non-interactive
)
fi
# Append whatever is specified on the command line
yarn_flags+=("$@")
echo "+ yarn install ${yarn_flags[*]}"
yarn install "${yarn_flags[@]}"