-
Notifications
You must be signed in to change notification settings - Fork 52
Doc kit docs #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
Draft
bmuenzenmeyer
wants to merge
5
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.
+508
−44
Draft
Doc kit docs #889
Changes from all commits
Commits
Show all changes
5 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 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,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: npm run docs:build | ||
|
|
||
| - name: Upload site artifact | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: docs-site | ||
| path: www/out | ||
|
Comment on lines
+44
to
+48
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what if we deploy the docs on GH page ? |
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| #!/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 | ||
| // | ||
| // `www/content/` is a build artifact and is gitignored. Run this before | ||
| // invoking the `web` generator against it. | ||
|
|
||
| import { mkdir, readFile, readdir, rm, writeFile } from 'node:fs/promises'; | ||
| import { dirname, join } from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
|
|
||
| const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..'); | ||
| const CONTENT = join(ROOT, 'www', 'content'); | ||
|
|
||
| /** | ||
| * Collects the `{ name, markdown }` pages to write into `www/content/`. | ||
| * | ||
| * @returns {Promise<Array<{ name: string, markdown: string }>>} | ||
| */ | ||
| const collectPages = async () => { | ||
| const pages = []; | ||
|
|
||
| const pagesDir = join(ROOT, 'www', 'pages'); | ||
| for (const file of await readdir(pagesDir)) { | ||
| if (file.endsWith('.md')) { | ||
| pages.push({ | ||
| name: file, | ||
| markdown: await readFile(join(pagesDir, file), 'utf-8'), | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| const docsDir = join(ROOT, 'docs'); | ||
| for (const file of await readdir(docsDir)) { | ||
| if (file.endsWith('.md')) { | ||
| pages.push({ | ||
| name: file, | ||
| markdown: await readFile(join(docsDir, file), 'utf-8'), | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| const generatorsDir = join(ROOT, 'src', 'generators'); | ||
| for (const generator of await readdir(generatorsDir, { | ||
| withFileTypes: true, | ||
| })) { | ||
| if (!generator.isDirectory()) { | ||
| continue; | ||
| } | ||
|
|
||
| const readme = join(generatorsDir, generator.name, 'README.md'); | ||
|
|
||
| try { | ||
| pages.push({ | ||
| name: `generator-${generator.name}.md`, | ||
| markdown: await readFile(readme, 'utf-8'), | ||
| }); | ||
| } catch (error) { | ||
| if (error.code !== 'ENOENT') { | ||
| throw error; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return pages; | ||
| }; | ||
|
|
||
| const pages = await collectPages(); | ||
|
|
||
| await rm(CONTENT, { recursive: true, force: true }); | ||
| await mkdir(CONTENT, { recursive: true }); | ||
|
|
||
| await Promise.all( | ||
| pages.map(({ name, markdown }) => writeFile(join(CONTENT, name), markdown)) | ||
| ); | ||
|
|
||
| console.log(`Wrote ${pages.length} pages to www/content/`); |
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 info |
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
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.
there are 0 reasons to use npm