Skip to content
This repository was archived by the owner on Nov 17, 2026. It is now read-only.
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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ bun run test:watch # Run tests in watch mode
bun run test:update # Update test snapshots such as tests/external-links.txt
bun run lint # Run HTML validation with markuplint
bun run format # Format with Prettier
bun run deploy # Deploy public/ to DEPLOY_TARGET with rsync
bun run deploy # Deploy public/ to your server with rsync

# Optimization Utilities
bun run add-size-to-img # Add width/height to <img> tags for better performance
bun run clean-images # Remove unused images from project
bun run add-size-to-img # Add width/height to <img> tags for better performance
bun run clean-images # Remove unused images from project
bun run clean-images --dry-run # Preview unused image removals
```

Expand Down Expand Up @@ -271,9 +271,9 @@ PUBLIC_SUPABASE_ANON_KEY=your-anon-key
##### Option 2: Server Deployment (rsync)

- Use `bun run deploy` command in `apps/pages`
- Configure `DEPLOY_TARGET` in `apps/pages/commands/deploy.js`
- Ensure SSH access and rsync are available for your target server
- Direct file transfer to your server
- Configure the deploy target at the top of `apps/pages/commands/deploy.sh`
- Requires `rsync` and `ssh` on your local machine (macOS / Linux / WSL), and a server that accepts SSH
- Mirrors `public/` with `rsync --delete`, so files missing from `public/` are removed on the server

#### Setup Instructions

Expand Down
2 changes: 1 addition & 1 deletion apps/pages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ See the [root README](../../README.md) for commands and deployment.
2. **Size images while coding** _(optional)_ — `bun run add-size-to-img` bulk-adds `width`/`height` to every `<img>` for better Core Web Vitals.
3. **Validate** — `bun run test` confirms internal `href`/`src` paths resolve and tracks external links (see [Quality Assurance](#quality-assurance)); `bun run lint` runs markuplint and `bun run format` applies Prettier. These also run on commit via husky. If `bun run test` fails because links changed on purpose, run `bun run test:update` and review the `tests/external-links.txt` diff.
4. **Clean up images** — `bun run clean-images` removes images under `public/images/` that nothing references. It uses `git rm`, so removals are staged and recoverable; `bun run clean-images --dry-run` previews without deleting.
5. **Deploy** — `bun run build` compiles Tailwind, then `bun run deploy` uploads `public/` to your server with rsync (`DEPLOY_TARGET` — point it at staging or production).
5. **Deploy** — `bun run build` compiles Tailwind, then `bun run deploy` mirrors `public/` to your server with rsync. Set the deploy target at the top of `commands/deploy.sh` — point it at staging or production.

## Quality Assurance

Expand Down
47 changes: 0 additions & 47 deletions apps/pages/commands/deploy.js

This file was deleted.

23 changes: 23 additions & 0 deletions apps/pages/commands/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
# Shell, not JS: rsync and ssh are POSIX binaries, so a JS wrapper adds code without adding portability.
set -e

DEPLOY_HOST='<SSH_HOST>'
DEPLOY_DIR=/var/www/html
DEPLOY_URL=https://webapp-template-pages.usagizmo.com/

if [ "$DEPLOY_HOST" = '<SSH_HOST>' ]; then
echo 'Configure DEPLOY_HOST in commands/deploy.sh before running deploy.' >&2
exit 1
fi

# Absolute package root, so the script works from any cwd
PKG_DIR="$(cd "$(dirname "$0")/.." && pwd)"

# rsync creates only the last path segment, so the parents have to exist beforehand.
ssh "$DEPLOY_HOST" "mkdir -p '$DEPLOY_DIR'"

# -u leaves files that are newer on the server untouched.
rsync -ahvu --delete --exclude=".*" "$PKG_DIR/public/" "$DEPLOY_HOST:$DEPLOY_DIR/"

printf '\n🚀 \033[32m%s\033[0m\n\n' "$DEPLOY_URL"
33 changes: 0 additions & 33 deletions apps/pages/commands/update-snapshots.js

This file was deleted.

4 changes: 2 additions & 2 deletions apps/pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"lint:prettier": "prettier . --check --ignore-path=../../.prettierignore",
"lint": "run-p lint:*",
"test:watch": "bun test --watch",
"test:update": "bun ./commands/update-snapshots.js",
"test:update": "UPDATE_SNAPSHOTS=1 bun test",
"test": "bun test",
"format:js": "eslint --fix .",
"format:prettier": "prettier . --write --ignore-path=../../.prettierignore",
"format": "run-p format:*",
"add-size-to-img": "bun ./commands/add-size-to-img.js",
"clean-images": "bun ./commands/clean-images.js",
"deploy": "bun ./commands/deploy.js"
"deploy": "./commands/deploy.sh"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
Expand Down
20 changes: 11 additions & 9 deletions apps/pages/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -413,23 +413,25 @@ <h2 class="mb-4 text-2xl font-bold md:text-3xl">Commands</h2>
class="overflow-auto rounded-2xl bg-slate-800 p-6"
><code class="text-white font-mono"><span class="text-slate-500"># Install dependencies (.env file is created automatically)</span>
<span class="text-sky-300">bun</span> install
<span class="text-sky-300">cd</span> apps/pages

<span class="text-slate-500"># For static site development</span>
<span class="text-sky-300">bun</span> dev <span class="text-slate-500"># Start development server (port 3000)</span>
<span class="text-sky-300">bun</span> build <span class="text-slate-500"># Build static site with Tailwind CSS</span>
<span class="text-sky-300">bun run</span> dev <span class="text-slate-500"># Start development server (port 3000)</span>
<span class="text-sky-300">bun run</span> build <span class="text-slate-500"># Build static site with Tailwind CSS</span>

<span class="text-slate-500"># Quality assurance for pages</span>
<span class="text-sky-300">bun</span> test <span class="text-slate-500"># Validate links, images, and accessibility</span>
<span class="text-sky-300">bun</span> test:update <span class="text-slate-500"># Update test snapshots such as tests/external-links.txt</span>
<span class="text-sky-300">bun</span> lint <span class="text-slate-500"># Run HTML validation with markuplint</span>
<span class="text-sky-300">bun</span> format <span class="text-slate-500"># Format with Prettier</span>
<span class="text-sky-300">bun run</span> test <span class="text-slate-500"># Validate links, images, and accessibility</span>
<span class="text-sky-300">bun run</span> test:watch <span class="text-slate-500"># Run tests in watch mode</span>
<span class="text-sky-300">bun run</span> test:update <span class="text-slate-500"># Update test snapshots such as tests/external-links.txt</span>
<span class="text-sky-300">bun run</span> lint <span class="text-slate-500"># Run HTML validation with markuplint</span>
<span class="text-sky-300">bun run</span> format <span class="text-slate-500"># Format with Prettier</span>

<span class="text-slate-500"># Publishing</span>
<span class="text-sky-300">bun</span> run deploy <span class="text-slate-500"># Deploy public/ to DEPLOY_TARGET with rsync</span>
<span class="text-sky-300">bun run</span> deploy <span class="text-slate-500"># Deploy public/ to your server with rsync</span>

<span class="text-slate-500"># Optimization Utilities</span>
<span class="text-sky-300">bun run</span> add-size-to-img <span class="text-slate-500"># Add width/height to &lt;img&gt; tags for better performance</span>
<span class="text-sky-300">bun run</span> clean-images <span class="text-slate-500"># Remove unused images from project</span>
<span class="text-sky-300">bun run</span> add-size-to-img <span class="text-slate-500"># Add width/height to &lt;img&gt; tags for better performance</span>
<span class="text-sky-300">bun run</span> clean-images <span class="text-slate-500"># Remove unused images from project</span>
<span class="text-sky-300">bun run</span> clean-images --dry-run <span class="text-slate-500"># Preview unused image removals</span>
</code></pre>

Expand Down
2 changes: 1 addition & 1 deletion apps/pages/tests/path.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('The tests', () => {
try {
externalLinksText = await readFile(join(distDir, 'external-links.txt'), 'utf8');
} catch {
throw new Error('Missing tests/external-links.txt. Run `bun test:update` to create it.');
throw new Error('Missing tests/external-links.txt. Run `bun run test:update` to create it.');
}

expect(data).toBe(externalLinksText);
Expand Down
5 changes: 3 additions & 2 deletions commands/format-project-words.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# In repository root
cd "$(dirname $0)/.."
cd "$(dirname "$0")/.." || exit 1

cat project-words.txt | sed -e '/^$/d' | sort --ignore-case | tr '[A-Z]' '[a-z]' | uniq > project-words.txt.tmp && mv project-words.txt.tmp project-words.txt
cat project-words.txt | sed -e '/^$/d' | sort --ignore-case | tr 'A-Z' 'a-z' | uniq > project-words.txt.tmp && mv project-words.txt.tmp project-words.txt
3 changes: 2 additions & 1 deletion commands/init.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh
# In repository root
cd "$(dirname $0)/.."
cd "$(dirname "$0")/.." || exit 1

if [ ! -f .env ]; then
cp .env.example .env && echo 'Generated: .env'
Expand Down
Loading