Skip to content

Commit 40db89f

Browse files
Copilothotlong
andcommitted
Address code review feedback - add missing zod file titles and clarify cleanup logic
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 380f59f commit 40db89f

File tree

10 files changed

+25
-15
lines changed

10 files changed

+25
-15
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"title": "API Configuration"
2+
"title": "Api"
33
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"title": "Discovery"
2+
"title": "Service Discovery"
33
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"title": "Job"
2+
"title": "Jobs"
33
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"title": "Organization"
2+
"title": "Organizations"
33
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"title": "Plugin"
2+
"title": "Plugins"
33
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"title": "Policy"
2+
"title": "Policies"
33
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"title": "Realtime"
2+
"title": "Real-time Communication"
33
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"title": "Role"
2+
"title": "Roles"
33
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"title": "Tenant"
2+
"title": "Tenants"
33
}

packages/spec/scripts/build-docs.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,22 @@ const ZOD_FILE_TITLES: Record<string, string> = {
5252
'datasource': 'Datasources',
5353
'driver': 'Drivers',
5454
'auth': 'Authentication',
55+
'identity': 'Identity',
56+
'role': 'Roles',
57+
'policy': 'Policies',
58+
'organization': 'Organizations',
59+
'tenant': 'Tenants',
5560
'webhook': 'Webhooks',
56-
'api': 'API Configuration',
61+
'events': 'Events',
62+
'job': 'Jobs',
63+
'realtime': 'Real-time Communication',
64+
'discovery': 'Service Discovery',
65+
'plugin': 'Plugins',
5766
'translation': 'Translations',
5867
'audit': 'Audit',
5968
'territory': 'Territories',
6069
'license': 'Licenses',
6170
'plan': 'Plans',
62-
'rbac': 'Role-Based Access Control',
6371
// API
6472
'contract': 'API Contracts'
6573
};
@@ -171,7 +179,9 @@ function generateMarkdown(schemaName: string, schema: any) {
171179
}
172180

173181
// 2. Clean up old documentation structure
174-
// Remove old .mdx files and subdirectories from category roots
182+
// IMPORTANT: This removes old .mdx files and subdirectories to ensure a clean state.
183+
// Only category roots are cleaned (data/, ui/, system/, ai/, api/). The root meta.json is preserved.
184+
// All necessary directories and files are regenerated in step 3, so this is safe.
175185
Object.keys(CATEGORIES).forEach(category => {
176186
const dir = path.join(DOCS_ROOT, category);
177187
if (fs.existsSync(dir)) {
@@ -180,14 +190,14 @@ Object.keys(CATEGORIES).forEach(category => {
180190
const entryPath = path.join(dir, entry);
181191
const stat = fs.statSync(entryPath);
182192

183-
// Remove old .mdx files from category root
193+
// Remove old .mdx files from category root (these will be moved to subfolders)
184194
if (stat.isFile() && entry.endsWith('.mdx')) {
185195
fs.unlinkSync(entryPath);
186196
console.log(`Removed old file: ${category}/${entry}`);
187197
}
188-
// Remove old subdirectories (but keep meta.json)
198+
// Remove old subdirectories (will be recreated with correct structure in step 3)
199+
// Note: meta.json is preserved as it's not a directory
189200
else if (stat.isDirectory()) {
190-
// We'll recreate the directories we need, so remove all existing ones
191201
fs.rmSync(entryPath, { recursive: true, force: true });
192202
console.log(`Removed old directory: ${category}/${entry}`);
193203
}

0 commit comments

Comments
 (0)