Skip to content

Commit be638ee

Browse files
committed
Merge branch 'main' into copilot/optimize-objectstack-manifesto
2 parents 6dfe291 + 72e7c2d commit be638ee

13 files changed

Lines changed: 168 additions & 40 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,28 @@ jobs:
1919
- name: Checkout code
2020
uses: actions/checkout@v4
2121

22+
- name: Install pnpm
23+
uses: pnpm/action-setup@v3
24+
with:
25+
version: 9
26+
2227
- name: Setup Node.js
2328
uses: actions/setup-node@v4
2429
with:
2530
node-version: '20'
26-
cache: 'npm'
31+
cache: 'pnpm'
2732

2833
- name: Install dependencies
29-
run: npm ci
34+
run: pnpm install --frozen-lockfile
3035

3136
- name: Generate source files
32-
run: npx fumadocs-mdx
37+
run: pnpm exec fumadocs-mdx
3338

3439
- name: Type check
35-
run: npx tsc --noEmit
40+
run: pnpm exec tsc --noEmit
3641

3742
- name: Build
38-
run: npm run build
43+
run: pnpm run build
3944
env:
4045
NODE_ENV: production
4146

objectdocs.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
},
1414
"branding": {
1515
"logo": {
16-
"text": "ObjectStack"
16+
"text": "ObjectStack",
17+
"light": "/logo.svg",
18+
"dark": "/logo.svg"
1719
},
1820
"theme": {
1921
"accentColor": "blue",

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"build:site": "pnpm --filter '@objectdocs/site' -r build",
99
"start": "pnpm --filter '@objectdocs/site' -r start",
1010
"translate": "objectdocs translate",
11-
"translate:all": "objectdocs translate --all"
11+
"translate:all": "objectdocs translate --all",
12+
"test": "pnpm -r test"
1213
},
1314
"dependencies": {
1415
"client-only": "^0.0.1",

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"dev": "node ./bin/cli.mjs dev ../../content/docs",
1010
"build": "node ./bin/cli.mjs build ../../content/docs",
1111
"translate": "node ./bin/cli.mjs translate",
12-
"test": "echo \"Error: no test specified\" && exit 1"
12+
"test": "echo \"No test specified\" && exit 0"
1313
},
1414
"dependencies": {
1515
"@objectdocs/site": "workspace:*",

packages/cli/src/commands/build.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,23 @@ export function registerBuildCommand(cli) {
2424
nextAppDir = path.resolve(__dirname, '../../../site');
2525
}
2626

27+
// Copy user config and assets to nextAppDir
28+
const userConfigPath = path.resolve(process.cwd(), 'objectdocs.json');
29+
if (fs.existsSync(userConfigPath)) {
30+
console.log(` Copying config from ${userConfigPath}`);
31+
fs.cpSync(userConfigPath, path.join(nextAppDir, 'objectdocs.json'));
32+
}
33+
34+
const userPublicPath = path.resolve(process.cwd(), 'public');
35+
if (fs.existsSync(userPublicPath)) {
36+
console.log(` Copying public assets from ${userPublicPath}`);
37+
const targetPublicDir = path.join(nextAppDir, 'public');
38+
if (!fs.existsSync(targetPublicDir)) {
39+
fs.mkdirSync(targetPublicDir, { recursive: true });
40+
}
41+
fs.cpSync(userPublicPath, targetPublicDir, { recursive: true, force: true });
42+
}
43+
2744
console.log(`Building docs site...`);
2845
console.log(` Engine: ${nextAppDir}`);
2946
console.log(` Content: ${docsDir}`);

packages/cli/src/commands/dev.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,21 @@ export function registerDevCommand(cli) {
4343
let debounceTimer;
4444

4545
const startServer = () => {
46+
// Sync config and assets before starting
47+
const userConfigPath = path.resolve(process.cwd(), 'objectdocs.json');
48+
if (fs.existsSync(userConfigPath)) {
49+
fs.cpSync(userConfigPath, path.join(nextAppDir, 'objectdocs.json'));
50+
}
51+
52+
const userPublicPath = path.resolve(process.cwd(), 'public');
53+
if (fs.existsSync(userPublicPath)) {
54+
const targetPublicDir = path.join(nextAppDir, 'public');
55+
if (!fs.existsSync(targetPublicDir)) {
56+
fs.mkdirSync(targetPublicDir, { recursive: true });
57+
}
58+
fs.cpSync(userPublicPath, targetPublicDir, { recursive: true, force: true });
59+
}
60+
4661
child = spawn(nextCmd, args, {
4762
stdio: 'inherit',
4863
env,

packages/site/app/layout.config.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
11
import { type BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
22
import { siteConfig } from '@/lib/site-config';
3+
import Image from 'next/image';
34

45
export const baseOptions: BaseLayoutProps = {
56
nav: {
6-
title: siteConfig.branding.logo.text || 'ObjectStack',
7+
title: (
8+
<div className="flex items-center gap-2">
9+
{siteConfig.branding.logo.light && (
10+
<Image
11+
src={siteConfig.branding.logo.light}
12+
alt={siteConfig.branding.logo.text || 'Logo'}
13+
width={30}
14+
height={30}
15+
className={siteConfig.branding.logo.dark ? 'dark:hidden' : ''}
16+
/>
17+
)}
18+
{siteConfig.branding.logo.dark && (
19+
<Image
20+
src={siteConfig.branding.logo.dark}
21+
alt={siteConfig.branding.logo.text || 'Logo'}
22+
width={30}
23+
height={30}
24+
className="hidden dark:block"
25+
/>
26+
)}
27+
<span className="font-bold">{siteConfig.branding.logo.text || 'ObjectStack'}</span>
28+
</div>
29+
),
730
transparentMode: siteConfig.layout.navbar.transparentMode,
831
},
932
links: siteConfig.layout.navbar.links.map(link => ({

packages/site/lib/site-config.ts

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import fs from 'node:fs';
2-
import path from 'node:path';
31
import { deepMerge } from './deep-merge';
2+
import objectDocsConfig from '@/objectdocs.json';
43

54
export interface SiteConfig {
65
meta: {
@@ -141,33 +140,7 @@ const defaultConfig: SiteConfig = {
141140
};
142141

143142
export function getSiteConfig(): SiteConfig {
144-
try {
145-
// Determine path to objectdocs.json.
146-
// Assuming process.cwd() is packages/site during build, or root during dev?
147-
// Let's look for objectdocs.json in a few places.
148-
149-
// 1. Check relative to current working directory (if run from root)
150-
let configPath = path.resolve(process.cwd(), 'objectdocs.json');
151-
if (fs.existsSync(configPath)) {
152-
const content = fs.readFileSync(configPath, 'utf-8');
153-
console.log('Loaded objectdocs.json from:', configPath);
154-
return deepMerge(defaultConfig, JSON.parse(content));
155-
}
156-
157-
// 2. Check relative to package root (../../objectdocs.json) if run from packages/site
158-
configPath = path.resolve(process.cwd(), '../../objectdocs.json');
159-
if (fs.existsSync(configPath)) {
160-
const content = fs.readFileSync(configPath, 'utf-8');
161-
console.log('Loaded objectdocs.json from:', configPath);
162-
return deepMerge(defaultConfig, JSON.parse(content));
163-
}
164-
165-
console.warn('objectdocs.json not found at:', configPath, 'using default config');
166-
} catch (error) {
167-
console.error('Error loading objectdocs.json:', error);
168-
}
169-
170-
return defaultConfig;
143+
return deepMerge(defaultConfig, objectDocsConfig);
171144
}
172145

173146
export const siteConfig = getSiteConfig();

packages/site/objectdocs.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"meta": {
3+
"title": "ObjectStack Docs",
4+
"description": "Enterprise-grade low-code platform documentation",
5+
"url": "https://docs.objectstack.ai",
6+
"favicon": "/favicon.ico"
7+
},
8+
"i18n": {
9+
"enabled": true,
10+
"defaultLanguage": "en",
11+
"languages": ["en", "cn"
12+
]
13+
},
14+
"branding": {
15+
"logo": {
16+
"text": "ObjectStack",
17+
"light": "/logo.svg",
18+
"dark": "/logo.svg"
19+
},
20+
"theme": {
21+
"accentColor": "blue",
22+
"radius": "0.5rem"
23+
}
24+
},
25+
"layout": {
26+
"navbar": {
27+
"enabled": true,
28+
"transparentMode": "top",
29+
"links": [
30+
{
31+
"text": "Home",
32+
"url": "https://www.objectstack.ai",
33+
"external": true
34+
}
35+
],
36+
"socials": [
37+
{ "platform": "github", "url": "https://github.com/objectstack-ai/" }
38+
]
39+
},
40+
"sidebar": {
41+
"enabled": true,
42+
"prefetch": true,
43+
"defaultOpenLevel": 1,
44+
"collapsible": true,
45+
"tabs": []
46+
},
47+
"toc": {
48+
"enabled": true,
49+
"depth": 3
50+
},
51+
"footer": {
52+
"enabled": false,
53+
"copyright": "© 2026 ObjectStack Inc."
54+
}
55+
},
56+
"page": {
57+
"showLastUpdate": true,
58+
"showEditLink": true,
59+
"repoBaseUrl": "https://github.com/objectstack-ai/docs"
60+
},
61+
"content": {
62+
"math": false,
63+
"imageZoom": true,
64+
"codeBlock": {
65+
"theme": "vesper",
66+
"showLineNumbers": true
67+
}
68+
}
69+
}

packages/site/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"dev": "next dev",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "next lint"
9+
"lint": "next lint",
10+
"test": "echo \"No test specified\" && exit 0"
1011
},
1112
"peerDependencies": {
1213
},

0 commit comments

Comments
 (0)