Update docusaurus
Update Docusaurus Sidebar
Use this prompt when creating new AWS CDK extends, patterns, or types that need to be added to the Docusaurus sidebar.
Prompt
I need to update the Docusaurus sidebar after creating new constructs or extends.
Context:
- New files were created under: [src-extends-aws-cdk-lib | src-patterns | src-types]
- Specifically: [describe what was created, e.g., "aws-dynamodb/Table.ts"]
Requirements:
1. Update docs/sidebars.ts to include the new API documentation entries
2. Follow the existing sidebar structure and organization
3. Maintain alphabetical ordering within categories
4. Ensure the path matches the TypeDoc output structure
5. Add nested categories for new AWS service modules if needed
Sidebar Structure Rules:
- src-extends-aws-cdk-lib: Use format 'api/src-extends-aws-cdk-lib/{service}/{ClassName}'
- Top-level classes (Stack, App) go directly under the category
- AWS services are subcategories using their module name (e.g., aws-dynamodb, aws-lambda)
- Each class file becomes a sidebar item
- src-patterns: Use format 'api/src-patterns' or 'api/src-patterns/{category}/{PatternName}'
- Patterns are organized by AWS service or functionality
- src-types: Use format 'api/src-types/{module}' or 'api/src-types/{module}/{TypeName}'
- Types are organized by their logical grouping (defaults, global, etc.)
Example for aws-dynamodb:
```typescript
{
type: 'category',
label: 'aws-dynamodb',
items: [
'api/src-extends-aws-cdk-lib/aws-dynamodb/Table',
],
}
Please update docs/sidebars.ts with the new entries maintaining the existing organizational structure.
## Usage Examples
### Example 1: Adding a New AWS Service Module
**Your prompt:**
```text
I need to update the Docusaurus sidebar after creating new constructs.
Context:
- New files were created under: src-extends-aws-cdk-lib
- Specifically: aws-dynamodb/Table.ts
Requirements:
1. Update docs/sidebars.ts to include the new API documentation entries
2. Follow the existing sidebar structure and organization
3. Maintain alphabetical ordering within categories
4. Ensure the path matches the TypeDoc output structure
5. Add nested categories for new AWS service modules if needed
Expected result:
- New category added under
src-extends-aws-cdk-libforaws-dynamodb - Entry added for
Tableclass - Alphabetically ordered between existing services
Example 2: Adding Multiple Classes to Existing Service
Your prompt:
I need to update the Docusaurus sidebar after creating new constructs.
Context:
- New files were created under: src-extends-aws-cdk-lib/aws-lambda
- Specifically: added Version.ts and LayerVersion.ts
Requirements:
1. Update docs/sidebars.ts to include the new API documentation entries
2. Add them to the existing aws-lambda category
3. Maintain alphabetical ordering within the aws-lambda items
Expected result:
{
type: 'category',
label: 'aws-lambda',
items: [
'api/src-extends-aws-cdk-lib/aws-lambda/Alias',
'api/src-extends-aws-cdk-lib/aws-lambda/Function',
'api/src-extends-aws-cdk-lib/aws-lambda/LayerVersion',
'api/src-extends-aws-cdk-lib/aws-lambda/Version',
],
}
Example 3: Adding New Pattern
Your prompt:
I need to update the Docusaurus sidebar after creating new constructs.
Context:
- New files were created under: src-patterns/aws-dynamodb
- Specifically: SingleTableDesign.ts and EventSourcedTable.ts
Requirements:
1. Update docs/sidebars.ts to include the new pattern documentation
2. Create or update the src-patterns section with aws-dynamodb subcategory
3. Maintain alphabetical ordering
Expected result:
{
type: 'category',
label: 'src-patterns',
items: [
{
type: 'category',
label: 'aws-dynamodb',
items: [
'api/src-patterns/aws-dynamodb/EventSourcedTable',
'api/src-patterns/aws-dynamodb/SingleTableDesign',
],
},
{
type: 'category',
label: 'aws-s3',
items: [
'api/src-patterns/aws-s3/PublicS3Bucket',
'api/src-patterns/aws-s3/VersionedS3Bucket',
],
},
],
}
Example 4: Adding New Type Definitions
Your prompt:
I need to update the Docusaurus sidebar after creating new type definitions.
Context:
- New files were created under: src-types/defaults
- Specifically: added DynamoDBDefaults.ts and ApiGatewayDefaults.ts
Requirements:
1. Update docs/sidebars.ts to include the new type documentation
2. Add them to the existing src-types/defaults category or create new subcategory
3. Maintain alphabetical ordering
Sidebar Location
The sidebar configuration file is located at:
docs/sidebars.ts
Current Sidebar Structure Reference
{
type: 'category',
label: 'Reference',
items: [
'api/index',
{
type: 'category',
label: 'src-extends-aws-cdk-lib',
items: [
// Top-level classes
'api/src-extends-aws-cdk-lib/Stack',
// AWS service subcategories (alphabetically ordered)
{ type: 'category', label: 'app', items: [...] },
{ type: 'category', label: 'aws-apigateway', items: [...] },
{ type: 'category', label: 'aws-cloudwatch', items: [...] },
{ type: 'category', label: 'aws-codedeploy', items: [...] },
{ type: 'category', label: 'aws-dynamodb', items: [...] }, // NEW
{ type: 'category', label: 'aws-lambda', items: [...] },
{ type: 'category', label: 'aws-lambda-nodejs', items: [...] },
'api/src-extends-aws-cdk-lib/aws-logs',
{ type: 'category', label: 'aws-ssm', items: [...] },
],
},
{
type: 'category',
label: 'src',
items: [...]
},
{
type: 'category',
label: 'src-types',
items: [...]
},
'api/src-patterns',
],
}
Quick Reference: Path Patterns
| Source Path | Sidebar Path | Example |
|---|---|---|
src-extends-aws-cdk-lib/Stack.ts | api/src-extends-aws-cdk-lib/Stack | Top-level class |
src-extends-aws-cdk-lib/aws-{service}/{Class}.ts | api/src-extends-aws-cdk-lib/aws-{service}/{Class} | Service-specific class |
src-patterns/aws-{service}/{Pattern}.ts | api/src-patterns/aws-{service}/{Pattern} | Pattern implementation |
src-types/{module}/{Type}.ts | api/src-types/{module}/{Type} | Type definitions |
src/contextStrategy/{Class}.ts | api/src/contextStrategy/{Class} | Core utilities |
Notes
- Always maintain alphabetical ordering within categories
- Use kebab-case for service names (e.g.,
aws-lambda-nodejs, notawsLambdaNodejs) - Single classes in a module can be referenced directly as strings
- Multiple classes in a module should use category objects
- The sidebar should mirror the actual TypeDoc-generated documentation structure
- After updating, verify the sidebar renders correctly by running
npm run docs:buildornpm run docs:start
Verification Steps
After updating the sidebar:
-
Check the TypeScript compilation:
cd docs && npx tsc --noEmit -
Build the documentation locally:
npm run docs:build -
Start the dev server to preview:
npm run docs:start -
Verify the new entries appear in the left sidebar navigation
-
Click through to ensure the documentation pages load correctly