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
5 changes: 3 additions & 2 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ jobs:
cache: npm
- run: npm ci
- run: npm run check
- uses: actions/upload-pages-artifact@v5
- if: github.event_name == 'push'
uses: actions/upload-pages-artifact@v5
with:
path: _site
path: site

# Runs only if every check passed, so a failure leaves the last good site live.
deploy:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.DS_Store
.claude/
node_modules/
_site/
test-results/
Empty file removed .nojekyll
Empty file.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ This website is under the BSD 3-Clause license, so any code added to it has to b
| Non-commercial or no-derivatives terms | Don't adapt it. |
| Unknown, or no license | Don't adapt it. |

Fonts and other assets are the exception. They keep their own licenses, as long as those allow redistribution, including commercial use. Put the license file next to the asset and mention it in the README, as `fonts/OFL.txt` does for JetBrains Mono. An asset pasted into a page has no folder of its own, so its license goes in `licenses/`, as `licenses/octicons.txt` does for the GitHub mark.
Fonts and other assets are the exception. They keep their own licenses, as long as those allow redistribution, including commercial use. Put the license file next to the asset and mention it in the README, as `site/fonts/OFL.txt` does for JetBrains Mono. An asset pasted into a page has no folder of its own, so its license goes in `site/licenses/`, as `site/licenses/octicons.txt` does for the GitHub mark.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Ventris Tools is an open-source project for understanding EEG. Its first tool is
This is plain HTML and CSS, with no build step and no dependencies.

```bash
python3 -m http.server 4174
python3 -m http.server 4174 --directory site
```

Then open <http://localhost:4174>. The Ventris card's link gives a 404 here, because `/ventris/` is a separate site.

## Checks

The site has no dependencies, but its checks do. They need Node 22 and Google Chrome.
The site has no dependencies, but its checks do. They need Node 22.22 or 24.8 and up, and Google Chrome.

```bash
npm ci
Expand All @@ -29,15 +29,15 @@ This validates the HTML, then opens the pages in Chrome. It looks for console er

## Deployment

Every push to `main` runs the checks on GitHub Actions. If they pass, GitHub Pages publishes the `_site` folder they tested. If they fail, the last good version stays live.
Every push to `main` runs the checks on GitHub Actions. If they pass, GitHub Pages publishes the `site` folder they tested. If they fail, the last good version stays live.

`_site` holds only the files listed in `scripts/collect-site.sh`, so add any new file the site needs there. The checks fail if a page refers to a file that isn't listed.
Everything in `site/` is published, so keep anything that shouldn't be public out of it.

The app at `/ventris/` is the Pages site of the [ventris](https://github.com/ventris-tools/ventris) repository, so the card's link depends on that repository's name.

## Images

`og.png` and `apple-touch-icon.png` are rendered from the site's own copy, colors and fonts. Run this after you change the headline, the `og:description` or the palette. It needs Google Chrome.
`site/og.png` and `site/apple-touch-icon.png` are rendered from the site's own copy, colors and fonts. Run this after you change the headline, the `og:description` or the palette. It needs Google Chrome.

```bash
python3 scripts/make-images.py
Expand All @@ -47,10 +47,10 @@ python3 scripts/make-images.py

## Fonts

The files in `fonts/` are JetBrains Mono v2.304, cut down to Latin text without the code ligatures. A character outside this set falls back to a system font, so add it and run this on the release's `fonts/webfonts` files. It needs the `fonttools` and `brotli` Python packages.
The files in `site/fonts/` are JetBrains Mono v2.304, cut down to the characters English text needs, without hinting or OpenType features. A character outside this set falls back to a system font, so add it here and to `outsideFonts` in `test/site.spec.js`, then run this on the release's `fonts/webfonts` files. It needs the `fonttools` and `brotli` Python packages.

```bash
pyftsubset JetBrainsMono-Regular.woff2 --unicodes='U+0020-007E,U+00A0-00FF,U+2013,U+2014,U+2018,U+2019,U+201C,U+201D,U+2026,U+2190-2193' --layout-features='kern,mark,mkmk,ccmp,locl' --name-IDs='*' --flavor=woff2 --output-file=fonts/JetBrainsMono-Regular.woff2
pyftsubset JetBrainsMono-Regular.woff2 --unicodes='U+0020-007E,U+00A0,U+00B7,U+2013,U+2014,U+2018,U+2019,U+201C,U+201D,U+2026,U+2192' --layout-features='' --no-hinting --name-IDs='*' --flavor=woff2 --output-file=site/fonts/JetBrainsMono-Regular.woff2
```

Do the same for `JetBrainsMono-Medium.woff2`.
Expand All @@ -63,6 +63,6 @@ Read [CONTRIBUTING.md](CONTRIBUTING.md) before you reuse code from another proje

BSD 3-Clause. See [LICENSE](LICENSE).

The site uses [JetBrains Mono](https://github.com/JetBrains/JetBrainsMono), hosted here so that visitors make no third-party requests. The font is under the SIL Open Font License. See [fonts/OFL.txt](fonts/OFL.txt).
The site uses [JetBrains Mono](https://github.com/JetBrains/JetBrainsMono), hosted here so that visitors make no third-party requests. The font is under the SIL Open Font License. See [site/fonts/OFL.txt](site/fonts/OFL.txt).

The GitHub mark in the header is from [Octicons](https://github.com/primer/octicons), under the MIT license. See [licenses/octicons.txt](licenses/octicons.txt).
The GitHub mark in the header is from [Octicons](https://github.com/primer/octicons), under the MIT license. See [site/licenses/octicons.txt](site/licenses/octicons.txt).
1 change: 0 additions & 1 deletion favicon.svg

This file was deleted.

Binary file removed fonts/JetBrainsMono-Medium.woff2
Binary file not shown.
Binary file removed fonts/JetBrainsMono-Regular.woff2
Binary file not shown.
119 changes: 1 addition & 118 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@
"private": true,
"type": "module",
"scripts": {
"collect": "bash scripts/collect-site.sh",
"lint": "html-validate index.html 404.html",
"lint": "html-validate site/*.html",
"test": "playwright test",
"check": "npm run collect && npm run lint && npm run check:images && npm test",
"check": "npm run lint && npm run check:images && npm test",
"check:images": "python3 scripts/make-images.py --check",
"check:links": "node scripts/check-links.js"
},
"engines": {
"node": ">=22.13"
"node": "^22.22.0 || >=24.8.0"
},
"devDependencies": {
"@axe-core/playwright": "^4.14.0",
"@playwright/test": "^1.64.1",
"fontkit": "^2.0.4",
"html-validate": "^11.18.0"
}
}
2 changes: 1 addition & 1 deletion playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default defineConfig({
channel: "chrome",
},
webServer: {
command: `python3 -m http.server ${port} --bind 127.0.0.1 --directory _site`,
command: `python3 -m http.server ${port} --bind 127.0.0.1 --directory site`,
url: `http://127.0.0.1:${port}`,
stderr: "ignore",
},
Expand Down
10 changes: 0 additions & 10 deletions scripts/collect-site.sh

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/images.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
45f170b515ec00b826632b4a200db2c4106c8ff3533e610f0784246049ea02e3
23906fa57472a37b9096da51068d2937b3fe0a64a3f80b14271a0cf20a24fd62
18 changes: 10 additions & 8 deletions scripts/make-images.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
import tempfile
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
SCRIPTS = Path(__file__).resolve().parent
SITE = SCRIPTS.parent / "site"
CHROME = os.environ.get("CHROME", "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")

page = (ROOT / "index.html").read_text(encoding="utf-8")
css = (ROOT / "styles.css").read_text(encoding="utf-8")
logo = (ROOT / "favicon.svg").read_text(encoding="utf-8")
page = (SITE / "index.html").read_text(encoding="utf-8")
css = (SITE / "styles.css").read_text(encoding="utf-8")
# The images have one theme, so the logo's dark colors stay out of them.
logo = re.sub(r"<style>.*</style>", "", (SITE / "favicon.svg").read_text(encoding="utf-8"))


def find(pattern, text):
Expand All @@ -41,7 +43,7 @@ def color(name):


def font(weight):
data = (ROOT / "fonts" / f"JetBrainsMono-{weight}.woff2").read_bytes()
data = (SITE / "fonts" / f"JetBrainsMono-{weight}.woff2").read_bytes()
return "data:font/woff2;base64," + base64.b64encode(data).decode()


Expand Down Expand Up @@ -105,13 +107,13 @@ def render(markup, width, height, output):

# These two pages hold everything the images are made from, so this changes when an image would.
fingerprint = hashlib.sha256((OG_PAGE + ICON_PAGE).encode()).hexdigest()
stamp = ROOT / "scripts" / "images.sha256"
stamp = SCRIPTS / "images.sha256"

if "--check" in sys.argv:
if stamp.read_text(encoding="utf-8").strip() != fingerprint:
raise SystemExit("og.png or apple-touch-icon.png is out of date. Run: python3 scripts/make-images.py")
sys.exit()

render(OG_PAGE, 1200, 630, ROOT / "og.png")
render(ICON_PAGE, 180, 180, ROOT / "apple-touch-icon.png")
render(OG_PAGE, 1200, 630, SITE / "og.png")
render(ICON_PAGE, 180, 180, SITE / "apple-touch-icon.png")
stamp.write_text(fingerprint + "\n", encoding="utf-8")
5 changes: 1 addition & 4 deletions 404.html → site/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
<body>
<header class="masthead">
<a class="brand" href="/">
<svg viewBox="0 0 32 32" width="26" height="26" aria-hidden="true">
<rect class="brand-tablet" x="2" y="2" width="28" height="28" rx="7"/>
<path class="brand-trace" d="M6 17h4l2.5-6 4 13 3.5-11 2 4h4"/>
</svg>
<img src="/favicon.svg" width="26" height="26" alt="">
<span>Ventris Tools</span>
</a>
</header>
Expand Down
File renamed without changes
1 change: 1 addition & 0 deletions site/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/fonts/JetBrainsMono-Medium.woff2
Binary file not shown.
Binary file added site/fonts/JetBrainsMono-Regular.woff2
Binary file not shown.
File renamed without changes.
Loading
Loading