Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/hydrogen
24.19.0
2 changes: 0 additions & 2 deletions .prettierignore

This file was deleted.

5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

1 change: 1 addition & 0 deletions .rstack/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rs staged
7 changes: 6 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { pluginReact } from '@rsbuild/plugin-react';
import { pluginSass } from '@rsbuild/plugin-sass';
import type { StorybookConfig } from 'storybook-react-rsbuild';

const config: StorybookConfig = {
framework: 'storybook-react-rsbuild',
stories: ['../stories/**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-themes', 'storybook-addon-rslib'],
addons: ['@storybook/addon-themes'],
rsbuildFinal(config) {
config.plugins ??= [];
config.plugins.push(pluginReact(), pluginSass());

config.source ??= {};
config.source.define = {
...config.source.define,
Expand Down
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"recommendations": [
"rstack.rstack",
"styled-components.vscode-styled-components",
"EditorConfig.editorconfig",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"streetsidesoftware.code-spell-checker",
"codezombiech.gitignore",
"aaron-bond.better-comments",
Expand Down
14 changes: 2 additions & 12 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@
"files.insertFinalNewline": true,
//
"cSpell.diagnosticLevel": "Hint",
"eslint.run": "onType",
"eslint.probe": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue"
],
"eslint.format.enable": true,
"eslint.lintTask.enable": true,
"javascript.validate.enable": false,
"typescript.validate.enable": true,
"css.validate": false,
Expand All @@ -53,9 +43,9 @@
"editor.formatOnSave": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
"source.fixAll.rslint": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "rstack.rstack",
"javascript.format.enable": false,
"typescript.format.enable": false,
//
Expand Down
74 changes: 36 additions & 38 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,68 +4,68 @@ Shared UI component library (`@rstackjs/doc-ui`) for Rstack websites (rspack.rs,

## Tech Stack

- React 18 + TypeScript 5.9 (strict mode)
- Build: Rslib (based on Rsbuild)
- React 19 + TypeScript 7 (strict mode)
- Toolchain: Rstack CLI (`rs lib`, Rstest, Rslint, and formatting)
- Styling: SCSS Modules (`.module.scss`)
- Animation: Framer Motion, Lottie
- UI: Ant Design 6
- Dev: Storybook 10

For Rstack CLI behavior:

- Read the docs linked from `node_modules/rstack/docs/llms.txt` when needed
- Online docs: https://rstack.rs/llms.txt
- Run `rs -h` for CLI help

## Commands

```bash
# Development
pnpm dev # Start Storybook (port 6006)

# Build
pnpm build # Build with Rslib
pnpm build:watch # Watch mode

# Lint (prefer file-scoped)
pnpm lint # Check all with Rslint + Prettier
pnpm lint:write # Auto-fix
pnpm lint:fix # Alias for lint:write
# Build and test
pnpm build # Build the library with Rstack CLI
pnpm build:watch # Build in watch mode
pnpm test # Run Rstest

# Single file commands
npx tsc --noEmit 'path/to/file.tsx'
npx prettier --write 'path/to/file.tsx'
npx rslint --fix 'path/to/file.tsx'
# Checks and formatting
pnpm check # Run lint and formatting checks
pnpm lint # Run Rslint
pnpm format # Format files
```

No test framework - visual testing via Storybook.

## Project Structure

```
src/
├── announcement/ # Announcement banner
├── antd/ # Ant Design wrappers
├── background-image/ # Background component
├── benchmark/ # Benchmark display
├── built-with-rspack/ # Showcase component
├── fully-featured/ # Feature list
├── hero/ # Hero section
├── nav-icon/ # Nav icon with popover
├── section-style/ # Section utilities
├── tool-stack/ # Tool stack display
├── why-rspack/ # Feature cards
├── env.d.ts # Type declarations
└── shared.tsx # Shared utilities

stories/ # Storybook stories
├── antd/ # Ant Design wrappers
├── background-image/ # Background component
├── benchmark/ # Benchmark display
├── built-with-rspack/ # Showcase component
├── fully-featured/ # Feature list
├── hero/ # Hero section
├── nav-icon/ # Nav icon with popover
├── section-style/ # Section utilities
├── tool-stack/ # Tool stack display
├── why-rspack/ # Feature cards
├── env.d.ts # Type declarations
└── shared.tsx # Shared utilities

stories/ # Storybook stories
```

## Code Style

### Formatting (Prettier - `.prettierrc`)
### Formatting (`define.fmt` in `rstack.config.ts`)

- Single quotes, trailing commas (`all`), no parens for single arrow params

### Linting (Rslint - `rslint.config.ts`)
### Linting (`define.lint` in `rstack.config.ts`)

- Rslint uses TypeScript and React recommended rules
- `@typescript-eslint/no-explicit-any`: off
- Prettier handles formatting
- `react/react-in-jsx-scope`: off

### TypeScript

Expand Down Expand Up @@ -154,16 +154,14 @@ export default { title: 'Hero' };

## Git Hooks

Pre-commit via `simple-git-hooks`:

- `pnpm run lint:write`
Rstack CLI installs repository hooks from `.rstack/hooks`. The pre-commit hook runs `rs staged`.

## Adding Components

1. Create `src/component-name/index.tsx`
2. Add `src/component-name/index.module.scss`
3. Add entry in `rslib.config.ts`
4. Add export in `package.json` exports
3. Add an entry in `rstack.config.ts`
4. Add an export in `package.json` exports
5. Create `stories/ComponentName.stories.tsx`

## External Dependencies
Expand Down
44 changes: 17 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"name": "@rstackjs/doc-ui",
"version": "1.14.11",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/rstackjs/rstack-doc-ui"
},
"license": "MIT",
"packageManager": "pnpm@11.24.0",
"type": "module",
"exports": {
"./nav-icon": {
"types": "./dist/nav-icon/index.d.ts",
Expand Down Expand Up @@ -71,42 +74,30 @@
},
"./theme.css": "./dist/theme/index.css"
},
"repository": {
"type": "git",
"url": "https://github.com/rstackjs/rstack-doc-ui"
},
"files": [
"dist"
],
"scripts": {
"dev": "pnpm run storybook",
"build": "rs lib",
"build:watch": "rs lib -w",
"build-storybook": "storybook build",
"storybook": "storybook dev -p 6006",
"prepare": "simple-git-hooks",
"build": "rslib",
"build:watch": "rslib -w",
"test": "rstest",
"lint": "rslint && prettier -c .",
"lint:write": "rslint --fix && prettier -w .",
"lint:fix": "pnpm lint:write",
"bump": "npx bumpp",
"chromatic": "chromatic"
},
"simple-git-hooks": {
"pre-commit": "pnpm run lint:write"
"check": "rs check",
"chromatic": "chromatic",
"dev": "pnpm run storybook",
"format": "rs fmt",
"lint": "rs lint",
"prepare": "rs hooks",
"storybook": "storybook dev -p 6006",
"test": "rs test"
},
"devDependencies": {
"@rsbuild/plugin-react": "2.1.0",
"@rsbuild/plugin-sass": "2.0.1",
"@rslib/core": "^0.23.2",
"@rslint/core": "^0.9.0",
"@rspress/core": "^2.0.21",
"@rstackjs/doc-ui": "workspace:*",
"@rstest/adapter-rslib": "^0.11.11",
"@rstest/core": "^0.11.11",
"@storybook/addon-themes": "^10.5.10",
"@storybook/react": "^10.5.10",
"@storybook/test": "9.0.0-alpha.2",
"@types/node": "~24.13.3",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.5",
Expand All @@ -115,15 +106,13 @@
"execa": "9.6.1",
"fs-extra": "11.4.0",
"lottie-web": "5.13.0",
"prettier": "~3.9.6",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"react-render-to-markdown": "^19.1.0",
"rimraf": "~6.1.3",
"rstack": "^0.7.2",
"semver": "7.8.5",
"simple-git-hooks": "^2.14.0",
"storybook": "^10.5.10",
"storybook-addon-rslib": "^3.4.2",
"storybook-react-rsbuild": "^3.4.2",
"typescript": "~7.0.2"
},
Expand All @@ -135,6 +124,7 @@
"optional": true
}
},
"packageManager": "pnpm@11.24.0",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
Expand Down
Loading