Files
artcraft-services/script/website/unix_frontend_dashboard_dev.sh
Dylan M. Taylor d903ff2e2c Sonar: [[ ]] in scripts, npm install --ignore-scripts, retired local-dev setup out of scope (#373)
- **shell:S7688 (43)**: `[[ ]]` in place of `[ ]` in
`script/metrics/apply_{dashboards,metric_configs,monitors}.sh`,
`script/common/frontend_preflight.sh` and
`script/website/unix_frontend_dashboard_dev.sh`. Every script has a bash
shebang and `bash -n` passes. No test uses `-a`/`-o`, escaped
parentheses or an unquoted pattern on the right of `=`. The numeric
operands are `$#`, internal flags, exit codes, a parsed Node major
version and curl's status code, so `[[ ]]`'s arithmetic reading changes
nothing.
- **shell:S6505 (4)**: `npm install --ignore-scripts` in
`frontend_preflight.sh`, `unix_frontend_webapp_dev.sh` and
`frontend/build_modules.sh`. The frontend has no install scripts of its
own, and this repo's CI already builds with `npm ci --ignore-scripts`.
Same change as storytold/artcraft#2818.
- **Scope**: `_docs/old/**` joins `sonar.exclusions`. It's the retired
local-dev setup (an old Dockerfile, `kubernetes.yml`, nginx config) that
nothing references, and it held the docker and kubernetes findings under
`_docs/old/old_localdev_setup`.

Same as the other PRs here: not merged without the owner's go-ahead
(production service).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Chores**
* Frontend dependency installation now skips package-provided lifecycle
scripts, including during development setup. This changes which scripts
run during installation but does not change the frontend’s intended
features or behavior.
* Updated internal checks used by dashboard, metric, and monitor scripts
without changing their conditions or outcomes.
* Expanded static-analysis exclusions to include archived documentation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-11 07:34:01 -05:00

56 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Launch the Artcraft admin/moderator dashboard dev server.
#
# NOTE: frontend/apps/artcraft-dashboard is a STANDALONE app (its own
# package.json + pnpm-lock.yaml + node_modules, package manager: pnpm). It is
# NOT part of the Nx workspace, so we do NOT use `nx` or the nx preflight here.
root_dir=$(pwd)
dashboard_path="${root_dir}/frontend/apps/artcraft-dashboard"
if [[ ! -d "${dashboard_path}" ]]; then
echo "ERROR: dashboard directory not found at: ${dashboard_path}"
echo "Run this script from the repository root."
exit 1
fi
if ! command -v node &>/dev/null; then
echo "ERROR: node is not installed (or not on PATH)."
exit 1
fi
# pnpm is the dashboard's declared package manager. Prefer a real pnpm on PATH;
# otherwise run it through corepack (ships with Node) which provisions the
# version pinned in package.json's "packageManager" field.
if command -v pnpm &>/dev/null; then
pnpm_cmd=(pnpm)
elif command -v corepack &>/dev/null; then
pnpm_cmd=(corepack pnpm)
else
echo "ERROR: pnpm is not available. Install it with one of:"
echo " corepack enable # ships with Node.js"
echo " npm install -g pnpm"
exit 1
fi
echo "Running Artcraft Dashboard in Dev Mode..."
echo ""
# Kill any process running on port 4202, which will block startup
if lsof -i tcp:4202 &>/dev/null; then
lsof -i tcp:4202 -t | xargs kill -9
echo "Killed process running on port 4202"
else
echo "No process running on port 4202"
fi
pushd "${dashboard_path}" || exit
"${pnpm_cmd[@]}" install
export VITE_ENVIRONMENT_TYPE="production"
"${pnpm_cmd[@]}" dev
popd || exit