feat(audit, frontend, backend): introduce audit scripts and enhance error handling
- Added new npm scripts for auditing frontend size and inline TODOs, improving code quality management. - Enhanced error handling in the `nuscoreApiRoutes` to return specific validation error statuses, improving API response clarity. - Updated SQL migration documentation to establish a clear process for manual migrations and ensure backward compatibility. - Refactored various components to align with new design standards, enhancing UI consistency across the application.
This commit is contained in:
41
scripts/audit_frontend_size.sh
Normal file
41
scripts/audit_frontend_size.sh
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
TARGET_DIR="${1:-$ROOT_DIR/frontend/src}"
|
||||
WARN_BYTES=$((80 * 1024))
|
||||
REFACTOR_BYTES=$((120 * 1024))
|
||||
|
||||
if [[ ! -d "$TARGET_DIR" ]]; then
|
||||
echo "Directory not found: $TARGET_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Frontend size audit"
|
||||
echo "Target: $TARGET_DIR"
|
||||
echo "Warn threshold: ${WARN_BYTES} bytes (~80 KB)"
|
||||
echo "Refactor threshold: ${REFACTOR_BYTES} bytes (~120 KB)"
|
||||
echo
|
||||
|
||||
find "$TARGET_DIR" -type f \( -name '*.vue' -o -name '*.js' -o -name '*.ts' -o -name '*.scss' \) -printf '%s %p\n' \
|
||||
| sort -nr \
|
||||
| awk -v warn="$WARN_BYTES" -v refactor="$REFACTOR_BYTES" '
|
||||
BEGIN {
|
||||
printf "%-12s %-12s %s\n", "Size (KB)", "Status", "File";
|
||||
print "---------------------------------------------------------------";
|
||||
}
|
||||
{
|
||||
size_bytes = $1;
|
||||
size_kb = size_bytes / 1024;
|
||||
$1 = "";
|
||||
sub(/^ /, "", $0);
|
||||
status = "ok";
|
||||
if (size_bytes >= refactor) {
|
||||
status = "refactor";
|
||||
} else if (size_bytes >= warn) {
|
||||
status = "warn";
|
||||
}
|
||||
printf "%-12.1f %-12s %s\n", size_kb, status, $0;
|
||||
}
|
||||
' \
|
||||
| sed -n '1,40p'
|
||||
22
scripts/audit_inline_todos.sh
Normal file
22
scripts/audit_inline_todos.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
echo "Inline TODO/FIXME audit"
|
||||
echo "Target: $ROOT_DIR/frontend/src + $ROOT_DIR/backend"
|
||||
echo
|
||||
|
||||
if ! rg -n "TODO|FIXME|XXX" \
|
||||
"$ROOT_DIR/frontend/src" \
|
||||
"$ROOT_DIR/backend" \
|
||||
-g '*.vue' \
|
||||
-g '*.js' \
|
||||
-g '*.ts' \
|
||||
-g '*.scss' \
|
||||
-g '*.sql' \
|
||||
--glob '!**/dist/**' \
|
||||
--glob '!**/node_modules/**' \
|
||||
--glob '!**/package-lock.json'; then
|
||||
echo "No inline TODO/FIXME/XXX markers found in product code."
|
||||
fi
|
||||
Reference in New Issue
Block a user