mirror of
https://github.com/michaelshimeles/terminal.git
synced 2026-11-09 11:51:25 -10:00
Document the site's Node minimum and find Chrome on Linux
SvelteKit needs Node 22.17 or later, and engine-strict makes npm install stop on older versions, so declare it in engines and say so in the README. build-images.sh now finds Chrome or Chromium on PATH before falling back to the macOS app, and stops with a clear message when neither is there. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
adc002ac1d
commit
875b484f2d
4 files changed
+29
-4
No files matched your search
+7
-2
@@ -4,7 +4,9 @@ The download page for terminal-rs. It is one static page built with SvelteKit fo
|
||||
`/download` route that redirects to the latest release DMG.
|
||||
|
||||
This folder is its own npm project, separate from the Cargo workspace. Run the commands below from
|
||||
`site/`, and set the Vercel project's Root Directory to `site`.
|
||||
`site/`, and set the Vercel project's Root Directory to `site`. It needs Node 22.17 or later, the
|
||||
minimum SvelteKit supports; `.npmrc` turns on `engine-strict`, so `npm install` stops on older
|
||||
versions.
|
||||
|
||||
```sh
|
||||
cd site
|
||||
@@ -35,7 +37,10 @@ npm run check
|
||||
`hero-light.png`), the icon (`icon.svg`) and the Open Graph card template (`og.html`).
|
||||
`scripts/build-images.sh` regenerates everything in `static/` from them: AVIF and WebP screenshots
|
||||
at 1080 and 2160 px wide, a cropped screenshot for phones, the icon, favicons, the touch icon and
|
||||
`og.jpg`. It needs ImageMagick with AVIF support, `cwebp` and Google Chrome.
|
||||
`og.jpg`. It needs ImageMagick with AVIF support, `cwebp`, and Google Chrome or Chromium. The
|
||||
script finds `google-chrome`, `google-chrome-stable`, `chromium` or `chromium-browser` on your
|
||||
`PATH`, then Chrome in `/Applications`. Set `CHROME` to the browser's executable to use another
|
||||
one.
|
||||
|
||||
```sh
|
||||
./scripts/build-images.sh
|
||||
|
||||
Generated
+3
@@ -15,6 +15,9 @@
|
||||
"svelte-check": "^4.6.0",
|
||||
"typescript": "^6.0.3",
|
||||
"vite": "^8.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.17"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/fs-minipass": {
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"private": true,
|
||||
"version": "0.0.1",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": ">=22.17"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regenerate the optimized images in static/ from the sources in assets-src/.
|
||||
# Needs ImageMagick (with AVIF), cwebp and Google Chrome (renders the SVG icon and the OG card).
|
||||
# Needs ImageMagick (with AVIF), cwebp and Google Chrome or Chromium (renders the SVG icon and the
|
||||
# OG card). Set CHROME to the browser's executable if it isn't found.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
@@ -8,7 +9,20 @@ src=assets-src
|
||||
out=static
|
||||
tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
chrome=${CHROME:-"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"}
|
||||
|
||||
chrome=${CHROME:-}
|
||||
if [[ -z $chrome ]]; then
|
||||
for candidate in google-chrome google-chrome-stable chromium chromium-browser \
|
||||
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"; do
|
||||
if chrome=$(command -v "$candidate"); then
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [[ ! -x $chrome ]]; then
|
||||
echo "build-images.sh: Chrome or Chromium not found; set CHROME to its executable." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
render() { # render <url> <width> <height> <out.png>
|
||||
"$chrome" --headless=new --disable-gpu --hide-scrollbars --force-device-scale-factor=1 \
|
||||
|
||||
Reference in new issue
Block a user