Skip to content

Commit d5455fd

Browse files
committed
refactor: clean scripts
1 parent 4a7cc08 commit d5455fd

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

scripts/create-github-template.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
##############################################################################
66

77
set -euo pipefail
8-
cd $(dirname ${BASH_SOURCE[0]})
8+
cd "$(dirname "${BASH_SOURCE[0]}")"
99
cd ..
1010

1111
BASE_DIR=$(pwd)
1212
TEMPLATE_HOME=/tmp/nodejs-microservices-template
1313
TEMPLATE_REPO=git@github.com:azure-samples/nodejs-microservices-template.git
1414

1515
echo "Preparing GitHub project template..."
16-
rm -rf $TEMPLATE_HOME
17-
mkdir -p $TEMPLATE_HOME
16+
rm -rf "$TEMPLATE_HOME"
17+
mkdir -p "$TEMPLATE_HOME"
1818
find . -type d -not -path '*node_modules*' -not -path '*.git/*' -not -path './packages*' -exec mkdir -p '{}' "$TEMPLATE_HOME/{}" ';'
1919
find . -type f -not -path '*node_modules*' -not -path '*.git/*' -not -path './packages*' -exec cp -r '{}' "$TEMPLATE_HOME/{}" ';'
20-
cd $TEMPLATE_HOME
20+
cd "$TEMPLATE_HOME"
2121
rm -rf .git
2222
git init
2323

@@ -35,16 +35,18 @@ rm -rf docs
3535
rm -rf .azure/.*.env
3636
rm -rf .azure/_*.sh
3737
mkdir -p docs/assets
38-
cp $BASE_DIR/docs/assets/architecture.drawio.png docs/assets/architecture.drawio.png
38+
cp "$BASE_DIR/docs/assets/architecture.drawio.png" docs/assets/architecture.drawio.png
3939

4040
# Build script
41+
# shellcheck disable=SC2016
4142
echo -e '#!/usr/bin/env bash
4243
set -euo pipefail
4344
cd "$(dirname "${BASH_SOURCE[0]}")/.."
4445
4546
' > .azure/build.sh
4647

4748
# Deploy script
49+
# shellcheck disable=SC2016
4850
echo -e '#!/usr/bin/env bash
4951
set -eu
5052
cd "$(dirname "${BASH_SOURCE[0]}")"
@@ -62,15 +64,15 @@ commit_sha="$(git rev-parse HEAD)"
6264

6365
if [[ ${1-} == "--local" ]]; then
6466
echo "Local mode: skipping GitHub push."
65-
open $TEMPLATE_HOME
67+
open "$TEMPLATE_HOME"
6668
else
6769
# Update git repo
6870
git remote add origin $TEMPLATE_REPO
6971
git add .
7072
git commit -m "chore: initial commit"
7173
git push -u origin main --force
7274

73-
rm -rf $TEMPLATE_HOME
75+
rm -rf "$TEMPLATE_HOME"
7476
fi
7577

7678
echo "Successfully updated project template."

scripts/create-projects.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
##############################################################################
66

77
set -euo pipefail
8-
cd $(dirname ${BASH_SOURCE[0]})
8+
cd "$(dirname "${BASH_SOURCE[0]}")"
99

1010
target_folder=packages
1111

0 commit comments

Comments
 (0)