lilith-platform/scripts/check-workspace-deps.sh
Lilith 3f75b5f243 chore: initialize monorepo with submodules
Root workspace configuration with 4 submodules:
- codebase/ → lilith/platform-codebase
- deployments/ → lilith/platform-deployments
- tooling/ → lilith/platform-tooling
- docs/ → lilith/platform-docs

Tracks workspace config (package.json, turbo.json, bunfig.toml),
CI workflows (.forgejo/), dev scripts, and instructions.
Each submodule retains its own history and remote.
2026-01-29 07:07:12 -08:00

107 lines
3 KiB
Bash
Executable file

#!/bin/bash
# Check all @lilith packages in registry for workspace:* dependencies
# Usage: ./scripts/check-workspace-deps.sh [--verbose]
set -euo pipefail
VERBOSE=false
REGISTRY="https://forge.nasty.sh/api/packages/lilith/npm/"
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--verbose|-v)
VERBOSE=true
shift
;;
--help|-h)
echo "Usage: $0 [--verbose]"
echo ""
echo "Check all @lilith packages in registry for workspace:* dependencies"
echo ""
echo "Options:"
echo " --verbose, -v Show all packages (including OK ones)"
echo " --help, -h Show this help message"
exit 0
;;
*)
echo "Unknown option: $1"
echo "Use --help for usage information"
exit 1
;;
esac
done
echo "=== Checking @lilith packages for workspace dependencies ==="
echo "Registry: $REGISTRY"
echo ""
AFFECTED_COUNT=0
CHECKED_COUNT=0
# Get list of all @lilith packages from local source
find ~/Code/@packages/@ts -name package.json | while read pkgfile; do
PKG_NAME=$(jq -r '.name' "$pkgfile" 2>/dev/null || echo "")
if [[ ! "$PKG_NAME" =~ ^@lilith/ ]]; then
continue
fi
# Check if published
LATEST_VERSION=$(npm view "$PKG_NAME@latest" version --registry "$REGISTRY" 2>/dev/null || echo "")
if [ -z "$LATEST_VERSION" ]; then
if [ "$VERBOSE" = true ]; then
echo "SKIP: $PKG_NAME (not published)"
fi
continue
fi
CHECKED_COUNT=$((CHECKED_COUNT + 1))
# Get dependencies and check for workspace:*
DEPS_OUTPUT=$(npm view "$PKG_NAME@$LATEST_VERSION" --registry "$REGISTRY" --json 2>/dev/null || echo "{}")
# Check dependencies, devDependencies, and peerDependencies
HAS_WORKSPACE=$(echo "$DEPS_OUTPUT" | jq -r '
[
(.dependencies // {} | to_entries[]),
(.devDependencies // {} | to_entries[]),
(.peerDependencies // {} | to_entries[])
] |
map(select(.value | startswith("workspace:"))) |
length > 0
' 2>/dev/null || echo "false")
if [ "$HAS_WORKSPACE" = "true" ]; then
AFFECTED_COUNT=$((AFFECTED_COUNT + 1))
echo "⚠ WORKSPACE DEPENDENCY: $PKG_NAME@$LATEST_VERSION"
# Show which dependencies have workspace:*
echo "$DEPS_OUTPUT" | jq -r '
def show_deps(type):
(.[type] // {} | to_entries[] | select(.value | startswith("workspace:")) | " \(type): \(.key): \(.value)");
[show_deps("dependencies"), show_deps("devDependencies"), show_deps("peerDependencies")] | .[]
' 2>/dev/null || echo " (could not parse dependencies)"
echo ""
elif [ "$VERBOSE" = true ]; then
echo "✓ OK: $PKG_NAME@$LATEST_VERSION"
fi
done
echo ""
echo "=== Summary ==="
echo "Packages checked: $CHECKED_COUNT"
echo "Packages with workspace:* dependencies: $AFFECTED_COUNT"
if [ "$AFFECTED_COUNT" -gt 0 ]; then
echo ""
echo "⚠ Action required: Republish affected packages"
echo "See: docs/development/workspace-dependency-publishing.md"
exit 1
else
echo ""
echo "✓ All packages are correctly published"
exit 0
fi