@icebreakers/monorepo-templates 2.0.7 → 2.1.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.
Files changed (81) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/assets/.agents/skills/repoctl/SKILL.md +2 -2
  4. package/assets/.agents/skills/repoctl/references/templates.md +3 -2
  5. package/assets/.github/workflows/ci.yml +0 -4
  6. package/assets/package.json +3 -7
  7. package/assets/pnpm-workspace.yaml +2 -0
  8. package/assets/turbo.json +11 -4
  9. package/dist/cli.mjs +1 -1
  10. package/dist/index.mjs +2 -2
  11. package/dist/{prepare-BapI8ioj.mjs → prepare-2VvFwYDz.mjs} +23 -3
  12. package/package.json +1 -1
  13. package/template-data.mjs +8 -0
  14. package/templates/client/package.json +1 -1
  15. package/templates/nimbus/AGENTS.md +12 -0
  16. package/templates/nimbus/LICENSE +21 -0
  17. package/templates/nimbus/README.md +17 -0
  18. package/templates/nimbus/UPSTREAM.md +16 -0
  19. package/templates/nimbus/astro.config.ts +28 -0
  20. package/templates/nimbus/eslint.config.js +25 -0
  21. package/templates/nimbus/gitignore +5 -0
  22. package/templates/nimbus/nimbus.json +4 -0
  23. package/templates/nimbus/package.json +34 -0
  24. package/templates/nimbus/public/favicon.svg +1 -0
  25. package/templates/nimbus/scripts/check-locales.mjs +11 -0
  26. package/templates/nimbus/src/components/aside.astro +9 -0
  27. package/templates/nimbus/src/components/head.astro +43 -0
  28. package/templates/nimbus/src/components/search/client.ts +62 -0
  29. package/templates/nimbus/src/components/search/index.astro +26 -0
  30. package/templates/nimbus/src/components/sidebar.astro +26 -0
  31. package/templates/nimbus/src/components.ts +3 -0
  32. package/templates/nimbus/src/content/docs/get-started.mdx +36 -0
  33. package/templates/nimbus/src/content/docs/index.mdx +16 -0
  34. package/templates/nimbus/src/content/docs/writing.mdx +35 -0
  35. package/templates/nimbus/src/content/docs/zh/get-started.mdx +36 -0
  36. package/templates/nimbus/src/content/docs/zh/index.mdx +16 -0
  37. package/templates/nimbus/src/content/docs/zh/writing.mdx +35 -0
  38. package/templates/nimbus/src/content.config.ts +6 -0
  39. package/templates/nimbus/src/env.d.ts +6 -0
  40. package/templates/nimbus/src/layouts/docs.astro +70 -0
  41. package/templates/nimbus/src/lib/locale.ts +50 -0
  42. package/templates/nimbus/src/pages/[...slug]/index.md.ts +4 -0
  43. package/templates/nimbus/src/pages/[...slug]/index.mdx.ts +4 -0
  44. package/templates/nimbus/src/pages/[...slug].astro +36 -0
  45. package/templates/nimbus/src/pages/[section]/llms.txt.ts +4 -0
  46. package/templates/nimbus/src/pages/llms-full.txt.ts +4 -0
  47. package/templates/nimbus/src/pages/llms.txt.ts +4 -0
  48. package/templates/nimbus/src/pages/robots.txt.ts +18 -0
  49. package/templates/nimbus/src/styles/base.css +121 -0
  50. package/templates/nimbus/src/styles/site.css +186 -0
  51. package/templates/nimbus/stylelint.config.js +3 -0
  52. package/templates/nimbus/tsconfig.json +10 -0
  53. package/templates/server/package.json +1 -1
  54. package/templates/vitepress/.vitepress/config.ts +4 -5
  55. package/templates/vitepress/.vitepress/home/content.ts +2 -2
  56. package/templates/vitepress/.vitepress/home/faq.ts +16 -0
  57. package/templates/vitepress/.vitepress/mermaid/markdown.ts +18 -0
  58. package/templates/vitepress/.vitepress/mermaid/mermaid.vue +66 -0
  59. package/templates/vitepress/.vitepress/mermaid/render.ts +37 -0
  60. package/templates/vitepress/.vitepress/seo.ts +12 -1
  61. package/templates/vitepress/.vitepress/theme/components/HomePage.vue +2 -16
  62. package/templates/vitepress/.vitepress/theme/index.ts +3 -1
  63. package/templates/vitepress/ai/create.md +1 -1
  64. package/templates/vitepress/package.json +4 -8
  65. package/templates/vitepress/reference/commands.md +3 -3
  66. package/templates/vitepress/reference/template-assets.md +1 -1
  67. package/templates/vitepress/reference/templates.md +13 -9
  68. package/templates/vitepress/tasks/index.md +1 -1
  69. package/templates/vitepress/test/mermaid.test.ts +39 -0
  70. package/templates/vitepress/test/render.test.ts +48 -0
  71. package/templates/vitepress/test/seo.test.ts +19 -0
  72. package/templates/vitepress/tsconfig.json +8 -8
  73. package/templates/vitepress/vitest.config.ts +8 -0
  74. package/templates/vitepress/zh/ai/create.md +1 -1
  75. package/templates/vitepress/zh/learn/monorepo/manage.md +1 -1
  76. package/templates/vitepress/zh/reference/commands.md +3 -3
  77. package/templates/vitepress/zh/reference/execution-model.md +1 -1
  78. package/templates/vitepress/zh/reference/template-assets.md +3 -2
  79. package/templates/vitepress/zh/reference/templates.md +13 -9
  80. package/templates/vitepress/zh/tasks/index.md +1 -1
  81. package/templates/vitepress/zh/tasks/reports.md +1 -1
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: Quick start
3
+ description: Run, edit and publish your documentation.
4
+ sidebar:
5
+ order: 1
6
+ ---
7
+
8
+ ## Install dependencies
9
+
10
+ At the monorepo root:
11
+
12
+ ```sh
13
+ corepack enable
14
+ pnpm install
15
+ ```
16
+
17
+ ## Start the site
18
+
19
+ In the documentation workspace:
20
+
21
+ ```sh
22
+ pnpm dev
23
+ ```
24
+
25
+ Edit `src/content/docs/index.mdx` and its Chinese counterpart `src/content/docs/zh/index.mdx`.
26
+
27
+ ## Build and preview
28
+
29
+ ```sh
30
+ pnpm build
31
+ pnpm preview
32
+ ```
33
+
34
+ The build writes `dist/` and creates the search index. Set your production URL in `astro.config.ts` before publishing.
35
+
36
+ Continue with the [writing guide](/writing/).
@@ -0,0 +1,16 @@
1
+ ---
2
+ title: Welcome
3
+ description: A home for your project’s guides and examples.
4
+ sidebar:
5
+ order: 0
6
+ ---
7
+
8
+ ## Start with the essentials
9
+
10
+ Follow the [quick start](/get-started/) to run this site locally, then use the [writing guide](/writing/) to add your own documentation.
11
+
12
+ ## One source, two ways to read
13
+
14
+ Read in your browser or open the Markdown link below each page. The documentation index at `/llms.txt` helps tools find individual pages without downloading the entire site.
15
+
16
+ [阅读中文文档](/zh/)
@@ -0,0 +1,35 @@
1
+ ---
2
+ title: Writing guide
3
+ description: Add pages that work for readers and tools.
4
+ sidebar:
5
+ order: 2
6
+ ---
7
+
8
+ ## Add a page
9
+
10
+ Create matching files under `src/content/docs/` and `src/content/docs/zh/`. Give each page a title, description and sidebar order in frontmatter.
11
+
12
+ ```yaml
13
+ title: Your page
14
+ description: What the reader will learn.
15
+ sidebar:
16
+ order: 3
17
+ ```
18
+
19
+ ## Use components carefully
20
+
21
+ <Aside>
22
+ Keep the meaning of an example in its text. Interactive illustrations should have a written explanation too.
23
+ </Aside>
24
+
25
+ Register components in `src/components.ts` and their text representation in `astro.config.ts`.
26
+
27
+ ## Validate before publishing
28
+
29
+ ```sh
30
+ pnpm build
31
+ pnpm lint
32
+ pnpm typecheck
33
+ ```
34
+
35
+ Use `draft: true` while a page is unfinished. Open the published Markdown link and check that examples, links and component text are readable.
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: 快速开始
3
+ description: 运行、编辑和发布你的文档。
4
+ sidebar:
5
+ order: 1
6
+ ---
7
+
8
+ ## 安装依赖
9
+
10
+ 在 monorepo 根目录执行:
11
+
12
+ ```sh
13
+ corepack enable
14
+ pnpm install
15
+ ```
16
+
17
+ ## 启动站点
18
+
19
+ 进入文档工作区执行:
20
+
21
+ ```sh
22
+ pnpm dev
23
+ ```
24
+
25
+ 编辑 `src/content/docs/zh/index.mdx`,并同步英文版本 `src/content/docs/index.mdx`。
26
+
27
+ ## 构建与预览
28
+
29
+ ```sh
30
+ pnpm build
31
+ pnpm preview
32
+ ```
33
+
34
+ 构建会生成 `dist/` 和搜索索引。发布前,在 `astro.config.ts` 中填写正式站点地址。
35
+
36
+ 继续阅读[写作指南](/zh/writing/)。
@@ -0,0 +1,16 @@
1
+ ---
2
+ title: 欢迎
3
+ description: 在这里记录项目的使用指南与示例。
4
+ sidebar:
5
+ order: 0
6
+ ---
7
+
8
+ ## 从基础开始
9
+
10
+ 按照[快速开始](/zh/get-started/)在本地运行站点,再参考[写作指南](/zh/writing/)添加自己的文档。
11
+
12
+ ## 一份内容,两种阅读方式
13
+
14
+ 读者可以浏览网页,也可以打开每页底部的 Markdown 链接。文档索引 `/zh/llms.txt`帮助工具定位单个页面,无需下载整个站点。
15
+
16
+ [Read the English documentation](/)
@@ -0,0 +1,35 @@
1
+ ---
2
+ title: 写作指南
3
+ description: 添加适合读者和工具使用的页面。
4
+ sidebar:
5
+ order: 2
6
+ ---
7
+
8
+ ## 添加页面
9
+
10
+ 在 `src/content/docs/` 和 `src/content/docs/zh/` 下创建路径对应的文件,在 frontmatter 中填写标题、描述和导航顺序。
11
+
12
+ ```yaml
13
+ title: 页面标题
14
+ description: 读者将在本页学到什么。
15
+ sidebar:
16
+ order: 3
17
+ ```
18
+
19
+ ## 使用组件
20
+
21
+ <Aside>
22
+ 用文字保留示例的含义。交互图示也需要配套文字说明。
23
+ </Aside>
24
+
25
+ 在 `src/components.ts` 中注册组件,并在 `astro.config.ts` 中定义对应的文本输出。
26
+
27
+ ## 发布前检查
28
+
29
+ ```sh
30
+ pnpm build
31
+ pnpm lint
32
+ pnpm typecheck
33
+ ```
34
+
35
+ 未完成的页面设置 `draft: true`。打开构建后的 Markdown 链接,确认示例、链接和组件文字均可阅读。
@@ -0,0 +1,6 @@
1
+ import { docsCollection } from '@cloudflare/nimbus-docs/content'
2
+ import { defineCollection } from 'astro:content'
3
+
4
+ export const collections = {
5
+ docs: defineCollection(docsCollection()),
6
+ }
@@ -0,0 +1,6 @@
1
+ // Astro checks component props through its generated TSX representation.
2
+ // Plain tsc needs the runtime module shape for imports in src/components.ts.
3
+ declare module '*.astro' {
4
+ const component: import('astro/runtime/server/index.js').AstroComponentFactory
5
+ export default component
6
+ }
@@ -0,0 +1,70 @@
1
+ ---
2
+ import type { DocsPageProps } from '@cloudflare/nimbus-docs/types'
3
+ import { withBase } from '@cloudflare/nimbus-docs/runtime'
4
+ import { config } from 'virtual:nimbus/config'
5
+ import Head from '../components/head.astro'
6
+ import Search from '../components/search/index.astro'
7
+ import Sidebar from '../components/sidebar.astro'
8
+ import { labels } from '../lib/locale'
9
+ import '../styles/site.css'
10
+
11
+ type Props = Omit<DocsPageProps, 'breadcrumbs' | 'prevNext'> & { chinese: boolean, alternate: string }
12
+ const { title, description, sidebar, headings, markdownUrl, chinese, alternate, noindex, draft, searchable } = Astro.props
13
+ const text = labels[chinese ? 'zh' : 'en']
14
+ const base = import.meta.env.BASE_URL
15
+ const indexUrl = withBase(chinese ? '/zh/llms.txt' : '/llms.txt', base)
16
+ ---
17
+
18
+ <!doctype html>
19
+ <html lang={chinese ? 'zh-CN' : 'en'}>
20
+ <head>
21
+ <meta charset="utf-8" />
22
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
23
+ <Head title={title} description={description} markdownUrl={markdownUrl} noindex={noindex || draft} chinese={chinese} />
24
+ <link rel="alternate" hreflang={chinese ? 'en' : 'zh-CN'} href={new URL(withBase(alternate, base), Astro.site)} />
25
+ <link rel="alternate" type="text/plain" href={indexUrl} title={text.index} />
26
+ </head>
27
+ <body>
28
+ <a class="skip-link" href="#main-content">{text.skip}</a>
29
+ <header class="site-header">
30
+ <a class="brand" href={withBase(chinese ? '/zh/' : '/', base)}>{config.title}</a>
31
+ <a class="language-link" href={withBase(alternate, base)} lang={chinese ? 'en' : 'zh-CN'}>{chinese ? 'English' : '简体中文'}</a>
32
+ </header>
33
+ <div class="docs-grid">
34
+ <aside class="site-rail">
35
+ <Search chinese={chinese} />
36
+ <nav aria-label={text.navigation}>
37
+ <p class="rail-title">{text.navigation}</p>
38
+ {sidebar !== false && <Sidebar items={sidebar} />}
39
+ </nav>
40
+ <a class="index-link" href={indexUrl}>llms.txt ↗</a>
41
+ </aside>
42
+ <main id="main-content" tabindex="-1">
43
+ <div data-pagefind-body={searchable !== false && !noindex && !draft ? '' : undefined} data-pagefind-ignore={searchable === false || noindex || draft ? '' : undefined}>
44
+ <h1>{title}</h1>
45
+ {description && <p class="description">{description}</p>}
46
+ <article><slot /></article>
47
+ </div>
48
+ {markdownUrl && (
49
+ <footer>
50
+ <a href={withBase(markdownUrl, base)}>
51
+ {text.markdown}
52
+ {' '}
53
+ ↗
54
+ </a>
55
+ </footer>
56
+ )}
57
+ </main>
58
+ <aside class="page-rail">
59
+ {headings !== false && headings.length > 0 && (
60
+ <nav aria-label={text.contents}>
61
+ <p class="rail-title">{text.contents}</p>
62
+ <ul class="navigation-list">
63
+ {headings.map(heading => <li><a href={`#${heading.slug}`}>{heading.text}</a></li>)}
64
+ </ul>
65
+ </nav>
66
+ )}
67
+ </aside>
68
+ </div>
69
+ </body>
70
+ </html>
@@ -0,0 +1,50 @@
1
+ import type { SidebarItem } from '@cloudflare/nimbus-docs/types'
2
+
3
+ export function isChinese(path: string) {
4
+ return path === '/zh' || path.startsWith('/zh/')
5
+ }
6
+
7
+ export function alternatePath(path: string) {
8
+ return isChinese(path) ? path.slice(3) || '/' : `/zh${path}`
9
+ }
10
+
11
+ export function localizeSidebar(items: SidebarItem[], chinese: boolean): SidebarItem[] {
12
+ return items.flatMap((item): SidebarItem[] => {
13
+ if (item.type !== 'group') {
14
+ return item.type === 'external' || isChinese(item.href) === chinese ? [item] : []
15
+ }
16
+ const children = localizeSidebar(item.children, chinese)
17
+ const indexHref = item.indexHref && isChinese(item.indexHref) === chinese ? item.indexHref : undefined
18
+ if (!children.length && !indexHref) {
19
+ return []
20
+ }
21
+ return [{ ...item, indexHref, children }]
22
+ })
23
+ }
24
+
25
+ export const labels = {
26
+ en: {
27
+ navigation: 'On this site',
28
+ contents: 'On this page',
29
+ skip: 'Skip to content',
30
+ search: 'Search documentation',
31
+ submit: 'Search',
32
+ empty: 'No matching pages.',
33
+ loading: 'Searching…',
34
+ unavailable: 'Search is unavailable. Try again after building the site.',
35
+ markdown: 'Read Markdown',
36
+ index: 'Documentation index',
37
+ },
38
+ zh: {
39
+ navigation: '站点导航',
40
+ contents: '本页目录',
41
+ skip: '跳转到正文',
42
+ search: '搜索文档',
43
+ submit: '搜索',
44
+ empty: '没有找到匹配的页面。',
45
+ loading: '正在搜索…',
46
+ unavailable: '搜索暂不可用,请构建站点后重试。',
47
+ markdown: '阅读 Markdown',
48
+ index: '文档索引',
49
+ },
50
+ } as const
@@ -0,0 +1,4 @@
1
+ import { markdownRoute } from '@cloudflare/nimbus-docs/agent-endpoints'
2
+
3
+ export const prerender = true
4
+ export const { GET, getStaticPaths } = markdownRoute()
@@ -0,0 +1,4 @@
1
+ import { markdownSourceRoute } from '@cloudflare/nimbus-docs/agent-endpoints'
2
+
3
+ export const prerender = true
4
+ export const { GET, getStaticPaths } = markdownSourceRoute()
@@ -0,0 +1,36 @@
1
+ ---
2
+ import { getDocsPage, getDocsStaticPaths, getSidebar, getTOC, stripBase } from '@cloudflare/nimbus-docs/runtime'
3
+ import { components } from '../components'
4
+ import DocsLayout from '../layouts/docs.astro'
5
+ import { alternatePath, isChinese, localizeSidebar } from '../lib/locale'
6
+
7
+ export const prerender = true
8
+ export const getStaticPaths = getDocsStaticPaths
9
+
10
+ const page = await getDocsPage(Astro)
11
+ if (page instanceof Response) {
12
+ return page
13
+ }
14
+ const { entry, Content, headings, markdownUrl } = page
15
+ const pathname = stripBase(Astro.url.pathname, import.meta.env.BASE_URL)
16
+ const chinese = isChinese(pathname)
17
+ const sidebar = localizeSidebar(await getSidebar(pathname), chinese)
18
+ const toc = entry.data.tableOfContents === false ? false : getTOC(headings, entry.data.tableOfContents)
19
+ ---
20
+
21
+ <DocsLayout
22
+ title={entry.data.title}
23
+ description={entry.data.description}
24
+ sidebar={entry.data.sidebar === false ? false : sidebar}
25
+ headings={toc}
26
+ markdownUrl={markdownUrl}
27
+ collection={entry.collection}
28
+ entryId={entry.id}
29
+ noindex={entry.data.noindex}
30
+ draft={entry.data.draft}
31
+ searchable={entry.data.searchable}
32
+ chinese={chinese}
33
+ alternate={alternatePath(pathname)}
34
+ >
35
+ <Content components={components} />
36
+ </DocsLayout>
@@ -0,0 +1,4 @@
1
+ import { llmsSectionRoute } from '@cloudflare/nimbus-docs/agent-endpoints'
2
+
3
+ export const prerender = true
4
+ export const { GET, getStaticPaths } = llmsSectionRoute()
@@ -0,0 +1,4 @@
1
+ import { llmsFullRoute } from '@cloudflare/nimbus-docs/agent-endpoints'
2
+
3
+ export const prerender = true
4
+ export const { GET } = llmsFullRoute()
@@ -0,0 +1,4 @@
1
+ import { llmsRoute } from '@cloudflare/nimbus-docs/agent-endpoints'
2
+
3
+ export const prerender = true
4
+ export const { GET } = llmsRoute()
@@ -0,0 +1,18 @@
1
+ import { withBase } from '@cloudflare/nimbus-docs/runtime'
2
+ import { config } from 'virtual:nimbus/config'
3
+
4
+ export const prerender = true
5
+
6
+ export function GET() {
7
+ const body = [
8
+ 'User-agent: *',
9
+ 'Allow: /',
10
+ '',
11
+ `Sitemap: ${new URL(withBase('/sitemap-index.xml', import.meta.env.BASE_URL), config.site).href}`,
12
+ '',
13
+ ].join('\n')
14
+
15
+ return new Response(body, {
16
+ headers: { 'Content-Type': 'text/plain; charset=utf-8' },
17
+ })
18
+ }
@@ -0,0 +1,121 @@
1
+ @layer base {
2
+ :root {
3
+ font-family: system-ui, sans-serif;
4
+ line-height: 1.7;
5
+ color: var(--ink);
6
+ color-scheme: light dark;
7
+ background: var(--surface);
8
+
9
+ --surface: #fafbfc;
10
+ --ink: #263247;
11
+ --muted: #5d6b80;
12
+ --line: #dce2eb;
13
+ --accent: #1d4ed8;
14
+ --soft: #edf2fc;
15
+ }
16
+
17
+ * {
18
+ box-sizing: border-box;
19
+ }
20
+
21
+ body {
22
+ margin: 0;
23
+ }
24
+
25
+ a {
26
+ color: var(--accent);
27
+ text-underline-offset: 0.2em;
28
+ }
29
+
30
+ a:hover {
31
+ text-decoration-thickness: 2px;
32
+ }
33
+
34
+ :focus-visible {
35
+ outline: 2px solid var(--accent);
36
+ outline-offset: 4px;
37
+ }
38
+
39
+ h1, h2, h3 {
40
+ line-height: 1.25;
41
+ text-wrap: balance;
42
+ }
43
+
44
+ h1 {
45
+ margin: 0 0 1rem;
46
+ font-family: Charter, Georgia, serif;
47
+ font-size: clamp(2.4rem, 5vw, 3.6rem);
48
+ font-weight: 500;
49
+ }
50
+
51
+ h2 {
52
+ margin-top: 2.5rem;
53
+ font-size: 1.5rem;
54
+ }
55
+
56
+ h3 {
57
+ margin-top: 2rem;
58
+ }
59
+
60
+ p, li {
61
+ overflow-wrap: anywhere;
62
+ }
63
+
64
+ code {
65
+ font-family: ui-monospace, monospace;
66
+ font-size: 0.88em;
67
+ }
68
+
69
+ pre {
70
+ padding: 1.2rem;
71
+ overflow: auto;
72
+ border: 1px solid var(--line);
73
+ border-radius: 0.4rem;
74
+ }
75
+
76
+ :not(pre) > code {
77
+ padding: 0.15rem 0.35rem;
78
+ background: var(--soft);
79
+ border-radius: 0.2rem;
80
+ }
81
+
82
+ img {
83
+ max-width: 100%;
84
+ }
85
+
86
+ table {
87
+ display: block;
88
+ overflow-x: auto;
89
+ border-collapse: collapse;
90
+ }
91
+
92
+ td, th {
93
+ padding: 0.6rem 1rem;
94
+ text-align: start;
95
+ border: 1px solid var(--line);
96
+ }
97
+
98
+ button, input {
99
+ font: inherit;
100
+ }
101
+
102
+ button, summary {
103
+ cursor: pointer;
104
+ }
105
+
106
+ button {
107
+ padding: 0.4rem 0.7rem;
108
+ color: var(--surface);
109
+ background: var(--accent);
110
+ border: 0;
111
+ border-radius: 0.3rem;
112
+ }
113
+
114
+ input {
115
+ width: 100%;
116
+ min-width: 0;
117
+ padding: 0.4rem;
118
+ border: 1px solid var(--line);
119
+ border-radius: 0.3rem;
120
+ }
121
+ }