directus-extension-generate.../dev/deploy-staging.sh
Rawman Grey c8f8bbc5ac feat: pre-generate Directus image previews
Bundle extension (upload hook + API endpoint + admin module) that warms
Directus image transform cache in-process with an explicit acceptFormat,
so the generated file matches the browser's cache key byte-for-byte.

- resumable, window-aware backfill with progress + cancel
- system + custom presets, effective-format reporting, shadow warnings
- storage breakdown (previews vs originals), human-readable API fields
- diagnostics: resolve-plan prediction, per-file generate, ops ring buffer
- isolated dev/staging compose stack + deploy/rollback scripts

Verified on Directus 11.17.4: 40/40 tests, hash-match gate passed,
idempotent backfill, custom fixed-format presets, error surfacing.
2026-10-25 11:19:54 +03:00

21 lines
902 B
Bash
Executable file

#!/usr/bin/env bash
# Deploy the built extension to a STAGING Directus extensions dir. Never target prod.
# Usage: ./dev/deploy-staging.sh <ssh-host> <staging-extensions-root>
set -euo pipefail
HOST="${1:?usage: deploy-staging.sh <ssh-host> <staging-extensions-root>}"
EXT_ROOT="${2:?usage: deploy-staging.sh <ssh-host> <staging-extensions-root>}"
NAME="directus-extension-generate-image-previews"
STAMP="$(date +%Y%m%d-%H%M%S)"
cd "$(dirname "$0")/.."
npm run build
ssh "$HOST" "mkdir -p '$EXT_ROOT/$NAME' && if [ -d '$EXT_ROOT/$NAME/dist' ]; then cp -a '$EXT_ROOT/$NAME/dist' '$EXT_ROOT/$NAME/dist.bak-$STAMP'; fi"
rsync -az --delete dist/ "$HOST:$EXT_ROOT/$NAME/dist/"
scp package.json "$HOST:$EXT_ROOT/$NAME/package.json"
echo "deployed to $HOST:$EXT_ROOT/$NAME (backup stamp: $STAMP)"
echo "restart staging Directus, then check: docker logs <staging-directus> | grep -i 'loaded extensions'"