Kuma Mieru Docs
Development

Contributing

Set up a local development environment, and learn the repository layout, the common commands and the pull request process.

Requirements

ToolVersionDeclared in
Node.js26, at least 26.12.1.nvmrc pins 26.12.1. The engines field of package.json is >=26.12.1 <27
Bun1.4.4The packageManager field of the root package.json

Turborepo reads the packageManager field to identify the package manager. Install Bun itself with the official install script or with npm i -g bun@1.4.4, not with Corepack. For the commands on each operating system, see Run from Source.

Repository layout

.env.example
package.json
design.md
package.json
.nvmrc
.oxfmtrc.json
.oxlintrc.json
package.json
turbo.json
PathContent
apps/webThe Kuma Mieru web application, package @kuma-mieru/web
apps/web/configThe configuration schemas and the files that the generate script creates
apps/web/messagesInterface translations, one JSON file for each language
apps/web/scriptsThe generate script and other scripts
apps/docsThe docs site, package @kuma-mieru/docs, built as a static site with Fumadocs
apps/docs/design.mdThe design rules of the docs site. See Design Rules
packages/themeThe theme that the web application and the docs site share, package @kuma-mieru/theme
packages/tsconfigThe shared TypeScript configurations base.json and nextjs.json, package @kuma-mieru/tsconfig
turbo.jsonThe Turborepo task definitions
.oxlintrc.jsonThe Oxlint rules
.oxfmtrc.jsonThe Oxfmt formatting configuration

Common commands

Run these commands in the repository root:

CommandAction
bun installInstalls the dependencies of all workspaces
bun run devStarts the web application (port 3881) and the docs site (port 3882) together with Turborepo
bun run buildBuilds all packages
bun run lintRuns the Oxlint type-aware check. One run does the lint and the type check (based on TypeScript 7 and tsgolint)
bun run lint:fixFixes problems with Oxlint, then formats with Oxfmt
bun run formatFormats the code with Oxfmt
bun run format:checkChecks the format and changes no files
bun run testRuns the tests

To run a task for one package only, use the Turborepo --filter option:

bunx turbo run dev --filter=@kuma-mieru/web

The dev script of the web application runs generate first. Thus you must create apps/web/.env before you start development. For the procedure, see Run from Source.

Web application scripts

Run these commands in the apps/web directory:

CommandAction
bun run generateRuns generate:config, generate:domains and generate:banner in sequence
bun run generate:configCreates config/generated-config.json
bun run generate:domainsCreates config/generated/image-domains.json
bun run generate:bannerPrints the startup banner and the current configuration in the terminal
bun run build:analyzeBuilds the application and creates a bundle analysis report
bun run startRuns the built standalone server

Code style

  • Use Valibot for data validation.
  • Write all code in TypeScript. Keep the code short and easy to read.
  • Use functional and declarative patterns. Obey the DRY principle. Use early returns to reduce nesting.
  • Organize a component file in this order: exports, subcomponents, helpers, types.
  • Give boolean names an auxiliary verb, for example isLoading and hasError.
  • Start event handler names with handle, for example handleClick and handleSubmit.
  • Use lowercase letters and dashes for directory names, for example components/auth-wizard.
  • Prefer named exports for components.
  • Prefer interfaces. Use const maps instead of enums. Use the satisfies operator to validate types.
  • Use React Server Components where possible and keep 'use client' directives to a minimum. Add error boundaries to components. Use Suspense for asynchronous operations.

Internationalization

Interface translations are in apps/web/messages/, one JSON file for each language, for example apps/web/messages/en-US.json. To add a language:

  1. Add the language to the locales array in apps/web/utils/i18n/config.ts.
  2. Add the translation file of the language to apps/web/messages/.
  3. Register the import of the translation file in messageLoaders in apps/web/utils/i18n/messages.ts. Kuma Mieru cannot load the translations of a language that is not registered.
  4. To show a flag in the language menu, add the matching flag component from @sankyu/react-circle-flags to the flagComponents maps in apps/web/components/basic/i18n-switch.tsx and apps/web/app/global-error.tsx. Use the alpha2Code of the language as the key.

Submit a pull request

Prepare the repository

Fork this repository on GitHub. Then clone your fork, add the upstream repository and install the dependencies:

git clone https://github.com/YOUR-USERNAME/kuma-mieru.git
cd kuma-mieru
git remote add upstream https://github.com/Alice39s/kuma-mieru.git
bun install

Create a branch

Use the feature/ prefix for a new feature and the fix/ prefix for a bug fix:

git checkout -b feature/amazing-feature

Change and check the code

Test your changes with bun run dev. Before you commit, run:

bun run lint
bun run format

Commit the changes

Write the commit message in the Conventional Commits format:

git commit -m 'feat(component): add some amazing feature'
TypeUse
featA new feature
fixA bug fix
docsDocumentation changes
styleChanges that do not affect the meaning of the code, such as formatting
refactorCode changes that neither fix a bug nor add a feature
perfPerformance improvements
testNew or corrected tests
choreChanges to the build process or auxiliary tools

Push and open a pull request

git push origin feature/amazing-feature

Then open a pull request from your fork to the main repository.

A pull request must meet these requirements:

  • Each pull request addresses one issue or one feature.
  • The description states clearly what the pull request does.
  • Interface changes include screenshots when possible.
  • The code passes all lint and format checks.
  • The changes work in both the light and the dark theme.
  • The pull request stays current with the main branch through rebase.

Tests and documentation

  • Write tests for your code when applicable and run them with bun run test. Your changes must not break existing features.
  • If your changes affect the features, update README.md, README.en.md and the matching pages in apps/docs/content/docs. Update both the Chinese file (page.mdx) and the English file (page.en.mdx).
  • Add comments that describe the purpose of your components.

Last updated on