Skip to content

Commit e2b7371

Browse files
committed
refactor: restructure site package and migrate to Next.js
- Removed legacy i18n and source files, replacing them with new implementations. - Introduced new Next.js application structure for documentation rendering. - Added support for multiple languages (English and Simplified Chinese). - Implemented dynamic routing for documentation pages based on language and slug. - Created layout components for consistent styling and structure across pages. - Integrated MDX support for documentation content. - Added SVG assets for architecture and protocol-driven design. - Updated TypeScript configuration for improved type checking and module resolution. - Established a new package.json for the site with necessary dependencies and scripts.
1 parent 4dc6aba commit e2b7371

46 files changed

Lines changed: 219 additions & 61 deletions

Some content is hidden

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

packages/cli/package.json

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,11 @@
1212
"test": "echo \"Error: no test specified\" && exit 1"
1313
},
1414
"dependencies": {
15-
"@fumadocs/ui": "^16.4.7",
16-
"@tailwindcss/postcss": "^4.1.18",
17-
"@types/mdx": "^2.0.13",
15+
"@objectdocs/site": "workspace:*",
1816
"@types/node": "^25.0.8",
19-
"@types/react": "^19.2.8",
20-
"autoprefixer": "^10.4.23",
2117
"cac": "^6.7.14",
22-
"dev": "^0.1.3",
2318
"dotenv": "^16.4.5",
24-
"fumadocs-core": "^16.4.7",
25-
"fumadocs-mdx": "^14.2.5",
26-
"fumadocs-ui": "^16.4.7",
27-
"next": "^16.1.2",
2819
"openai": "^4.0.0",
29-
"postcss": "^8.5.6",
30-
"react": "^19.2.3",
31-
"react-dom": "^19.2.3",
32-
"tailwindcss": "^4.1.18",
3320
"typescript": "^5.9.3"
3421
}
3522
}

packages/cli/src/commands/build.mjs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { spawn } from 'child_process';
22
import path from 'path';
33
import { fileURLToPath } from 'url';
4+
import { createRequire } from 'module';
45

56
const __filename = fileURLToPath(import.meta.url);
67
const __dirname = path.dirname(__filename);
8+
const require = createRequire(import.meta.url);
79

810
export function registerBuildCommand(cli) {
911
cli
@@ -12,9 +14,14 @@ export function registerBuildCommand(cli) {
1214
// 1. Resolve user's docs directory
1315
const docsDir = dir ? path.resolve(process.cwd(), dir) : path.resolve(process.cwd(), 'content/docs');
1416

15-
// 2. Resolve the Next.js App directory (Inside the package now)
16-
// packages/objectdocs/src/commands/build.mjs -> ../../site
17-
const nextAppDir = path.resolve(__dirname, '../../site');
17+
// 2. Resolve the Next.js App directory
18+
let nextAppDir;
19+
try {
20+
nextAppDir = path.dirname(require.resolve('@objectdocs/site/package.json'));
21+
} catch (e) {
22+
// Fallback for local development
23+
nextAppDir = path.resolve(__dirname, '../../../site');
24+
}
1825

1926
console.log(`Building docs site...`);
2027
console.log(` Engine: ${nextAppDir}`);

packages/cli/src/commands/dev.mjs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { spawn } from 'child_process';
22
import path from 'path';
33
import { fileURLToPath } from 'url';
4+
import { createRequire } from 'module';
45

56
const __filename = fileURLToPath(import.meta.url);
67
const __dirname = path.dirname(__filename);
8+
const require = createRequire(import.meta.url);
79

810
export function registerDevCommand(cli) {
911
cli
@@ -13,9 +15,14 @@ export function registerDevCommand(cli) {
1315
// 1. Resolve user's docs directory (Absolute path)
1416
const docsDir = dir ? path.resolve(process.cwd(), dir) : path.resolve(process.cwd(), 'content/docs');
1517

16-
// 2. Resolve the Next.js App directory (Inside the package now)
17-
// packages/objectdocs/src/commands/dev.mjs -> ../../site
18-
const nextAppDir = path.resolve(__dirname, '../../site');
18+
// 2. Resolve the Next.js App directory
19+
let nextAppDir;
20+
try {
21+
nextAppDir = path.dirname(require.resolve('@objectdocs/site/package.json'));
22+
} catch (e) {
23+
// Fallback for local development
24+
nextAppDir = path.resolve(__dirname, '../../../site');
25+
}
1926

2027
console.log(`Starting docs server...`);
2128
console.log(` Engine: ${nextAppDir}`);

packages/site/README.md

Lines changed: 4 additions & 0 deletions
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)