feat: add governance docs fetcher under pages/contribute/governance#127
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds an automated markdown fetch step to pull webpack/governance documents into this site under /contribute/governance, and wires the generated sidebar into the global site sidebar.
Changes:
- Added
scripts/markdown/governance.mjsto fetch specific governance markdown files, rewrite cross-links, and generate asite.jsonsidebar for the section. - Updated
pages/site.mjsto include the governance sidebar. - Updated
package.jsonto run the new governance fetcher as part ofbuild:md, and updated.gitignoreto ignore the generated governance pages directory.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| scripts/markdown/governance.mjs | New fetcher script for governance markdown, link rewriting, and sidebar generation. |
| pages/site.mjs | Includes the generated governance sidebar into the overall sidebar export. |
| package.json | Adds build:md:governance and includes it in build:md. |
| .gitignore | Ignores generated pages/contribute/governance output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const { GH_TOKEN } = process.env; | ||
|
|
||
| const BASE_HEADERS = { | ||
| ...(GH_TOKEN && { Authorization: `Bearer ${GH_TOKEN}` }), | ||
| }; |
| // Maps source filenames in webpack/governance repo to their output slug and sidebar label. | ||
| // Insertion order determines sidebar order, this could be changed as per need. | ||
| const FILE_MAP = { |
| import loaders from './loaders/site.json' with { type: 'json' }; | ||
| import plugins from './plugins/site.json' with { type: 'json' }; | ||
| import contribute from './contribute/governance/site.json' with { type: 'json' }; | ||
|
|
| // Derived from FILE_MAP - stays in sync automatically if entries are added/removed. | ||
| const LINK_REWRITE_MAP = Object.fromEntries( | ||
| Object.entries(FILE_MAP).map(([source, { output }]) => [ | ||
| source, | ||
| `/contribute/governance/${output}`, | ||
| ]) | ||
| ); |
2898cb3 to
f416af4
Compare
| /pages/loaders | ||
| /pages/plugins | ||
| /generated | ||
| /pages/contribute/governance |
There was a problem hiding this comment.
| /pages/contribute/governance | |
| /pages/about/governance |
What do we think about this subdirectory?
| groupName: 'Loaders & Plugins', | ||
| items: [...loaders.sidebar, ...plugins.sidebar], | ||
| }, | ||
| ...contribute.sidebar, |
There was a problem hiding this comment.
maybe put this under a groupName of About
|
@avivkeller PTAL! |
| // Derived from FILE_MAP - stays in sync automatically if entries are added/removed. | ||
| const LINK_REWRITE_MAP = Object.fromEntries( | ||
| Object.entries(FILE_MAP).map(([source, { output }]) => [ | ||
| source, | ||
| `/about/governance/${output}`, | ||
| ]) | ||
| ); |
| const siteJson = { | ||
| sidebar: [ | ||
| { | ||
| groupName: 'Governance', | ||
| items: fetched.map(({ output, label }) => ({ | ||
| link: `/about/governance/${output}`, | ||
| label, | ||
| })), | ||
| }, | ||
| ], | ||
| }; |
| import { sidebar as _sidebar } from './site.json' with { type: 'json' }; | ||
| import loaders from './loaders/site.json' with { type: 'json' }; | ||
| import plugins from './plugins/site.json' with { type: 'json' }; | ||
| import contribute from './about/governance/site.json' with { type: 'json' }; |
| 'pages', | ||
| 'about', | ||
| 'governance' | ||
| ); |
|
Hmm, Looks like About inside the sidebar is not behaving properly , Let me fix it ! |
8612582 to
d892459
Compare
|
fixed! |
Summary
Adds a script
scripts/markdown/governance.mjsthat fetches the webpack governance repository's markdown files.What kind of change does this PR introduce?
Automated governance docs fetching.
Did you add tests for your changes?
No
Does this PR introduce a breaking change?
No
If relevant, what needs to be documented once your changes are merged or what have you already documented?
None
Use of AI
For Regex logic and lookaheads