-
Notifications
You must be signed in to change notification settings - Fork 56
feat(docs): add documentation for doc-kit
#889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bmuenzenmeyer
wants to merge
22
commits into
main
Choose a base branch
from
doc-kit-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
c5118db
setup CICD
bmuenzenmeyer 139fcb4
adds doc kit docs
bmuenzenmeyer cdb9458
reminds people that target can be supplied by config, not just flags
bmuenzenmeyer 1d783e3
promote every heading up a level to make doc-kit rendering easier per…
bmuenzenmeyer 09e884c
fix lint
bmuenzenmeyer ec0d712
improve home page content, making sure to format pages
bmuenzenmeyer 65c26db
slight tweaks to getting started
bmuenzenmeyer 9426ef2
use node directly rather than npm
bmuenzenmeyer 82e80ef
improve documentation based on feedback
bmuenzenmeyer 0f9fb0f
add showcase
bmuenzenmeyer a49ea50
Update www/pages/index.md
bmuenzenmeyer c7d5a19
Update scripts/vercel-docs-build.sh
bmuenzenmeyer 9e7655c
Update www/pages/getting-started.md
bmuenzenmeyer 1f554c1
Update www/pages/index.md
bmuenzenmeyer b714583
Update www/pages/getting-started.md
bmuenzenmeyer 642a641
Update www/pages/index.md
bmuenzenmeyer c0cb3d9
format after reviews
bmuenzenmeyer 3f035e7
better consistency
bmuenzenmeyer 5e854fb
Update www/pages/getting-started.md
bmuenzenmeyer fdc99ec
adds files entries
bmuenzenmeyer d3f2819
fix(url): resolve parent-path targets in relative()
bmuenzenmeyer 358158f
refactor doc-kit docs page creation
bmuenzenmeyer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| '@node-core/doc-kit': patch | ||
| --- | ||
|
|
||
| Fix `relative()` URL resolution when the target path is a prefix of the current | ||
| page's path (e.g. `/generators` from `/generators/web`): the target's final | ||
| segment was consumed as a common directory, producing `.` instead of | ||
| `../generators`. Unreachable in flat page layouts; surfaced by sites with | ||
| nested input directories. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| name: Documentation Site | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build docs site | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Harden Runner | ||
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | ||
| with: | ||
| egress-policy: audit | ||
|
|
||
| - name: Git Checkout | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Build site | ||
| run: node --run docs:build | ||
|
|
||
| - name: Upload site artifact | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: docs-site | ||
| path: www/out | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
bmuenzenmeyer marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| // Assembles `www/content/` — the input tree for the doc-kit documentation | ||
| // site — from three sources that live elsewhere in the repo: | ||
| // | ||
| // www/pages/*.md authored narrative pages, copied verbatim | ||
| // docs/*.md the existing reference docs | ||
| // src/generators/*/README.md per-generator config reference, written to | ||
| // `generators/<name>.md` | ||
| // | ||
| // `www/content/` is a build artifact and is gitignored. Run this before | ||
| // invoking the `web` generator against it. | ||
|
|
||
| import { glob, mkdir, readFile, rm, writeFile } from 'node:fs/promises'; | ||
| import { basename, dirname, join } from 'node:path'; | ||
|
|
||
| const ROOT = join(import.meta.dirname, '..'); | ||
| const CONTENT = join(ROOT, 'www', 'content'); | ||
|
|
||
| const SOURCES = [ | ||
| { pattern: 'www/pages/*.md', rename: basename }, | ||
| { pattern: 'docs/*.md', rename: basename }, | ||
| { | ||
| pattern: 'src/generators/*/README.md', | ||
| rename: file => `generators/${basename(dirname(file))}.md`, | ||
| }, | ||
| ]; | ||
|
|
||
| /** | ||
| * Collects the `{ name, markdown }` pages to write into `www/content/`. | ||
| * | ||
| * @returns {Promise<Array<{ name: string, markdown: string }>>} | ||
| */ | ||
| const collectPages = async () => { | ||
|
bmuenzenmeyer marked this conversation as resolved.
|
||
| const groups = await Promise.all( | ||
| SOURCES.map(async ({ pattern, rename }) => { | ||
| const files = await Array.fromAsync(glob(pattern, { cwd: ROOT })); | ||
|
|
||
| return Promise.all( | ||
| files.sort().map(async file => ({ | ||
| name: rename(file), | ||
| markdown: await readFile(join(ROOT, file), 'utf-8'), | ||
| })) | ||
| ); | ||
| }) | ||
| ); | ||
|
|
||
| return groups.flat(); | ||
| }; | ||
|
|
||
| const pages = await collectPages(); | ||
|
|
||
| await rm(CONTENT, { recursive: true, force: true }); | ||
|
|
||
| await Promise.all( | ||
| [...new Set(pages.map(({ name }) => dirname(join(CONTENT, name))))].map(dir => | ||
| mkdir(dir, { recursive: true }) | ||
| ) | ||
| ); | ||
|
|
||
| await Promise.all( | ||
| pages.map(({ name, markdown }) => writeFile(join(CONTENT, name), markdown)) | ||
| ); | ||
|
bmuenzenmeyer marked this conversation as resolved.
|
||
|
|
||
| console.log(`Wrote ${pages.length} pages to www/content/`); | ||
|
AugustinMauroy marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Build the doc-kit documentation site into `www/out/`. | ||
|
|
||
| node scripts/build-docs-content.mjs | ||
|
|
||
| node bin/cli.mjs generate \ | ||
| --config-file ./www/doc-kit.config.mjs \ | ||
| --log-level debug |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
bmuenzenmeyer marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if we deploy the docs on GH page ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont have strong opinions here other that continuing our current patterns.