Skip to content

Latest commit

 

History

History
106 lines (83 loc) · 4.34 KB

CLAUDE.md

File metadata and controls

106 lines (83 loc) · 4.34 KB

Intlayer: open-source i18n monorepo. Bun + Turborepo. Ships npm packages (React, Next.js, Vue, Svelte, Angular…) + hosted CMS (backend + dashboard).

Sub-CLAUDE.md per workspace:

  • apps/backend/CLAUDE.md — Fastify REST API
  • apps/app/CLAUDE.md — TanStack Start CMS dashboard
  • apps/website/CLAUDE.md — TanStack Start marketing/docs site
  • apps/showcase/CLAUDE.md — TanStack Start showcase app
  • packages/@intlayer/chrome-extension/CLAUDE.md — i18n inspector Chrome extension
  • packages/@intlayer/design-system/CLAUDE.md — shared UI + TanStack Query hooks
  • packages/@intlayer/api/CLAUDE.md — typed fetch client
  • packages/@intlayer/core/CLAUDE.md — dictionary interpreter & transpiler
  • packages/intlayer/CLAUDE.md — main user package + CLI

Repo layout

apps/
  app/               TanStack Start dashboard (CMS UI)
  backend/           Fastify API server
  website/           TanStack Start marketing/docs site (deployed)
  showcase/          Showcase app

packages/
  intlayer/          Main user package + CLI entry point
  @intlayer/
    core/            Dictionary interpreter, transpiler, formatters
    config/          Config loader & types
    api/             Typed fetch client for backend REST API
    backend-contract/  REST contract (routes + zod schemas) shared by backend, api, OpenAPI
    design-system/   Shared React UI + TanStack Query hooks
    types/           Shared TS types (no runtime)
    cli/             CLI implementation
    editor/          Visual editor core (framework-agnostic)
    editor-react/    React bindings for editor
    lsp/             LSP implementation
    mcp/             MCP server for IDE automation
    babel/swc/webpack/vite/  Build-tool compiler plugins

  react-intlayer/    React hooks & provider
  next-intlayer/     Next.js integration
  vue-intlayer/      Vue integration
  (one package per framework)

utils/
  ts-config/         Shared tsconfig base
  tsdown-config/     Shared tsdown build config

plugins/
  sync-json-plugin/  JSON sync plugin
  sync-po-plugin/    PO file sync plugin

Commands (run from root)

Package manager: Bun.

bun run build             # build all publishable packages + backend
bun run turbo build --filter=./apps/app
bun run turbo build --filter=./packages/react-intlayer
bun run lint              # oxlint
bun run lint:fix
bun run check             # oxlint + oxfmt --check
bun run check:fix
bun run typecheck         # tsc --noEmit (sequential)
bun run test              # vitest (concurrency=2)

Content declaration flow

Users declare content in .content.ts files (co-located with components) using t() from intlayer. Intlayer Compiler (build-tool plugin) extracts at build time → emits JSON to .intlayer/. At runtime, useIntlayer (react-intlayer etc.) reads compiled dictionaries.

Git

Except if explicitly formulated, you cannot use git commit, stash, push, pull or changing branch

Commit conventions

Format: <type>(<scope>): <subject> — enforced by commitlint + husky.

  • type: feat|fix|refactor|style|chore|doc|test|perf|build|ci
  • scope: package/app name (optional, lower-case)
  • subject: imperative, no capital start, no trailing period
  • Header ≤100 chars; body/footer lines ≤100 chars

Tooling

  • oxlint — lint (.oxlintrc.json). Suppress with // oxlint-disable-next-line <rule> -- <reason>.
  • oxfmt — format (.oxfmtrc.json): 2-space indent, printWidth: 80, single quotes; sorts imports, Tailwind classes and package.json.
  • tsdown — build tool per package (tsdown.config.ts).
  • Turborepo — build graph; ^build = build deps first.
  • New packages → add to scripts/package-build-order.mjs.

Coding Rules (for final code)

That codebase apply a strict high code quality standard. For code that is destined to be kept in the codebase, you should validate that points before finishing the task.

  • Use full and clear var name, no abbreviations
  • Use clean and strong typing, no any. Use Generic when possible
  • Add JSDoc, but keep comment as concise as possible
  • Use arrow functions
  • Implement and test unit test when applicable and run bun test
  • Assume dev server running; if not, wait 5sec, then 10sec, then 15sec, check output last save timestamp. If not updated, build manually.
  • Always check if there functions that already exists in the project before creating a new one.