Skip to content

Commit 0552eee

Browse files
committed
Copy demo GIFs from demo/ dir into Astro on website build
1 parent 9a5d3da commit 0552eee

6 files changed

Lines changed: 14 additions & 10 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ playwright/.auth/
2626
# build output
2727
dist/
2828

29-
# auto-generated website data (produced by website/generate-data.sh)
29+
# auto-generated website files (produced by website/prepare-website.sh)
3030
website/src/data/data.js
31+
website/src/assets/demo-*.gif
3132

3233
# generated types
3334
.astro/

demo/demo-latte.tape

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
# Requires: brew install vhs
44

55
Output demo/demo-latte.gif
6-
Output website/src/assets/demo-latte.gif
76
Set Theme "Catppuccin Latte"
87
Source demo/demo-content.tape

demo/demo-mocha.tape

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
# Requires: brew install vhs
44

55
Output demo/demo-mocha.gif
6-
Output website/src/assets/demo-mocha.gif
76
Set Theme "Catppuccin Mocha"
87
Source demo/demo-content.tape

website/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The website depends on demo data generated from the `hdi` CLI. Before running th
1010
./build
1111
```
1212

13-
Data generation happens automatically via `predev` and `prebuild` npm scripts, so you don't need to run `generate-data.sh` manually.
13+
Data generation and asset copying happens automatically via `predev` and `prebuild` npm scripts, so you don't need to run `prepare-website.sh` manually.
1414

1515
## Local development
1616

@@ -96,8 +96,8 @@ npm run astro -- --help
9696

9797
## Regenerating data
9898

99-
`src/data/data.js` is auto-generated from the fixture READMEs using `hdi --json` and is not committed to git. It is regenerated automatically when running `npm run dev` or `npm run build`. To regenerate manually, run from the `website/` directory:
99+
`src/data/data.js` and the demo GIFs in `src/assets/` are auto-generated and not committed to git. They are regenerated automatically when running `npm run dev` or `npm run build`. To regenerate manually, run from the `website/` directory:
100100

101101
```bash
102-
./generate-data.sh
102+
./prepare-website.sh
103103
```

website/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"node": ">=22.12.0"
77
},
88
"scripts": {
9-
"predev": "bash ./generate-data.sh",
9+
"predev": "bash ./prepare-website.sh",
1010
"dev": "astro dev",
11-
"prebuild": "bash ./generate-data.sh",
11+
"prebuild": "bash ./prepare-website.sh",
1212
"build": "astro build",
1313
"preview": "astro preview",
1414
"astro": "astro",
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# generate-data.sh - Generate src/data/data.js from fixture READMEs using `hdi --json`
2+
# prepare-website.sh - Generate src/data/data.js and copy assets for the Astro build
33
set -euo pipefail
44

55
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
@@ -21,7 +21,7 @@ VERSION=$("$HDI" --version | awk '{print $2}')
2121

2222
# Start output
2323
{
24-
printf '// Auto-generated by website/generate-data.sh - do not edit manually\n\n'
24+
printf '// Auto-generated by website/prepare-website.sh - do not edit manually\n\n'
2525
printf 'export const PROJECTS = [\n'
2626

2727
first_project=true
@@ -120,3 +120,8 @@ print(' },')
120120

121121
npx --prefix "$SCRIPT_DIR" prettier --write "$OUT"
122122
echo "Generated: $OUT ($(wc -l < "$OUT" | tr -d ' ') lines)"
123+
124+
# Copy demo GIFs from demo/ into website assets
125+
cp "$ROOT/demo/demo-latte.gif" "$SCRIPT_DIR/src/assets/demo-latte.gif"
126+
cp "$ROOT/demo/demo-mocha.gif" "$SCRIPT_DIR/src/assets/demo-mocha.gif"
127+
echo "Copied demo GIFs into website/src/assets/"

0 commit comments

Comments
 (0)