Add formatting check for shell scripts (#106)
This commit is contained in:
committed by
GitHub
parent
1e7f91231c
commit
1e3bd2b04b
6
.github/workflows/ci.yaml
vendored
6
.github/workflows/ci.yaml
vendored
@@ -20,6 +20,8 @@ jobs:
|
|||||||
- uses: oven-sh/setup-bun@v1
|
- uses: oven-sh/setup-bun@v1
|
||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
|
- name: Setup
|
||||||
|
run: bun install
|
||||||
- run: bun test
|
- run: bun test
|
||||||
pretty:
|
pretty:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -28,7 +30,9 @@ jobs:
|
|||||||
- uses: oven-sh/setup-bun@v1
|
- uses: oven-sh/setup-bun@v1
|
||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
|
- name: Setup
|
||||||
|
run: bun install
|
||||||
- name: Format
|
- name: Format
|
||||||
run: bun fmt:ci
|
run: bun fmt:ci
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: bun install && bun lint
|
run: bun lint
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Convert templated variables to shell variables
|
||||||
|
# shellcheck disable=SC2269
|
||||||
|
LOG_PATH=${LOG_PATH}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034
|
||||||
BOLD='\033[0;1m'
|
BOLD='\033[0;1m'
|
||||||
|
|
||||||
|
# shellcheck disable=SC2059
|
||||||
printf "$${BOLD}Installing MODULE_NAME ...\n\n"
|
printf "$${BOLD}Installing MODULE_NAME ...\n\n"
|
||||||
|
|
||||||
# Add code here
|
# Add code here
|
||||||
# Use varibles from the templatefile function in main.tf
|
# Use varibles from the templatefile function in main.tf
|
||||||
# e.g. LOG_PATH, PORT, etc.
|
# e.g. LOG_PATH, PORT, etc.
|
||||||
@@ -13,6 +21,6 @@ printf "👷 Starting MODULE_NAME in background...\n\n"
|
|||||||
# 1. Use & to run it in background
|
# 1. Use & to run it in background
|
||||||
# 2. redirct stdout and stderr to log files
|
# 2. redirct stdout and stderr to log files
|
||||||
|
|
||||||
./app >${LOG_PATH} 2>&1 &
|
./app > "$${LOG_PATH}" 2>&1 &
|
||||||
|
|
||||||
printf "check logs at ${LOG_PATH} \n\n"
|
printf "check logs at %s\n\n" "$${LOG_PATH}"
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ BOLD='\033[0;1m'
|
|||||||
printf "$${BOLD}Logging into Coder...\n\n$${RESET}"
|
printf "$${BOLD}Logging into Coder...\n\n$${RESET}"
|
||||||
|
|
||||||
if ! coder list > /dev/null 2>&1; then
|
if ! coder list > /dev/null 2>&1; then
|
||||||
set +x; coder login --token="${CODER_USER_TOKEN}" --url="${CODER_DEPLOYMENT_URL}"
|
set +x
|
||||||
|
coder login --token="${CODER_USER_TOKEN}" --url="${CODER_DEPLOYMENT_URL}"
|
||||||
else
|
else
|
||||||
echo "You are already authenticated with coder."
|
echo "You are already authenticated with coder."
|
||||||
fi
|
fi
|
||||||
|
|||||||
11
package.json
11
package.json
@@ -2,16 +2,17 @@
|
|||||||
"name": "modules",
|
"name": "modules",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "bun test",
|
"test": "bun test",
|
||||||
"fmt": "bun x prettier -w **/*.ts **/*.md *.md && terraform fmt **/*.tf",
|
"fmt": "bun x prettier --plugin prettier-plugin-sh -w **/*.sh .sample/run.sh new.sh **/*.ts **/*.md *.md && terraform fmt **/*.tf .sample/main.tf",
|
||||||
"fmt:ci": "bun x prettier --check **/*.ts **/*.md *.md && terraform fmt -check **/*.tf",
|
"fmt:ci": "bun x prettier --plugin prettier-plugin-sh --check **/*.sh .sample/run.sh new.sh **/*.ts **/*.md *.md && terraform fmt -check **/*.tf .sample/main.tf",
|
||||||
"lint": "bun run lint.ts"
|
"lint": "bun run lint.ts"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bun-types": "^1.0.3",
|
"bun-types": "^1.0.18",
|
||||||
"gray-matter": "^4.0.3",
|
"gray-matter": "^4.0.3",
|
||||||
"marked": "^9.0.3"
|
"marked": "^11.1.0",
|
||||||
|
"prettier-plugin-sh": "^0.13.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^5.0.0"
|
"typescript": "^5.3.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
PROVIDER_ID=${PROVIDER_ID}
|
PROVIDER_ID=${PROVIDER_ID}
|
||||||
SLACK_MESSAGE=$(cat << "EOF"
|
SLACK_MESSAGE=$(
|
||||||
|
cat << "EOF"
|
||||||
${SLACK_MESSAGE}
|
${SLACK_MESSAGE}
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user