This repository contains the documentation website for the Helpers4 TypeScript utility library, built with Docusaurus.
- Bun (recommended) or Node.js 18+
- Git
-
Clone the repository
git clone https://github.com/helpers4/doc.git cd doc -
Install dependencies
bun install
-
Start development server
bun start # or alternatively bun run dev # or alternatively bun run dev
This will start the development server at
http://localhost:3000(accessible athttp://0.0.0.0:3000in Docker environments). The site will automatically reload when you make changes.
If you prefer using VS Code with Dev Containers:
- Open the project in VS Code
- When prompted, click "Reopen in Container" or use Command Palette:
Dev Containers: Reopen in Container - The container will automatically set up the environment and install dependencies
- Run
bun startto start the development server - The server will be accessible at
http://localhost:3000/on your host machine
Note: The development server is configured to listen on
0.0.0.0:3000to be accessible from outside the Docker container. Port 3000 is automatically forwarded by the dev container configuration.
├── docs/ # Documentation content
│ ├── intro.md # Introduction page
│ ├── getting-started.md # Getting started guide
│ ├── api/ # API reference documentation
│ │ ├── array/ # Array helpers documentation
│ │ ├── function/ # Function helpers documentation
│ │ └── ... # Other categories
│ └── examples/ # Usage examples
├── src/ # React components and pages
│ ├── components/ # Reusable React components
│ ├── css/ # Global styles
│ └── pages/ # Custom pages (playground, comparison)
├── static/ # Static assets (images, files)
├── scripts/ # Build and deployment scripts
│ ├── deploy.ts # GitHub Pages deployment script
│ └── version.ts # Version management script
├── docusaurus.config.ts # Docusaurus configuration
├── sidebars.ts # Sidebar configuration
└── package.json # Dependencies and scripts
bun start- Start development server with hot reloadbun build- Build the website for productionbun serve- Serve the production build locallybun clear- Clear Docusaurus cache
bun scripts/version.ts create [version]- Create a new documentation versionbun scripts/version.ts list- List all available versions
bun deploy- Build and deploy to GitHub Pages
bun lint- Run ESLintbun lint:fix- Fix ESLint issues automaticallybun typecheck- Run TypeScript type checking
- API Documentation: Add new
.mdfiles indocs/api/[category]/ - Guides and Examples: Add files in
docs/examples/ - Update Sidebar: Modify
sidebars.tsto include new pages
When a new version of Helpers4 is released:
# Create documentation for version 2.1.0
bun scripts/version.ts create 2.1.0
# Or auto-detect version from the main library
bun scripts/version.ts createThis will:
- Create a snapshot of current documentation
- Update the version selector
- Preserve older versions for reference
Follow these guidelines:
- Use clear headings: Structure content with H1, H2, H3 headings
- Include examples: Provide practical code examples for each function
- Add type signatures: Show TypeScript function signatures
- Explain use cases: Describe when and why to use each helper
- Link related functions: Cross-reference related helpers
- Colors: Modify CSS variables in
src/css/custom.css - Components: Customize React components in
src/components/ - Layout: Modify layout in
docusaurus.config.ts
- Playground: Interactive code editor in
src/pages/playground.tsx - Dark/Light mode: Toggle implementation in custom CSS
- Search: Configured with Algolia DocSearch
The documentation is automatically deployed to GitHub Pages when changes are pushed to the main branch.
# Build and deploy to GitHub Pages
bun deployThis script will:
- Build the documentation
- Push to the
gh-pagesbranch - Update the live site at
https://helpers4.github.io/doc/
To use a custom domain:
- Add your domain to the
CNAMEfile in thestatic/directory - Configure DNS to point to
helpers4.github.io - Update the
urlindocusaurus.config.ts
Key configuration options in docusaurus.config.ts:
- Site metadata: Title, description, favicon
- Theme configuration: Colors, navbar, footer
- Plugin settings: Search, analytics, versioning
- Deployment settings: GitHub Pages configuration
GOOGLE_ANALYTICS_ID- Google Analytics tracking ID (optional)ALGOLIA_APP_ID- Algolia search app ID (optional)ALGOLIA_API_KEY- Algolia search API key (optional)
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-docs - Make your changes: Add or update documentation
- Test locally: Run
bun startto preview changes - Commit your changes:
git commit -m 'Add amazing documentation' - Push to the branch:
git push origin feature/amazing-docs - Open a Pull Request
- Follow the style guide: Use consistent formatting and tone
- Test your changes: Ensure the site builds without errors
- Update navigation: Add new pages to the sidebar configuration
- Include examples: Provide practical code examples
- Check links: Ensure all internal and external links work
- Clear and concise: Use simple, direct language
- Consistent terminology: Use the same terms throughout
- Active voice: Prefer active voice over passive voice
- Code examples: Include working code examples
- Error handling: Show how to handle common errors
- Frontmatter: Include title and sidebar_position
- Code blocks: Use appropriate language tags
- Links: Use descriptive link text
- Images: Optimize images and include alt text
- Tables: Use tables for structured data
Build fails with TypeScript errors
# Clear cache and reinstall dependencies
bun clear
rm -rf node_modules bun.lockb
bun installDevelopment server won't start
# Check if port 3000 is available
lsof -ti:3000
# Kill process if needed
kill -9 $(lsof -ti:3000)
bun startDeploy script fails
# Ensure git is configured
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
# Check SSH key setup
ssh -T git@github.comIf the development server is not accessible from your host machine:
-
Check server binding: Ensure the server is listening on
0.0.0.0instead oflocalhost:bun start # Already configured with --host 0.0.0.0 -
Verify port forwarding: The dev container automatically forwards port 3000, but you can check:
# Server should show: http://localhost:3000/ # And be accessible from host at the same URL
-
Check dev container configuration: Port 3000 should be listed in
.devcontainer/devcontainer.json:"forwardPorts": [3000]
Build fails with broken links
- Check all internal links in markdown files
- Ensure referenced files exist
- Verify relative paths are correct
TypeScript errors in React components
- Run
bun typecheckto identify issues - Check import paths and component props
Development server won't start
- Clear cache:
bun clear - Reinstall dependencies:
rm -rf node_modules && bun install - Check port availability:
lsof -i :3000
This documentation is licensed under the AGPL-3.0 License.
- Built with Docusaurus
- Deployed on GitHub Pages
- Search powered by Algolia DocSearch
- Icons from Heroicons
Happy documenting! 📚✨