|
1 | | -import fs from 'node:fs'; |
2 | | -import path from 'node:path'; |
3 | 1 | import { deepMerge } from './deep-merge'; |
| 2 | +import objectDocsConfig from '@/objectdocs.json'; |
4 | 3 |
|
5 | 4 | export interface SiteConfig { |
6 | 5 | meta: { |
@@ -141,33 +140,7 @@ const defaultConfig: SiteConfig = { |
141 | 140 | }; |
142 | 141 |
|
143 | 142 | 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); |
171 | 144 | } |
172 | 145 |
|
173 | 146 | export const siteConfig = getSiteConfig(); |
0 commit comments