Skip to content

Commit d422219

Browse files
committed
chore: add Claude files
1 parent 6cda850 commit d422219

3 files changed

Lines changed: 163 additions & 1 deletion

File tree

.claude/skills/release.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
name: release
3+
description: Create a changeset, commit, push, and open a PR for releasing packages
4+
user_invocable: true
5+
---
6+
7+
# Release Skill
8+
9+
When the user invokes `/release`, follow these steps:
10+
11+
## Step 1: Determine the branch
12+
13+
- Run `git branch --show-current` to get the current branch.
14+
- If on `master`, create a new branch based on the changes:
15+
- Check `git diff master --name-only` and `git log master --oneline` to understand what changed.
16+
- Create a meaningful branch name like `fix/short-description` or `feat/short-description`.
17+
- Run `git checkout -b <branch-name>`.
18+
- If already on a dev branch, continue on it.
19+
20+
## Step 2: Analyze changes
21+
22+
- Run `git diff master...HEAD --stat` and `git log master...HEAD --oneline` to understand all changes since master.
23+
- Determine the appropriate bump type:
24+
- `patch` for bug fixes
25+
- `minor` for new features (backwards compatible)
26+
- `major` for breaking changes
27+
- Identify which packages are affected by checking which `packages/*/` directories have changes.
28+
29+
## Step 3: Create changeset
30+
31+
- Create a markdown file in `.changeset/` with a descriptive kebab-case filename (e.g., `fix-form-useform-hook.md`).
32+
- Use this format:
33+
34+
```markdown
35+
---
36+
"@tiny-design/react": patch
37+
---
38+
39+
Short description of the change
40+
```
41+
42+
- Only include packages that actually have code changes (not `@tiny-design/docs` as it's ignored in changeset config).
43+
- Note: packages `@tiny-design/react`, `@tiny-design/icons`, and `@tiny-design/tokens` are in a fixed version group — they version together.
44+
45+
## Step 4: Commit the changeset
46+
47+
- Stage only the changeset file: `git add .changeset/<filename>.md`
48+
- Commit with message: `chore: add changeset for <summary>`
49+
50+
## Step 5: Push to remote
51+
52+
- Push the branch: `git push -u origin <branch-name>`
53+
54+
## Step 6: Create a Pull Request
55+
56+
- Use `gh pr create` to open a PR targeting `master`.
57+
- Title should follow the commit convention: `fix(react): ...` or `feat(react): ...`
58+
- Body should include:
59+
- `## Summary` — bullet points describing the changes
60+
- `## Release` — the bump type and affected packages
61+
- `## Test plan` — how to verify the changes

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ apps/docs/build
2020
.DS_Store
2121

2222
# Claude
23-
.claude
23+
!.claude
24+
.claude/*
25+
!.claude/skills/
2426

2527
# Misc
2628
*.tgz

CLAUDE.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# CLAUDE.md
2+
3+
## Project Overview
4+
5+
Tiny Design is a React component UI library (80+ components) published as `@tiny-design/react`. It's a pnpm monorepo managed with Turborepo.
6+
7+
## Monorepo Layout
8+
9+
```
10+
packages/react/ → @tiny-design/react (main component library)
11+
packages/tokens/ → @tiny-design/tokens (design tokens, SCSS variables)
12+
packages/icons/ → @tiny-design/icons (SVG icon components)
13+
apps/docs/ → documentation site (Vite + MDX)
14+
```
15+
16+
All three publishable packages use **fixed versioning** — they always share the same version number.
17+
18+
## Common Commands
19+
20+
```bash
21+
pnpm install # Install dependencies
22+
pnpm dev # Start docs dev server
23+
pnpm build # Build all packages (turborepo handles dependency order: tokens → react → docs)
24+
pnpm test # Run all tests
25+
pnpm lint # ESLint across all packages
26+
pnpm lint:style # Stylelint for SCSS files
27+
```
28+
29+
### Scoped Commands
30+
31+
```bash
32+
pnpm --filter @tiny-design/react test -- --testPathPattern=button # Test a single component
33+
pnpm --filter @tiny-design/react test:update # Update snapshots
34+
pnpm --filter @tiny-design/react test:coverage # Coverage report
35+
```
36+
37+
## Component Structure
38+
39+
Every component in `packages/react/src/` follows this layout:
40+
41+
```
42+
component-name/
43+
├── component-name.tsx # Implementation (React.forwardRef, function components)
44+
├── types.ts # Props interfaces
45+
├── index.tsx # Barrel export
46+
├── index.md # English docs
47+
├── index.zh_CN.md # Chinese docs
48+
├── style/
49+
│ ├── _index.scss # Styles (SCSS partial)
50+
│ └── index.tsx # Style entry point
51+
├── demo/
52+
│ └── basic.tsx # Usage examples
53+
└── __tests__/
54+
└── component-name.test.tsx
55+
```
56+
57+
When adding a new component:
58+
1. Create its directory under `packages/react/src/`
59+
2. Export it from `packages/react/src/index.ts`
60+
3. Add a route in `apps/docs/src/routers.tsx`
61+
62+
## Code Conventions
63+
64+
- **TypeScript strict mode** is enabled
65+
- **CSS class prefix**: `ty-` (e.g., `.ty-btn`, `.ty-modal`), customizable via `ConfigProvider`
66+
- **BEM-ish naming**: `ty-component`, `ty-component__element`, `ty-component_modifier`
67+
- **Ref forwarding**: all components use `React.forwardRef`
68+
- **Props pattern**: extend `BaseProps` (style, className, prefixCls) + intrinsic element props
69+
- **Formatting**: Prettier — single quotes, semicolons, 100 char width, 2-space indent
70+
- **Commits**: Conventional Commits — `feat(button): add loading state`, `fix(modal): prevent scroll`
71+
- **Pre-commit hook**: husky + lint-staged auto-fixes SCSS via stylelint
72+
73+
## Testing
74+
75+
- **Framework**: Jest + @testing-library/react + @testing-library/jest-dom
76+
- **Config**: `packages/react/jest.config.js` (ts-jest, jsdom environment)
77+
- Tests live in `__tests__/` within each component directory
78+
79+
## Build Pipeline
80+
81+
The react package build (`packages/react`):
82+
1. `tsdown` — transpiles TS → JS (ESM in `es/`, CJS in `lib/`), generates `.d.ts`
83+
2. `build-styles.js` — compiles component SCSS → CSS via Sass + PostCSS
84+
3. `inject-style-imports.js` — adds CSS imports into JS entry files
85+
86+
## Changesets & Releases
87+
88+
- Use `pnpm changeset` to create a changeset file in `.changeset/`
89+
- On merge to `master`, CI creates a "Version Packages" PR
90+
- Merging that PR publishes to npm and deploys the docs site
91+
- `@tiny-design/docs` is excluded from npm publishing
92+
93+
## Key Dependencies
94+
95+
- React 18.2+, TypeScript 5.4
96+
- Popper.js (`@popperjs/core`) for positioning (tooltips, dropdowns, popovers)
97+
- `react-transition-group` for animations
98+
- `classnames` for conditional class construction
99+
- Node.js >= 22, pnpm 10.x

0 commit comments

Comments
 (0)