Skip to content

Commit 8e6cd12

Browse files
authored
Migrate theme from git submodule to Hugo Module (v0.2.2) (#25)
* Migrate theme from git submodule to Hugo Module (v0.2.2) Drops themes/pager submodule in favor of a Hugo Module import pinned in go.mod and vendored under _vendor/. Vendoring keeps CI and Cloudflare Pages free of a Go toolchain requirement (only the maintainer running `hugo mod get` / `hugo mod vendor` needs Go). Theme bump v0.2.0 -> v0.2.2 covers the cosmetic cleanup from 0.2.1 (rounded-corners fix, stale Cascadia references, doc honesty) and the self-hosted JS lint from 0.2.2. Because the theme now owns its own ESLint + tsc --checkJs, the blog drops its mirror tooling: - eslint.config.mjs, package.json (+ lock), and node_modules. - `js-lint` / `js-typecheck` pre-commit hooks. - `lint` CI job in perf.yml (budget + lighthouse remain). - Required-status-checks on main updated to {budget, lighthouse}. Docs also trimmed: PERFORMANCE.md stops documenting theme internals (SCSS pipeline paths, the min-content gotcha story, font-family declarations) and delegates implementation to the theme. The blog-level rules - 14 KB single flight, zero JS, system fonts, Lighthouse 100 - stay. README swaps the submodule instructions for the Hugo Module bump flow. * chore: drop stale tests/visual/ large-file exclude The `exclude: ^tests/visual/.*-snapshots/.*\.png$` pattern targeted Playwright visual-regression snapshots in a tests/ tree that was retired in the v0.2.0 release. The 200 KB large-file guard has had no paths to skip since; the line is dead weight. --------- Co-authored-by: Przemysław Szypowicz <2733699+pszypowicz@users.noreply.github.com>
1 parent 5ad265c commit 8e6cd12

48 files changed

Lines changed: 1517 additions & 1280 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/perf.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
2323
with:
24-
submodules: recursive
2524
fetch-depth: 1
2625
- name: Install Hugo extended
2726
run: |
@@ -40,33 +39,12 @@ jobs:
4039
- name: Single-flight bench
4140
run: scripts/bench.sh
4241

43-
lint:
44-
runs-on: ubuntu-latest
45-
steps:
46-
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
47-
with:
48-
submodules: recursive
49-
fetch-depth: 1
50-
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
51-
with:
52-
node-version: '22'
53-
cache: npm
54-
- name: Install npm devDependencies
55-
# --ignore-scripts blocks postinstall hooks so a malicious
56-
# package-lock.json change cannot execute code during install.
57-
run: npm ci --include=dev --ignore-scripts
58-
- name: ESLint
59-
run: npm run lint
60-
- name: TypeScript check
61-
run: npm run typecheck
62-
6342
lighthouse:
6443
runs-on: ubuntu-latest
6544
needs: budget
6645
steps:
6746
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
6847
with:
69-
submodules: recursive
7048
fetch-depth: 1
7149
- name: Install Hugo extended
7250
run: |

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ repos:
1818
- id: check-merge-conflict
1919
- id: check-added-large-files
2020
args: ["--maxkb=200"]
21-
exclude: ^tests/visual/.*-snapshots/.*\.png$
2221
- id: mixed-line-ending
2322
args: ["--fix=lf"]
2423

@@ -36,22 +35,8 @@ repos:
3635
language: system
3736
pass_filenames: false
3837
always_run: false
39-
files: ^(content/|static/|themes/|config/|hugo\.toml)
38+
files: ^(content/|static/|_vendor/|config/|hugo\.toml)
4039
description: >
4140
Build the site and enforce the byte / single-packet / zero-JS
4241
budgets defined in docs/PERFORMANCE.md. Only fires when site
4342
sources change.
44-
45-
- id: js-lint
46-
name: ESLint (themes/pager/assets/js)
47-
entry: npm run --silent lint
48-
language: system
49-
pass_filenames: false
50-
files: ^(themes/pager/assets/js/|eslint\.config\.mjs$)
51-
52-
- id: js-typecheck
53-
name: tsc --checkJs (themes/pager/assets/js)
54-
entry: npm run --silent typecheck
55-
language: system
56-
pass_filenames: false
57-
files: ^(themes/pager/assets/js/|themes/pager/jsconfig\.json$)

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ scripts/http-verify.sh # post-deploy: TLS 1.3, HTTP/3, Brotli, cache headers
3333
## Layout
3434

3535
- `content/` - posts and pages
36-
- `config/_default/` - Hugo config split by concern (hugo, params, menu, markup, languages)
37-
- `themes/pager/` - theme submodule
36+
- `config/_default/` - Hugo config split by concern (hugo, params, menu, markup, module, languages)
37+
- `_vendor/` - Hugo Modules vendored tree (theme lives here; pinned in `go.mod`)
3838
- `scripts/` - budget and perf verification
3939
- `docs/` - public performance charter
4040

@@ -44,14 +44,14 @@ scripts/http-verify.sh # post-deploy: TLS 1.3, HTTP/3, Brotli, cache headers
4444

4545
```sh
4646
git checkout -b <topic> # branch off main
47-
# edit, commit (pre-commit runs budget / lint / typecheck on staged files)
47+
# edit, commit (pre-commit runs the perf budget on staged files)
4848
git push -u origin <topic>
4949
gh pr create --fill # opens PR against main
5050
```
5151

5252
Opening the PR triggers:
5353

54-
- **GitHub Actions** (`.github/workflows/perf.yml`) - runs `budget`, `lint`, `lighthouse` jobs. Required to pass before merge.
54+
- **GitHub Actions** (`.github/workflows/perf.yml`) - runs `budget` and `lighthouse` jobs. Required to pass before merge.
5555
- **Cloudflare Pages preview** - auto-deploys the branch to `https://<branch>.blog-szypowicz.pages.dev/`. Open it on the iPad / desktop to visually verify.
5656

5757
Once green:
@@ -62,7 +62,13 @@ gh pr merge --squash --delete-branch
6262

6363
Production (`main` on Cloudflare Pages) rebuilds automatically from the merged commit.
6464

65-
Theme changes (`themes/pager/`) follow the same pattern in the [`hugo-theme-pager`](https://github.com/pszypowicz/hugo-theme-pager) repo; merge theme PRs first, then bump the submodule pointer here via a blog PR.
65+
Theme changes happen in the [`hugo-theme-pager`](https://github.com/pszypowicz/hugo-theme-pager) repo. After a theme release, bump the pin here via:
66+
67+
```sh
68+
hugo mod get github.com/pszypowicz/hugo-theme-pager@vX.Y.Z
69+
hugo mod vendor
70+
# commit go.mod, go.sum, and _vendor/ in a blog PR
71+
```
6672

6773
## License
6874

_vendor/github.com/pszypowicz/hugo-theme-pager/assets/js/autoreload.js

Lines changed: 78 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_vendor/github.com/pszypowicz/hugo-theme-pager/assets/js/overlay.js

Lines changed: 90 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)