Skip to content

Commit

Permalink
Merge pull request #2500 from HHS/main
Browse files Browse the repository at this point in the history
[PROD] Coverage, data consistency, devops, screen shots
  • Loading branch information
Jones-QuarteyDana authored Nov 29, 2024
2 parents 8981e94 + 8f5b3cb commit 25a26a4
Show file tree
Hide file tree
Showing 74 changed files with 3,808 additions and 1,021 deletions.
288 changes: 248 additions & 40 deletions .circleci/config.yml

Large diffs are not rendered by default.

43 changes: 33 additions & 10 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
#!/usr/bin/env bash
set -e

# Set USE_DOCKER based on whether both backend and frontend containers are running
USE_DOCKER=false
if [ "$(docker ps | grep -E "head-start-ttadp-backend|head-start-ttadp-frontend" | wc -l)" -eq 2 ]; then
USE_DOCKER=true
fi

# Ensure node_modules is populated for frontend or backend (only for non-Docker users)
check_and_run_yarn() {
local dir=$1
if [ ! -d "$dir/node_modules" ] || [ -z "$(ls -A "$dir/node_modules")" ]; then
echo "Installing dependencies in $dir"
(cd "$dir" && yarn)
fi
}

common_changed=false
common_package_json_changed=false
frontend_yarn_lock_changed=false
Expand All @@ -9,7 +24,6 @@ files=$(git diff --cached --name-only)

for f in $files
do

# check if packages/common/src/index.js was changed
if [ -e "$f" ] && [[ $f == packages/common/src/index.js ]]; then
common_changed=true
Expand Down Expand Up @@ -37,19 +51,28 @@ do
git add "$f"
fi

# Autolint changed .js files
if [ -e "$f" ] && [[ $f == *.js ]]; then
yarn lint:fix:single "$f"
git add "$f"
fi

# Autolint changed .ts files
if [ -e "$f" ] && [[ $f == *.ts ]]; then
yarn lint:fix:single "$f"
# Autolint changed .js and .ts files
if [ -e "$f" ] && ([[ $f == *.js ]] || [[ $f == *.ts ]]); then
if [ "$USE_DOCKER" = true ]; then
if [[ $f == frontend/* ]]; then
yarn docker:yarn:fe lint:fix:single "$f"
else
yarn docker:yarn:be lint:fix:single "$f"
fi
else
if [[ $f == frontend/* ]]; then
check_and_run_yarn frontend
yarn lint:fix:single "$f"
else
check_and_run_yarn "."
yarn lint:fix:single "$f"
fi
fi
git add "$f"
fi
done

# Versioning and lock file checks
if [ $common_changed = true ]; then
if [ $common_package_json_changed = false ]; then
echo "ERROR: common/src/index.js was changed, but common/package.json was not updated. Please make sure to publish a new version."
Expand Down
Loading

0 comments on commit 25a26a4

Please sign in to comment.