feat: public release export of the mother theme only
- variants/export_public.sh builds a public folder + zip of ONLY this mother theme: excludes .git and variants/*.json (client house-style definitions), scans the result for client-identifying strings and aborts on any hit. Default output: <limesurvey-root>/dist (not inside upload/themes/survey, which is scanned for themes). - README.md: "Public release" section; client-identifying examples scrubbed (generic <client> placeholders, no client names/colors); note that client definitions live in a private repo (gitignored here). - .gitignore keeps variants/*.json (and the internal variants README) out of this public repository. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
7de33a31f7
commit
0ca0da8b1a
2 changed files with 69 additions and 0 deletions
16
README.md
16
README.md
|
|
@ -116,3 +116,19 @@ Because of the native `<extends>` mechanism:
|
|||
- house-style values live only in `variants/<client>.json` and the variant's
|
||||
`files/`, so they are never overwritten by changes in this mother theme.
|
||||
|
||||
## Public release
|
||||
|
||||
The public version of this theme is ONLY the mother theme: this directory
|
||||
without `variants/` (client house-style definitions) and without `.git`.
|
||||
Build it with:
|
||||
|
||||
bash variants/export_public.sh [output-dir]
|
||||
|
||||
This creates a checked, client-free copy plus a zip (default output:
|
||||
`<limesurvey-root>/dist/`). Publish only that artifact / the `main` branch.
|
||||
NEVER publish: `variants/*.json`, generated client theme folders, or any git
|
||||
branch containing a client theme (client names, colors and logos are
|
||||
confidential). Client variant definitions stay in a PRIVATE repository (or
|
||||
locally); `variants/*.json` is gitignored and `build.php` reads the
|
||||
definitions from that private folder via its second argument or
|
||||
RESPONDAGE_VARIANTS_DIR.
|
||||
|
|
|
|||
53
variants/export_public.sh
Normal file
53
variants/export_public.sh
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Build a PUBLIC release of the mother theme (respondage_vanilla) only.
|
||||
#
|
||||
# Client data (variant definitions variants/*.json, generated client theme
|
||||
# folders, git branches containing a client theme) must NEVER be published.
|
||||
# This script therefore:
|
||||
# 1. copies the theme WITHOUT .git, WITHOUT variants/*.json (only the
|
||||
# generic build.php and export script are kept) and without old exports;
|
||||
# 2. scans the staged copy for client-identifying strings and ABORTS if any
|
||||
# are found;
|
||||
# 3. creates a zip next to the folder.
|
||||
#
|
||||
# Usage:
|
||||
# bash variants/export_public.sh [output-dir]
|
||||
#
|
||||
# Default output dir: <limesurvey-root>/dist (deliberately NOT inside
|
||||
# upload/themes/survey/, because every folder there is scanned as a theme).
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
THEME_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
SITE_ROOT="$(cd "$THEME_DIR/../../../.." && pwd)"
|
||||
OUT_DIR="${1:-$SITE_ROOT/dist}"
|
||||
STAGE="$OUT_DIR/respondage_vanilla"
|
||||
VERSION="$(sed -n 's:.*<version>\([^<]*\)</version>.*:\1:p' "$THEME_DIR/config.xml" | head -1)"
|
||||
ZIP_NAME="respondage_vanilla-${VERSION}-public.zip"
|
||||
|
||||
rm -rf "$STAGE"
|
||||
mkdir -p "$STAGE" "$OUT_DIR"
|
||||
|
||||
# 1. copy the theme, excluding .git, client variant definitions, the internal
|
||||
# variants README and old exports (the generic build/export scripts are kept)
|
||||
(cd "$THEME_DIR" && tar --exclude='./.git' --exclude='./dist' --exclude='./variants/*.json' --exclude='./variants/README.internal.md' -cf - .) | (cd "$STAGE" && tar -xf -)
|
||||
|
||||
# 2. leak check: no client-identifying strings may remain (text files only).
|
||||
# The bracket trick keeps this script from matching its own pattern.
|
||||
if grep -rIlE 'eras[m]us|defen[s]ie|rijk[s]logo' "$STAGE"; then
|
||||
echo "ERROR: client-identifying strings found in the public export - aborting, staging removed." >&2
|
||||
rm -rf "$STAGE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 3. zip it
|
||||
(cd "$OUT_DIR" && rm -f "$ZIP_NAME" && zip -qr "$ZIP_NAME" respondage_vanilla)
|
||||
|
||||
echo "Public release created:"
|
||||
echo " folder: $STAGE"
|
||||
echo " zip: $OUT_DIR/$ZIP_NAME"
|
||||
echo
|
||||
echo "Publish ONLY this artifact (or the main branch of this repo)."
|
||||
echo "NEVER publish variants/*.json, generated client theme folders, or a git"
|
||||
echo "branch that contains a client theme - client names, colors and logos are confidential."
|
||||
Loading…
Reference in a new issue