diff --git a/.gitignore b/.gitignore index 444527a..e934dac 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,10 @@ public/ _import/ docs/superpowers/ +# synced from node_modules/medium-zoom by scripts/sync-vendor-assets.js +# (see the preantora/preantora-local npm scripts) +ui/supplemental/js/vendor/ + # macOS and IDEs .DS_Store .vscode/ diff --git a/AGENTS.md b/AGENTS.md index 12ebea3..82dfef7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -21,7 +21,8 @@ This is the consolidated documentation **monorepo**. It supersedes the previous - `ui/supplemental/` -- supplemental files layered onto the stock Antora default UI - `global-attributes.yml` -- site-wide AsciiDoc attributes - `sync/` -- the retired upstream import tooling (`manifest.yml`, `patches/`); kept for provenance -- `test/` -- Node test suite +- `extension-tests/` -- Node test suite +- `scripts/` -- one-off build helpers (e.g. `sync-vendor-assets.js`, wired as `preantora`/`preantora-local`) - `package.json` -- npm scripts ## Development Conventions diff --git a/README.md b/README.md index 66d504c..10a0f05 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,10 @@ antora-extensions/ comp-version, latest/next-alias, sitemap-cleanup, globa asciidoc-extensions/ tabs, remote-include global-attributes.yml site-wide AsciiDoc attributes (local) ui/supplemental/ branding + Pagefind modal search on the stock UI +ui/supplemental/js/vendor/ gitignored; synced from node_modules by scripts/sync-vendor-assets.js content/// each version is a folder with its own antora.yml sync/ retired upstream-mirror tooling, kept as provenance +scripts/ build-time helpers (npm `pre*` hooks), e.g. sync-vendor-assets.js .github/workflows/ci.yml build → pagefind → deploy to GitHub Pages ``` diff --git a/extension-tests/latest-alias.test.js b/extension-tests/latest-alias.test.js index fe2a97e..bbef299 100644 --- a/extension-tests/latest-alias.test.js +++ b/extension-tests/latest-alias.test.js @@ -10,7 +10,7 @@ const assert = require('node:assert/strict') const fs = require('node:fs') const path = require('node:path') -const { latestByComponent } = require('./helpers/latest-versions') +const { latestByComponent } = require('./latest-versions') const PUBLIC = path.join(__dirname, '..', 'public') diff --git a/extension-tests/latest-versions.js b/extension-tests/latest-versions.js index 2ca17da..d0c4496 100644 --- a/extension-tests/latest-versions.js +++ b/extension-tests/latest-versions.js @@ -15,7 +15,7 @@ const fs = require('node:fs') const path = require('node:path') -const CONTENT = path.join(__dirname, '..', '..', 'content') +const CONTENT = path.join(__dirname, '..', 'content') // Numeric, segment-wise ascending compare ('10.16' > '10.9', not the string order). function compareVersions (a, b) { diff --git a/extension-tests/next-alias.test.js b/extension-tests/next-alias.test.js index bb45647..ecb6b1d 100644 --- a/extension-tests/next-alias.test.js +++ b/extension-tests/next-alias.test.js @@ -16,7 +16,7 @@ const assert = require('node:assert/strict') const fs = require('node:fs') const path = require('node:path') -const { latestByComponent, nextTargetByComponent } = require('./helpers/latest-versions') +const { latestByComponent, nextTargetByComponent } = require('./latest-versions') const PUBLIC = path.join(__dirname, '..', 'public') diff --git a/extension-tests/page-aliases.test.js b/extension-tests/page-aliases.test.js index e656325..9da671f 100644 --- a/extension-tests/page-aliases.test.js +++ b/extension-tests/page-aliases.test.js @@ -80,6 +80,12 @@ test('the relocated ocis security page keeps its old URL alive', (t) => { const broken = [] for (const { file } of aliased) { const version = file.split('/')[2] + // site.yml names rendered ocis versions explicitly (not a `content/ocis/*` + // glob) and its own comment says an unlisted version folder "could safely be + // deleted if outdated" -- content/ocis/8.0 is exactly that: on disk, never + // rendered. Skip versions this build didn't publish at all instead of + // flagging them as a broken alias. + if (!fs.existsSync(path.join(PUBLIC, 'ocis', version))) continue const stub = path.join(PUBLIC, 'ocis', version, 'security', 'security.html') if (!fs.existsSync(stub)) { broken.push(`ocis/${version}/security/security.html is missing`) diff --git a/extension-tests/static-files.test.js b/extension-tests/static-files.test.js index 5581417..4ef53f9 100644 --- a/extension-tests/static-files.test.js +++ b/extension-tests/static-files.test.js @@ -14,7 +14,7 @@ const assert = require('node:assert/strict') const fs = require('node:fs') const path = require('node:path') -const { latestByComponent } = require('./helpers/latest-versions') +const { latestByComponent } = require('./latest-versions') const ROOT = path.join(__dirname, '..') const PUBLIC = path.join(ROOT, 'public') @@ -213,3 +213,21 @@ test('root static files are not published under the UI output dir', (t) => { // ui.yml is consumed by the UI loader; it must never be published itself. assert.ok(!fs.existsSync(path.join(PUBLIC, 'assets', 'ui.yml')), 'ui.yml leaked into the build output') }) + +test('the medium-zoom vendor bundle synced from node_modules is published', (t) => { + if (!fs.existsSync(path.join(PUBLIC, 'index.html'))) { + t.skip('public/ not built (run `npm run antora` to enable)') + return + } + // ui/supplemental/js/vendor/ is gitignored and repopulated from node_modules by + // scripts/sync-vendor-assets.js (wired as preantora/preantora-local). Every + // page still references js/vendor/medium-zoom.min.js regardless, so a build + // that skips that step (e.g. `npx antora` directly) publishes green with a + // 404'ing +{{!-- Click-to-zoom for images. `defer` on both (not `async`) because the init + script needs the global the vendored library defines, and deferred external + scripts run in document order. --}} + + diff --git a/ui/supplemental/partials/head-styles.hbs b/ui/supplemental/partials/head-styles.hbs index 81a5081..36d97e8 100644 --- a/ui/supplemental/partials/head-styles.hbs +++ b/ui/supplemental/partials/head-styles.hbs @@ -2,3 +2,4 @@ +