forked from baron/baron-sso
chore: snapshot local state before dev merge
This commit is contained in:
@@ -23,10 +23,41 @@ assert_not_contains() {
|
||||
fi
|
||||
}
|
||||
|
||||
assert_service_contains() {
|
||||
local service="$1"
|
||||
local pattern="$2"
|
||||
awk -v service=" $service:" '
|
||||
$0 == service { in_service = 1; next }
|
||||
in_service && /^ [[:alnum:]_-]+:/ { in_service = 0 }
|
||||
in_service { print }
|
||||
' "$COMPOSE_FILE" | grep -Fq -- "$pattern" || fail "$service service must contain: $pattern"
|
||||
}
|
||||
|
||||
assert_service_not_contains() {
|
||||
local service="$1"
|
||||
local pattern="$2"
|
||||
if awk -v service=" $service:" '
|
||||
$0 == service { in_service = 1; next }
|
||||
in_service && /^ [[:alnum:]_-]+:/ { in_service = 0 }
|
||||
in_service { print }
|
||||
' "$COMPOSE_FILE" | grep -Fq -- "$pattern"; then
|
||||
fail "$service service must not contain: $pattern"
|
||||
fi
|
||||
}
|
||||
|
||||
for app in adminfront devfront orgfront; do
|
||||
assert_contains "./$app:/workspace/$app"
|
||||
assert_contains "/workspace/$app/node_modules"
|
||||
assert_not_contains "./$app:/app"
|
||||
assert_service_contains "$app" "target: dev"
|
||||
assert_service_contains "$app" "working_dir: /workspace/$app"
|
||||
assert_service_contains "$app" 'command: ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port",'
|
||||
assert_service_contains "$app" 'DEV_SERVER_WATCH_POLLING=${DEV_SERVER_WATCH_POLLING:-true}'
|
||||
assert_service_not_contains "$app" "serve_frontend_prod.mjs"
|
||||
grep -Fq -- "FROM deps AS dev" "$ROOT_DIR/$app/Dockerfile" || fail "$app Dockerfile must define a deps-based dev target"
|
||||
grep -Fq -- 'CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port",' "$ROOT_DIR/$app/Dockerfile" || fail "$app Dockerfile dev target must run Vite dev server"
|
||||
grep -Fq -- "FROM deps AS build" "$ROOT_DIR/$app/Dockerfile" || fail "$app Dockerfile must keep production build separate from dev"
|
||||
grep -Fq -- "FROM node:24-alpine AS production" "$ROOT_DIR/$app/Dockerfile" || fail "$app Dockerfile must keep production static serving target"
|
||||
done
|
||||
|
||||
assert_contains 'target: ${USERFRONT_BUILD_TARGET:-dev}'
|
||||
|
||||
Reference in New Issue
Block a user