diff --git a/README.md b/README.md index 7201495..7e9c51a 100644 --- a/README.md +++ b/README.md @@ -81,9 +81,9 @@ Each profile stores data in its own gitignored directory (`./data-work/`, `./dat `blueprint.json` controls what WordPress installs on first boot (plugins, theme, PHP version, site title). Edit it then run `./script/reset` to rebuild. Your notes are safe — the database lives in `./data/`, not in WP Playground's cache. -### Per-user overrides +### Per-profile overrides -Create a gitignored `blueprint-local.json` to customise your local setup without affecting others. Top-level keys override the base; steps are appended. +Create a `blueprint-local.json` inside a profile's data directory (`./data/blueprint-local.json`, `./data-work/blueprint-local.json`, etc.) to customise that profile's local setup without affecting others. Top-level keys override the base; `plugins` and `steps` arrays are concatenated. ```json { @@ -97,6 +97,8 @@ Create a gitignored `blueprint-local.json` to customise your local setup without } ``` +The file is kept with the private notes repo, so overrides are naturally scoped to that profile and never touch this public repo. + ## Scripts | Script | Purpose | @@ -130,8 +132,8 @@ The public repo contains only infrastructure. The `data/` directory (and any `da ```plaintext . ├── blueprint.json # WordPress Playground configuration (shared) -├── blueprint-local.json # Per-user overrides — gitignored, optional ├── data-*/ # Your private repo(s) — gitignored +│ └── blueprint-local.json # Per-profile overrides — optional, kept in private repo ├── package.json ├── schemas/ │ └── blueprint.json # JSON schema for blueprint files diff --git a/script/merge-blueprints b/script/merge-blueprints index 12eb808..2d29d21 100755 --- a/script/merge-blueprints +++ b/script/merge-blueprints @@ -1,7 +1,7 @@ #!/usr/bin/env node // Merge blueprint.json with blueprint-local.json (if it exists). // - Top-level keys from blueprint-local.json override blueprint.json -// - steps arrays are concatenated: base steps first, then local steps +// - steps and plugins arrays are concatenated: base first, then local // Writes merged JSON to stdout. const fs = require('fs'); @@ -9,7 +9,8 @@ const path = require('path'); const root = path.join(__dirname, '..'); const base = JSON.parse(fs.readFileSync(path.join(root, 'blueprint.json'), 'utf8')); -const localPath = path.join(root, 'blueprint-local.json'); +// Accept an explicit path as the first argument, falling back to the project root. +const localPath = process.argv[2] || path.join(root, 'blueprint-local.json'); if (!fs.existsSync(localPath)) { process.stdout.write(JSON.stringify(base, null, 2)); @@ -21,6 +22,7 @@ const local = JSON.parse(fs.readFileSync(localPath, 'utf8')); const merged = { ...base, ...local, + plugins: [...(base.plugins ?? []), ...(local.plugins ?? [])], steps: [...(base.steps ?? []), ...(local.steps ?? [])], }; diff --git a/script/save b/script/save index 29dbe2f..085810d 100755 --- a/script/save +++ b/script/save @@ -30,6 +30,7 @@ echo "==> Saving snapshot: $TIMESTAMP" cd "$DATA_DIR" git add database/ uploads/ +git add blueprint-local.json # Only commit bespoke themes and plugins, not those loaded via the blueprint.json git add -u themes/ plugins/ git diff --cached --quiet && echo " No changes to save." && exit 0 diff --git a/script/start b/script/start index df40f6c..3c50ebb 100755 --- a/script/start +++ b/script/start @@ -44,9 +44,9 @@ _on_interrupt() { trap '_cleanup' EXIT trap '_on_interrupt' INT -node script/merge-blueprints > "$BLUEPRINT" -if [ -f blueprint-local.json ]; then - echo "==> Merged blueprint.json + blueprint-local.json" +node script/merge-blueprints "$DATA_DIR/blueprint-local.json" > "$BLUEPRINT" +if [ -f "$DATA_DIR/blueprint-local.json" ]; then + echo "==> Merged blueprint.json + $DATA_DIR/blueprint-local.json" echo "==> Validating merged blueprint JSON against schema..." check-jsonschema --schemafile schemas/blueprint.json "$BLUEPRINT" fi