Skip to content

Commit 3d1efb9

Browse files
committed
🔧 chore: extract docs-kit into a standalone repository
History of packages/docs-kit, the original site/ and tests/fixtures/site is carried over from lobehub/lobe-ui; release tags are renamed from [email protected] to vx.y.z. playground/ replaces lobe-ui as the consumer the compiler tests and the CI build smoke test run against.
1 parent 70e373c commit 3d1efb9

68 files changed

Lines changed: 16872 additions & 210 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.editorconfig‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[Makefile]
16+
indent_style = tab

‎.github/workflows/release.yml‎

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Release CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
inputs:
9+
force_release:
10+
description: 'Force release (bypass conventional commits)'
11+
required: false
12+
default: 'false'
13+
type: choice
14+
options:
15+
- 'true'
16+
- 'false'
17+
release_type:
18+
description: 'Release type (when force release is true)'
19+
required: false
20+
default: 'patch'
21+
type: choice
22+
options:
23+
- 'patch'
24+
- 'minor'
25+
- 'major'
26+
27+
# semantic-release pushes a release commit back to the branch, so two runs must
28+
# never overlap.
29+
concurrency:
30+
group: release-${{ github.ref }}
31+
cancel-in-progress: false
32+
33+
permissions:
34+
id-token: write # Required for npm provenance (OIDC)
35+
contents: write # Required for semantic-release to push tags and commits
36+
issues: write # Required for semantic-release to create issues
37+
pull-requests: write # Required for semantic-release to comment on PRs
38+
39+
jobs:
40+
release:
41+
name: Release
42+
runs-on: ubuntu-latest
43+
44+
steps:
45+
- uses: actions/create-github-app-token@v2
46+
id: app-token
47+
with:
48+
app-id: ${{ vars.LOBEHUB_BOT_APP_ID }}
49+
private-key: ${{ secrets.LOBEHUB_BOT_APP_PRIVATE_KEY }}
50+
51+
- uses: actions/checkout@v5
52+
with:
53+
token: ${{ steps.app-token.outputs.token }}
54+
fetch-depth: 0
55+
ref: ${{ github.ref_name }}
56+
57+
- name: Install pnpm
58+
uses: pnpm/action-setup@v6
59+
60+
- name: Setup Node
61+
uses: actions/setup-node@v4
62+
with:
63+
cache: pnpm
64+
node-version: 22
65+
66+
- name: Install deps
67+
run: pnpm install --frozen-lockfile
68+
69+
- name: Lint
70+
run: pnpm lint
71+
72+
- name: Type check
73+
run: pnpm type-check
74+
75+
- name: Test
76+
run: pnpm test
77+
78+
- name: Build playground
79+
run: pnpm build:playground
80+
81+
- name: Verify package
82+
run: npm pack --dry-run
83+
84+
- name: Force Release Commit
85+
if: github.event.inputs.force_release == 'true'
86+
run: |
87+
git config user.name "github-actions[bot]"
88+
git config user.email "github-actions[bot]@users.noreply.github.com"
89+
git commit --allow-empty -m "🔧 chore(release): force ${{ github.event.inputs.release_type }} release"
90+
91+
- name: Release
92+
run: pnpm release
93+
env:
94+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
95+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

‎.github/workflows/test.yml‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Test CI
2+
3+
on:
4+
pull_request: {}
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v5
16+
17+
- name: Install pnpm
18+
uses: pnpm/action-setup@v6
19+
20+
- name: Setup Node
21+
uses: actions/setup-node@v4
22+
with:
23+
cache: pnpm
24+
node-version: 22
25+
26+
- name: Install deps
27+
run: pnpm install --frozen-lockfile
28+
29+
- name: Lint
30+
run: pnpm lint
31+
32+
- name: Type check
33+
run: pnpm type-check
34+
35+
- name: Test and coverage
36+
run: pnpm test:coverage
37+
38+
- name: Build playground
39+
run: pnpm build:playground

‎.gitignore‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# dependencies
2+
node_modules
3+
4+
# build output
5+
**/.react-router/
6+
dist
7+
8+
# ci
9+
coverage
10+
.eslintcache
11+
12+
# generated
13+
site/compiler/.cache/
14+
site/compiler/__fixtures__/
15+
react-router.config.mjs
16+
17+
# husky
18+
.husky/_
19+
20+
# misc
21+
.DS_Store
22+
.idea
23+
.vscode
24+
.history
25+
*.log
26+
.env.local
27+
.vitest/

‎.husky/commit-msg‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env sh
2+
3+
npx --no -- commitlint --edit ${1}

‎.prettierignore‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
**/node_modules
2+
**/dist
3+
**/.react-router
4+
coverage
5+
.vitest
6+
pnpm-lock.yaml
7+
CHANGELOG.md
8+
site/compiler/.cache

‎.releaserc.mjs‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1-
import { createReleaseConfig } from '../../scripts/release/config.mjs';
1+
import { semanticRelease } from '@lobehub/lint';
22

3-
export default createReleaseConfig({
4-
scopes: ['docs-kit'],
5-
tagFormat: 'docs-kit@${version}',
3+
const GITMOJI_PRESET = './changelog-preset.mjs';
4+
5+
const plugins = semanticRelease.plugins.map((plugin) => {
6+
if (!Array.isArray(plugin)) return plugin;
7+
const [name, options] = plugin;
8+
if (
9+
options?.config === 'conventional-changelog-gitmoji-config' &&
10+
(name === '@semantic-release/commit-analyzer' ||
11+
name === '@semantic-release/release-notes-generator')
12+
) {
13+
return [name, { ...options, config: GITMOJI_PRESET }];
14+
}
15+
return plugin;
616
});
17+
18+
export default { ...semanticRelease, plugins };

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 LobeHub
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎README.md‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A reusable documentation-site toolkit for LobeHub component libraries — a React Router + Vite static-site stack, packaged the way `dumi` + `dumi-theme-lobehub` used to be combined, but installable across repos.
44

5-
`lobe-ui` is the first consumer (dogfooding): the site under `packages/docs-kit/site` compiles component docs, standalone demos, a search index, and a changelog page into a static build. Consumer repos hold only content and a config file — the kit owns every build tool config internally.
5+
It powers [ui.lobehub.com](https://ui.lobehub.com): the site under `site/` compiles component docs, standalone demos, a search index, and a changelog page into a static build. Consumer repos hold only content and a config file — the kit owns every build tool config internally.
66

77
## Consumer surface
88

@@ -44,16 +44,14 @@ lobedocs typegen # react-router typegen
4444
### `docs.config.ts`
4545

4646
```ts
47-
import { defineDocsConfig } from './packages/docs-kit/src/config';
48-
49-
export default defineDocsConfig({
47+
export default {
5048
atomDirs: [{ dir: 'src' }],
5149
title: 'Lobe UI',
5250
description: '...',
5351
siteUrl: 'https://ui.lobehub.com',
5452
navSections: {/* path -> nav section label */},
5553
themeConfig: {/* ... */},
56-
});
54+
};
5755
```
5856

5957
| Field | Type | Purpose |
@@ -100,7 +98,14 @@ Both routes are available from `lobedocs dev` and are prerendered into the stati
10098
- `src/cli/` — `lobedocs` command implementations
10199
- `src/config.ts` — `defineDocsConfig`, config loading/caching
102100

103-
## Roadmap
101+
## Development
102+
103+
```bash
104+
pnpm install
105+
pnpm dev # lobedocs dev against playground/
106+
pnpm build:playground # full static build of playground/
107+
pnpm test # vitest, run from playground/ as the consumer cwd
108+
pnpm lint && pnpm type-check
109+
```
104110

105-
This package is at Phase 1 of a four-phase extraction (lobe-ui-only today, `lobe-editor` adoption later). See the full plan, including Phase 2's giscus/changelog/multi-atomDir work and Phase 3/4's `lobe-editor` migration, in
106-
[`docs/superpowers/specs/2026-07-16-docs-kit-extraction-design.md`](../../docs/superpowers/specs/2026-07-16-docs-kit-extraction-design.md).
111+
`playground/` is a minimal consumer repo (a workspace package linking this kit) used for local development, the compiler integration tests and the CI build smoke test. Commits follow gitmoji + conventional commits; releases are published to npm by semantic-release from `main`.

‎changelog-preset.mjs‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import gitmoji from 'conventional-changelog-gitmoji-config';
2+
3+
const preset = gitmoji.default ?? gitmoji;
4+
5+
export default async function createPreset() {
6+
const writer = { ...(await preset.writerOpts) };
7+
const transform = writer.transform;
8+
writer.transform = (commit, context) =>
9+
transform(
10+
{
11+
...commit,
12+
notes: commit.notes.map((note) => ({ ...note })),
13+
references: commit.references.map((ref) => ({ ...ref })),
14+
},
15+
context,
16+
);
17+
18+
return {
19+
parser: await preset.parserOpts,
20+
writer,
21+
};
22+
}

0 commit comments

Comments
 (0)