@tenphi/cookbook 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/docs/architecture.md +91 -0
- package/docs/authoring.mdx +86 -0
- package/docs/cli.md +88 -0
- package/docs/configuration.md +518 -0
- package/docs/content-sources.md +150 -0
- package/docs/customization-rules.md +153 -0
- package/docs/deployment.md +78 -0
- package/docs/examples.md +95 -0
- package/docs/getting-started.md +124 -0
- package/docs/index.md +74 -0
- package/docs/migration.md +36 -0
- package/docs/starlight-comparison.md +124 -0
- package/docs/theme-and-components.md +668 -0
- package/docs/upstream/glaze/LICENSE +21 -0
- package/docs/upstream/glaze/README.md +156 -0
- package/docs/upstream/glaze/docs/api.md +2021 -0
- package/docs/upstream/glaze/docs/methodology.md +686 -0
- package/docs/upstream/glaze/docs/migration.md +351 -0
- package/docs/upstream/glaze/docs/okhst.md +207 -0
- package/docs/upstream/manifest.json +18 -0
- package/docs/upstream/tasty/LICENSE +21 -0
- package/docs/upstream/tasty/README.md +685 -0
- package/docs/upstream/tasty/docs/README.md +39 -0
- package/docs/upstream/tasty/docs/adoption.md +323 -0
- package/docs/upstream/tasty/docs/ai-agents.md +229 -0
- package/docs/upstream/tasty/docs/comparison.md +448 -0
- package/docs/upstream/tasty/docs/configuration.md +823 -0
- package/docs/upstream/tasty/docs/debug.md +335 -0
- package/docs/upstream/tasty/docs/design-system.md +455 -0
- package/docs/upstream/tasty/docs/dsl.md +1021 -0
- package/docs/upstream/tasty/docs/getting-started.md +238 -0
- package/docs/upstream/tasty/docs/injector.md +634 -0
- package/docs/upstream/tasty/docs/methodology.md +648 -0
- package/docs/upstream/tasty/docs/migration-v3.md +285 -0
- package/docs/upstream/tasty/docs/pipeline.md +749 -0
- package/docs/upstream/tasty/docs/plugins.md +353 -0
- package/docs/upstream/tasty/docs/react-api.md +681 -0
- package/docs/upstream/tasty/docs/runtime-benchmarks.md +351 -0
- package/docs/upstream/tasty/docs/ssr.md +610 -0
- package/docs/upstream/tasty/docs/styles.md +677 -0
- package/docs/upstream/tasty/docs/tasty-static.md +582 -0
- package/package.json +11 -6
package/README.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @tenphi/cookbook
|
|
2
2
|
|
|
3
|
+
Before changing a site's appearance, read the
|
|
4
|
+
[customization rules](./docs/customization-rules.md)
|
|
5
|
+
([online](https://cookbook.tenphi.me/customization-rules/)). The package ships
|
|
6
|
+
the complete [Cookbook documentation](./docs/index.md) and local Tasty and Glaze
|
|
7
|
+
references under `docs/upstream/`, including Tasty's
|
|
8
|
+
[style rules for AI agents](./docs/upstream/tasty/docs/ai-agents.md).
|
|
9
|
+
The guide includes a project instruction snippet and the lint setup.
|
|
10
|
+
|
|
3
11
|
Install the complete integration with `npx astro add @tenphi/cookbook`:
|
|
4
12
|
|
|
5
13
|
```ts
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Architecture
|
|
3
|
+
description: Understand the four packages and the static content pipeline behind Cookbook.
|
|
4
|
+
sidebar:
|
|
5
|
+
order: 8
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Cookbook keeps content concerns separate from rendering so another renderer
|
|
9
|
+
can consume the same validated graph in the future.
|
|
10
|
+
|
|
11
|
+
## Packages
|
|
12
|
+
|
|
13
|
+
| Package | Responsibility |
|
|
14
|
+
| ------------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| `@tenphi/create-cookbook` | Inspect an npm artifact and scaffold a reproducible documentation project |
|
|
16
|
+
| `@tenphi/cookbook` | Provide the memorable Astro integration, public config exports, and CLI |
|
|
17
|
+
| `@tenphi/docs` | Discover sources, resolve packages, build the content graph, transform Markdown, and report diagnostics |
|
|
18
|
+
| `@tenphi/starlight` | Adapt the graph to Astro/Starlight and provide the Tasty/Glaze theme, components, search, and static assets |
|
|
19
|
+
|
|
20
|
+
The `@tenphi/cookbook` default export represents the complete product. Consumers do
|
|
21
|
+
not compose Starlight or renderer internals themselves.
|
|
22
|
+
|
|
23
|
+
## Build pipeline
|
|
24
|
+
|
|
25
|
+
1. Validate and normalize the configuration.
|
|
26
|
+
2. Collect local and locked package sources.
|
|
27
|
+
3. Assign canonical routes to every document.
|
|
28
|
+
4. Parse Markdown and collect headings, links, and assets.
|
|
29
|
+
5. Rewrite internal references through the completed route graph.
|
|
30
|
+
6. Reject unsafe paths and report strict diagnostics.
|
|
31
|
+
7. Render static pages through Astro and Starlight.
|
|
32
|
+
8. Copy content-hashed assets and build the local Pagefind index.
|
|
33
|
+
|
|
34
|
+
Source documents are read-only throughout this process. The transformed body
|
|
35
|
+
exists in the in-memory graph and the renderer's virtual module; a build never
|
|
36
|
+
rewrites the repository Markdown.
|
|
37
|
+
|
|
38
|
+
## Theme pipeline
|
|
39
|
+
|
|
40
|
+
Theme resolution has three deliberately separate layers:
|
|
41
|
+
|
|
42
|
+
1. Glaze resolves semantic palette inputs into light, dark, and high-contrast
|
|
43
|
+
colors.
|
|
44
|
+
2. The Glaze values, design tokens, typography presets, states, and units are
|
|
45
|
+
registered directly with Tasty.
|
|
46
|
+
3. Cookbook components use `tasty()` and the Tasty selector bridge styles DOM
|
|
47
|
+
owned by Astro, Starlight, Expressive Code, Pagefind, and rendered Markdown.
|
|
48
|
+
|
|
49
|
+
The palette owns color relationships. Components never choose raw light/dark
|
|
50
|
+
colors, and shape tokens never contain palette logic. This keeps a palette
|
|
51
|
+
change, a density change, and a typography change independent. Astro runs
|
|
52
|
+
Tasty in extract mode, so these runtime style calls become a shared static CSS
|
|
53
|
+
asset during the build; no Tasty styling runtime ships to the browser.
|
|
54
|
+
|
|
55
|
+
## Public graph API
|
|
56
|
+
|
|
57
|
+
Renderer and tooling authors can work directly with `@tenphi/docs`:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import {
|
|
61
|
+
assertValidDocs,
|
|
62
|
+
createDocsGraph,
|
|
63
|
+
defineDocsConfig,
|
|
64
|
+
} from "@tenphi/docs";
|
|
65
|
+
|
|
66
|
+
const config = defineDocsConfig({
|
|
67
|
+
content: {
|
|
68
|
+
sources: [{ glob: "docs/**/*.md", base: "docs" }],
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const graph = await createDocsGraph({ root: process.cwd(), config });
|
|
73
|
+
assertValidDocs(graph);
|
|
74
|
+
|
|
75
|
+
for (const route of graph.routes) {
|
|
76
|
+
console.log(route.route, route.sourcePath);
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The graph exposes normalized entries, routes, assets, and structured
|
|
81
|
+
diagnostics without importing Starlight.
|
|
82
|
+
|
|
83
|
+
## Reference app
|
|
84
|
+
|
|
85
|
+
The monorepo's `apps/reference` project is both the deployed documentation site
|
|
86
|
+
and an end-to-end fixture. Its integration discovers `docs.config.ts`, whose
|
|
87
|
+
`root: "../.."` loads this `docs/` tree through the same route pipeline used by
|
|
88
|
+
convention-mode sites. CI builds the same app before GitHub Pages publishes it.
|
|
89
|
+
|
|
90
|
+
Return to [Cookbook](./index.md) or inspect the
|
|
91
|
+
[repository](https://github.com/tenphi/cookbook).
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Authoring components
|
|
3
|
+
description: Use accessible tabs, callouts, code groups, cards, steps, and isolated previews.
|
|
4
|
+
sidebar:
|
|
5
|
+
order: 4
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
import { Callout, CodeGroup, Tab, Tabs } from "@tenphi/cookbook/components";
|
|
9
|
+
|
|
10
|
+
Write ordinary Markdown for most pages. Use MDX when a page needs components,
|
|
11
|
+
and import them from `@tenphi/cookbook/components`. Local MDX is supported by
|
|
12
|
+
default; npm MDX requires an explicit `trust: "mdx"` source declaration.
|
|
13
|
+
|
|
14
|
+
## Tabs
|
|
15
|
+
|
|
16
|
+
Every panel requires a `label`. Arrow keys, Home, and End move between tabs;
|
|
17
|
+
right-to-left layouts reverse the horizontal arrow direction. Without
|
|
18
|
+
JavaScript, all panels remain readable under their headings.
|
|
19
|
+
|
|
20
|
+
```mdx
|
|
21
|
+
import { Tab, Tabs } from "@tenphi/cookbook/components";
|
|
22
|
+
|
|
23
|
+
<Tabs label="Installation">
|
|
24
|
+
<Tab label="npm">Run `npm install your-package`.</Tab>
|
|
25
|
+
<Tab label="pnpm">Run `pnpm add your-package`.</Tab>
|
|
26
|
+
</Tabs>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
<Tabs label="Installation">
|
|
30
|
+
<Tab label="npm">Run `npm install your-package`.</Tab>
|
|
31
|
+
<Tab label="pnpm">Run `pnpm add your-package`.</Tab>
|
|
32
|
+
</Tabs>
|
|
33
|
+
|
|
34
|
+
## Callouts
|
|
35
|
+
|
|
36
|
+
Use `kind="note"`, `"tip"`, `"caution"`, or `"danger"`; `title` overrides the
|
|
37
|
+
visible label. The default kind is `note`. Status colors come from
|
|
38
|
+
`theme.palette.info`, `success`, `warning`, and `danger` and adapt to all schemes
|
|
39
|
+
and contrast modes.
|
|
40
|
+
|
|
41
|
+
```mdx
|
|
42
|
+
<Callout kind="tip" title="Keep content close to code">
|
|
43
|
+
Relative Markdown links continue to work after Cookbook assigns public routes.
|
|
44
|
+
</Callout>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
<Callout kind="tip" title="Keep content close to code">
|
|
48
|
+
Relative Markdown links continue to work after Cookbook assigns public routes.
|
|
49
|
+
</Callout>
|
|
50
|
+
|
|
51
|
+
## Code groups
|
|
52
|
+
|
|
53
|
+
Pass labeled source strings to create an accessible tabbed code group. `language`
|
|
54
|
+
is an optional visible label; these programmatic snippets render as escaped plain
|
|
55
|
+
text. Ordinary fenced Markdown provides syntax highlighting.
|
|
56
|
+
|
|
57
|
+
```mdx
|
|
58
|
+
<CodeGroup
|
|
59
|
+
label="Install Cookbook"
|
|
60
|
+
items={[
|
|
61
|
+
{ label: "npm", language: "shell", code: "npm install @tenphi/cookbook" },
|
|
62
|
+
{ label: "pnpm", language: "shell", code: "pnpm add @tenphi/cookbook" },
|
|
63
|
+
]}
|
|
64
|
+
/>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
<CodeGroup
|
|
68
|
+
label="Install Cookbook"
|
|
69
|
+
items={[
|
|
70
|
+
{ label: "npm", language: "shell", code: "npm install @tenphi/cookbook" },
|
|
71
|
+
{ label: "pnpm", language: "shell", code: "pnpm add @tenphi/cookbook" },
|
|
72
|
+
]}
|
|
73
|
+
/>
|
|
74
|
+
|
|
75
|
+
## Other components
|
|
76
|
+
|
|
77
|
+
| Component | Props and behavior |
|
|
78
|
+
| --------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
79
|
+
| `Card` | Optional `title` and `href`; renders an article or link with slot content |
|
|
80
|
+
| `Steps` | Ordered list container; supply `li` elements |
|
|
81
|
+
| `Logo` | Optional `label`, `decorative`, and `class`; renders the Cookbook mark |
|
|
82
|
+
| `Preview` | Required `title`; optional `html`, `css`, and `javascript`; isolates examples in Shadow DOM or a sandboxed iframe |
|
|
83
|
+
|
|
84
|
+
The public package exports each component's props type, such as `TabProps`,
|
|
85
|
+
`CalloutProps`, and `CodeGroupProps`. Styles and all named sub-elements are
|
|
86
|
+
listed in [Theme and components](./theme-and-components.md#style-customization).
|
package/docs/cli.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: CLI commands
|
|
3
|
+
description: Validate documentation and reconcile package locks using the same configuration as Astro.
|
|
4
|
+
sidebar:
|
|
5
|
+
order: 6
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
The integration and CLI discover `docs.config.ts`, `.mts`, `.js`, or `.mjs` in the
|
|
9
|
+
project directory. Its `root` sets the content and lock directory. Use `--root`
|
|
10
|
+
to select another project, or `--config` for an explicit config path relative to
|
|
11
|
+
that project.
|
|
12
|
+
|
|
13
|
+
## Validate with doctor
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npx @tenphi/cookbook doctor
|
|
17
|
+
npx @tenphi/cookbook doctor --root ./apps/docs
|
|
18
|
+
npx @tenphi/cookbook doctor --config ./config/manual.ts --json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Doctor checks the content graph, configuration, semantic theme, links, assets,
|
|
22
|
+
navigation, and redirects without starting Astro. It exits non-zero for errors.
|
|
23
|
+
It does not compile MDX or replace a full Astro build.
|
|
24
|
+
|
|
25
|
+
JSON results use a stable envelope, including configuration failures:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"ok": true,
|
|
30
|
+
"pages": 8,
|
|
31
|
+
"assets": 3,
|
|
32
|
+
"diagnostics": []
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Update package content
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npx @tenphi/cookbook update
|
|
40
|
+
npx @tenphi/cookbook update @scope/package --dry-run
|
|
41
|
+
npx @tenphi/cookbook update --json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`update` reads package sources from configuration, creates the first lock,
|
|
45
|
+
resolves changed tags or ranges, and removes entries that are no longer declared.
|
|
46
|
+
A package name or exact requested specifier selects individual updates. An
|
|
47
|
+
unselected source must already have a matching lock; otherwise run a full update.
|
|
48
|
+
|
|
49
|
+
`--dry-run` resolves versions and shows the proposed changes without writing
|
|
50
|
+
files. JSON output adds `dryRun`, `changes`, `removed`, and `lock` to the envelope.
|
|
51
|
+
Review and commit the resulting lock diff before deploying. Builds require an
|
|
52
|
+
exact requested-specifier match and never silently substitute a lock for another
|
|
53
|
+
range or tag.
|
|
54
|
+
|
|
55
|
+
Vendored sources remain vendored. New artifacts are stored in separate integrity
|
|
56
|
+
folders before the lock is replaced, so a failed download leaves the old lock
|
|
57
|
+
and its content available. Old vendor folders can be removed after reviewing
|
|
58
|
+
which paths the new lock references.
|
|
59
|
+
|
|
60
|
+
## Creator flags
|
|
61
|
+
|
|
62
|
+
Start with local content, an existing repository, or an npm artifact:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
npm create @tenphi/cookbook@latest docs-site -- --yes
|
|
66
|
+
npm create @tenphi/cookbook@latest docs-site -- --source . --yes
|
|
67
|
+
npm create @tenphi/cookbook@latest docs-site -- --package @scope/package --yes
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
| Flag | Purpose |
|
|
71
|
+
| ----------------------------------- | ------------------------------------------------- |
|
|
72
|
+
| `--source <directory>` | Document an existing local repository |
|
|
73
|
+
| `--package <specifier>` | Document a locked npm artifact |
|
|
74
|
+
| `--yes`, `-y` | Use non-interactive defaults |
|
|
75
|
+
| `--brand <color>` | Set the Glaze brand seed |
|
|
76
|
+
| `--site <url>` | Set the canonical site URL |
|
|
77
|
+
| `--base <path>` | Set Astro's hosting subpath |
|
|
78
|
+
| `--deploy github-pages\|none` | Add a deployment workflow |
|
|
79
|
+
| `--package-manager npm\|pnpm\|yarn` | Select the project manager |
|
|
80
|
+
| `--no-install` | Generate files without installing dependencies |
|
|
81
|
+
| `--vendor` | Vendor the npm artifact for offline builds |
|
|
82
|
+
| `--trust-package` | Permit MDX execution from the locked npm artifact |
|
|
83
|
+
| `--open` | Start and open the development server |
|
|
84
|
+
|
|
85
|
+
`--source` and `--package` are mutually exclusive. With neither, the creator
|
|
86
|
+
writes a local starter. `--vendor` and `--trust-package` require `--package`.
|
|
87
|
+
`--open` requires installation. A non-empty destination requires interactive
|
|
88
|
+
confirmation before generated files can be overwritten.
|