Skip to content

Build every v1 API path as a static file - #4

Draft
TimMonko wants to merge 1 commit into
cf/02-remove-nextjsfrom
cf/03-static-site
Draft

TimMonko wants to merge 1 commit into
cf/02-remove-nextjsfrom
cf/03-static-site

Conversation

@TimMonko

Copy link
Copy Markdown
Member

Replace scripts/prepare_gh_pages.py with scripts/build_site.py, which
writes the whole v1 API into site/ as plain files, so any static host
can serve it without running code:

  • public/ is copied to the root, as Next.js served it
    (/extended_summary.json, /conda/.json, /github/.json).
  • /api routes are written without an extension: plugins,
    extended_summary, conda-map, readers, manifest/, pypi/, conda/.
    /api/readers was missing from the GitHub Pages copy.
  • One precomputed /api/shields/ badge per plugin, so the README
    badges no longer need a function call.
  • A _headers file sets the JSON content type and CORS on Cloudflare.

The shields logo moves to scripts/napari_logo.svg for the Python build;
the Next.js route keeps its inline copy until it is removed.

/api/conda cannot be a file, because the api/conda/ folder holds the
per-plugin files; the Worker in the next commit answers it.

The GitHub Pages deploy keeps working: it now calls the new script with
--out gh-pages. The real data builds to 5,105 files (92 MB).


Stack created with GitHub Stacks CLI • Give Feedback 💬

@TimMonko
TimMonko added this pull request to stack #9 November 20, 2026 06:03
Replace scripts/prepare_gh_pages.py with scripts/build_site.py, which
writes the whole v1 API into site/ as plain files, so any static host
can serve it without running code:

- public/ is copied to the root, as Next.js served it
  (/extended_summary.json, /conda/<name>.json, /github/<name>.json).
- /api routes are written without an extension: plugins,
  extended_summary, conda-map, readers, manifest/, pypi/, conda/.
  /api/readers was missing from the GitHub Pages copy.
- One precomputed /api/shields/<name> badge per plugin, so the README
  badges no longer need a function call.
- A _headers file sets the JSON content type and CORS on Cloudflare.

The shields logo moves to scripts/napari_logo.svg for the Python build;
the Next.js route keeps its inline copy until it is removed.

/api/conda cannot be a file, because the api/conda/ folder holds the
per-plugin files; the Worker in the next commit answers it.

The GitHub Pages deploy keeps working: it now calls the new script with
--out gh-pages. The real data builds to 5,105 files (92 MB).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant