Skip to content

Pages from a sitemap, and start the dev server automatically - #6

Merged
birazzzz merged 1 commit into
mainfrom
feat/sitemap-server
Oct 21, 2026
Merged

birazzzz merged 1 commit into
mainfrom
feat/sitemap-server

Conversation

@birazzzz

Copy link
Copy Markdown
Collaborator

Sitemap

"sitemap": { "url": "/sitemap.xml", "exclude": ["/blog/**"], "limit": 50 }
  • Reads a sitemap or a sitemap index ("sitemap": "/sitemap.xml" for short)
  • Sitemaps name the production site even on a dev server, so only each address's path is kept and loaded from baseUrl
  • include / exclude path patterns (* within one segment, ** across), then limit
  • pages is optional when there's a sitemap; listed pages come first, duplicates are dropped

Starting your site

"server": { "command": "npm run dev" }
  • Runs the command, waits until the address (baseUrl by default) answers, scans, then stops it
  • Reuses a site that's already answering (reuseExisting, default true)
  • Stops the whole process tree: taskkill /T on Windows, the process group on macOS and Linux, also on Ctrl+C or a crash
  • A command that exits early or a site that doesn't answer in timeout gives an error with the command's last 30 lines of output
  • Works in the CLI and the GitHub Action, so the README's CI example no longer needs npm start & and a curl wait loop

Checked

  • 38 tests (11 new): path patterns; sitemap index with production hosts, entities, CDATA, include/exclude/limit; config validation; real child processes for start + stop (port free afterwards), reuse, early exit with output, timeout; and update + check that start a server, read its sitemap and stop it
  • On Windows locally; the CI test jobs cover the Linux process-group path
  • The CI action self-test now starts its test page through server and checks the port is closed afterwards
  • Against fynepdf.com: all 158 sitemap pages read, /blog/** gives 72, a 10-page check at 2 widths took about 10 seconds. An .mjs config reused the running site instead of starting its command

- `sitemap`: a sitemap or sitemap index; keeps each address's path so a
  dev server's production-host sitemap still loads from baseUrl; include /
  exclude path patterns (* and **), limit; `pages` optional with a sitemap
- `server`: runs a command, waits until its address answers (any status
  below 500), reuses a server already running, stops the whole process
  tree afterwards (taskkill /T on Windows, process group elsewhere), also
  on Ctrl+C; early exit and timeout show the command's last output
- CLI and Action both run the scan inside withSite
- CI self-test now starts its test page through `server`
@birazzzz
birazzzz merged commit 5f8da14 into main Oct 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant