feat(variants): build_all.sh modes — build only new variants, --rebuild only existing ones
- Default (build) mode picks up only *.json files for which NO variant folder (../<name>/) exists yet, so an existing variant is never clobbered by a build run (e.g. by a just-copied, not-yet-adjusted json). At the end it lists the jsons that were NOT picked up and advises that they possibly need to be re-built via 'build_all.sh --rebuild'. - '--rebuild' mode picks up only *.json files whose variant folder already exists, and advises about the jsons without a variant yet (build them with the default mode). - Both modes print a 'N built, M failed, K not picked up' summary, exit non-zero on any build failure, and keep the owner follow-up actions (reset themes in the LS admin, flushassets, Ctrl+F5). - README build/rebuild sections and AGENTS.md updated to the two modes. Verified in a /tmp sandbox: build mode built only the json without a variant folder and listed the existing ones with the --rebuild advice; --rebuild built only existing variants and listed the new json with the build advice; on the real definitions dir the default mode built 0 and skipped all 3 (variants exist) without touching ../respondage_respondage/config.xml (md5 unchanged). export_public.sh exit 0. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
73ee0e887f
commit
92cc6443ac
1 changed files with 79 additions and 23 deletions
34
README.md
34
README.md
|
|
@ -391,10 +391,14 @@ the variant's `preview.png` is identical to the mother's.
|
|||
"options": { "primarycolor": "#123456", "fontsize": "18px" }
|
||||
}
|
||||
```
|
||||
CAUTION: `build_all.sh` (step below) builds EVERY `*.json` in the
|
||||
definitions dir — do not run it while a just-copied json is still
|
||||
unadjusted, it would rebuild that variant with the copied values.
|
||||
3. Run `php variants/build.php <client> <definitions-dir>`. This generates
|
||||
3. Run `php variants/build.php <client> <definitions-dir>` — or, to build ALL
|
||||
new variants in one go, `bash variants/build_all.sh <definitions-dir>`:
|
||||
the default (build) mode picks up ONLY the `*.json` files for which NO
|
||||
variant exists yet (no `../<client>/` folder), so an existing variant is
|
||||
never clobbered by a build run — even by a just-copied, not-yet-adjusted
|
||||
json. The json files that were NOT picked up are listed at the end with the
|
||||
advice that they possibly need to be re-built (see the rebuild process).
|
||||
This generates
|
||||
`../<client>/config.xml`: a copy of this theme's config.xml with only those
|
||||
option values replaced, `<extends>` set to this theme, and the `<engine>`
|
||||
section emptied except `<optionspage>` (same as LimeSurvey's own "extend
|
||||
|
|
@ -418,18 +422,22 @@ the variant's `preview.png` is identical to the mother's.
|
|||
- Views/css/js changes in this theme apply to all variants immediately via
|
||||
`<extends>` — no rebuild needed (but do flush assets + Ctrl+F5 on the server).
|
||||
- After a `config.xml` change (new/renamed options) or a change to a
|
||||
`<client>.json` / `<client>/` in the definitions repo, rebuild ALL variants
|
||||
in one go:
|
||||
`<client>.json` / `<client>/` in the definitions repo, rebuild ALL existing
|
||||
variants in one go:
|
||||
```
|
||||
bash variants/build_all.sh <definitions-dir>
|
||||
bash variants/build_all.sh --rebuild <definitions-dir>
|
||||
```
|
||||
The `--rebuild` mode picks up ONLY the `*.json` files for which a variant
|
||||
folder ALREADY exists (`../<client>/`); the json files that were NOT picked
|
||||
up (no variant yet) are listed at the end with the advice to build them with
|
||||
the default mode (`bash variants/build_all.sh <definitions-dir>`).
|
||||
(`<definitions-dir>` defaults to `variants/` or `$RESPONDAGE_VARIANTS_DIR`;
|
||||
set `PHP_BIN=/path/to/php` if `php` is not on PATH.) It loops over every
|
||||
`*.json` in the definitions dir, calls `build.php` per variant, prints a
|
||||
summary (`N built, M failed`) and exits non-zero if any variant fails
|
||||
(unknown option keys fail loudly — the drift check). Then, per rebuilt
|
||||
variant: reset the theme in the LimeSurvey admin (Theme options → Reset),
|
||||
flush assets, Ctrl+F5. `build.php` enforces the per-variant rules itself:
|
||||
set `PHP_BIN=/path/to/php` if `php` is not on PATH.) Both modes call
|
||||
`build.php` per picked-up variant, print a summary
|
||||
(`N built, M failed, K not picked up`) and exit non-zero if any variant
|
||||
fails (unknown option keys fail loudly — the drift check). Then, per
|
||||
(re)built variant: reset the theme in the LimeSurvey admin (Theme options →
|
||||
Reset), flush assets, Ctrl+F5. `build.php` enforces the per-variant rules itself:
|
||||
`files/preview.svg` is only added at first creation and never overwritten,
|
||||
and it warns when a variant's `preview.png` is identical to the mother's.
|
||||
Never edit the generated `../<client>/` folder by hand — every build
|
||||
|
|
|
|||
Loading…
Reference in a new issue