Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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 |
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions script/merge-blueprints
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/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');
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));
Expand All @@ -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 ?? [])],
};

Expand Down
1 change: 1 addition & 0 deletions script/save
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions script/start
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading