This guide will help you set up a local development environment for contributing to b5.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/peilingjiang/b5/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, ensure you have the following installed:- Bun - Fast JavaScript runtime and package manager
- Git
- A modern web browser (Chrome, Firefox, or Safari recommended)
Clone the Repository
Clone the project with all submodules:Installation
Install dependencies
Run the setup script to install all dependencies including the b5.js submodule:This command runs:
bun install- Installs main project dependenciesbun run submodule- Installs b5.js submodule dependencies
Start development servers
Open two terminal windows in the project root directory.In the first terminal, start the CSS watcher (if you plan to modify CSS):In the second terminal, start the React development server:
Available Scripts
The following scripts are available inpackage.json:
Development Workflow
Making Changes
- The React development server (
bun start) watches for file changes and automatically reloads - The CSS watcher (
bun run css) listens to CSS file changes and optimizes them in real-time - Make your changes to the codebase
- Test your changes in the browser at
localhost:3000
Code Formatting
Code is automatically formatted upon commit using git hooks. You don’t need to manually format before committing.
*.{js,jsx,ts,tsx,json,md,html,css} files using Prettier.
Pre-commit Hooks
The project usessimple-git-hooks and lint-staged to automatically format code before commits:
- Prettier runs on staged files matching the pattern
- No manual intervention needed
- Ensures consistent code style across the project
Project Structure
See the Architecture page for detailed information about the codebase structure.Troubleshooting
Port Already in Use
If port 3000 is already in use, the development server will prompt you to use a different port. You can also set a custom port:Submodule Issues
If you encounter issues with the b5.js submodule:CSS Not Updating
Make sure the CSS watcher is running in a separate terminal:Next Steps
- Read the Architecture Guide to understand the codebase structure
- Check out the Contributing Guide to learn how to contribute
- Review the Code of Conduct for community guidelines