Skip to content

feat: implement metadata worker for npm and GitHub integration with c… - #93

Merged
homotechsual merged 1 commit into
mainfrom
develop
Nov 16, 2026
Merged

homotechsual merged 1 commit into
mainfrom
develop

Conversation

@homotechsual

Copy link
Copy Markdown
Collaborator

…aching

Copilot AI balanced review requested due to automatic review settings November 16, 2026 19:47
@homotechsual
homotechsual merged commit 10675ef into main Nov 16, 2026
6 of 7 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

⚡ Successfully deployed to Cloudflare Pages!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Version-qualified package names cause entire npm-version fields to fail, and the 15-second deadline can time out otherwise successful cold-cache GitHub lookups.

2 open issues
What changed in this PR

Adds live npm and GitHub metadata to the plugin directory through browser resolvers and a separate Cloudflare Worker.

Changes:

  • Adds cached endpoints for npm versions, GitHub releases, and recent commits.
  • Configures showcase computed fields and upgrades the showcase plugin to 1.3.0.
  • Adds tests, deployment automation, and setup documentation.
File Description
yarn.lock Locks the showcase plugin upgrade.
workers/​metadata/​wrangler.jsonc Configures the Worker and allowed origins.
workers/​metadata/​worker.mjs Implements metadata endpoints, validation, caching, and CORS.
workers/​metadata/​package.json Isolates Worker tooling from the website project.
workers/​metadata/​LICENSE Adds licensing information for adapted code.
tests/​showcase-metadata.test.mjs Tests Worker endpoints and browser resolvers.
src/​utils/​showcaseMetadata.ts Adds cached npm and GitHub metadata resolvers.
README.md Documents configuration, testing, and deployment.
package.json Upgrades the showcase plugin to 1.3.0.
docusaurus.config.ts Enables metadata fields when an endpoint is configured.
.github/​workflows/​publish.yml Tests and deploys the Worker and supplies its endpoint to website builds.

Review effort: Balanced

const url = new URL(path, `${endpoint.replace(/\/$/, '')}/`).href
const cached = requests.get(url)
if (cached && cached.expires > Date.now()) return cached.promise
const promise = fetch(url, { signal: AbortSignal.timeout(15_000) }).then(async (response) => {
export const npmVersions: ComputedFieldResolver = async (item, context) => {
if (!item.npmPackages?.length) return null
return (await Promise.all(item.npmPackages.map((name) =>
metadata(`npm?package=${encodeURIComponent(name)}`, context)))).flat()

This branch was successfully deployed

1 active deployment
preview — eb2df0d2 Deployed Nov 16, 2026 by github-actions[bot]
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.

2 participants