Skip to content

Commit 1430697

Browse files
committed
Add update-demo script for quarto-demo subtree
Shell script wraps the git subtree pull command so the long prefix path and remote URL don't need to be remembered.
1 parent 4a67ff3 commit 1430697

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

tools/screenshots/CLAUDE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Use `/screenshot` to walk through the process:
4444
| `npm run render` | Render example Quarto projects |
4545
| `npm run serve` | Serve rendered sites locally |
4646
| `npm run compress` | Compress PNGs with oxipng |
47+
| `npm run update-demo` | Pull latest quarto-demo subtree from upstream |
4748
| `npm run help` | Show available commands |
4849

4950
## Manifest
@@ -224,6 +225,17 @@ Both can be combined. `cropBottom` is applied first, then `maxHeight`.
224225
- CI compresses all changed PNGs after merge (safety net)
225226
- `npm run capture` compresses by default (`--no-compress` to skip, or `defaults.compress: false` in manifest)
226227

228+
## Example Site (quarto-demo subtree)
229+
230+
`examples/quarto-demo/` is a git subtree of
231+
[quarto-dev/quarto-demo](https://github.com/quarto-dev/quarto-demo). To pull
232+
upstream changes:
233+
234+
npm run update-demo
235+
236+
This runs `git subtree pull --squash` from the repo root. Extra args are passed
237+
through (e.g., `npm run update-demo -- --message "Update demo site"`).
238+
227239
## Environment
228240

229241
- `package.json` lives in `tools/screenshots/` — run `npm` commands from that directory

tools/screenshots/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"compress": "node scripts/compress.js",
1010
"capture": "node capture.js",
1111
"open": "node scripts/open.js",
12-
"validate": "node scripts/validate.js"
12+
"validate": "node scripts/validate.js",
13+
"update-demo": "bash scripts/update-demo.sh"
1314
},
1415
"dependencies": {
1516
"ajv": "^8.18.0",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
# Update the quarto-demo git subtree from upstream.
3+
# Run from anywhere inside the repo.
4+
5+
set -euo pipefail
6+
7+
REPO_ROOT="$(git rev-parse --show-toplevel)"
8+
PREFIX="tools/screenshots/examples/quarto-demo"
9+
REMOTE="https://github.com/quarto-dev/quarto-demo"
10+
BRANCH="main"
11+
12+
cd "$REPO_ROOT"
13+
git subtree pull --prefix="$PREFIX" "$REMOTE" "$BRANCH" --squash "$@"

0 commit comments

Comments
 (0)