js-development
JavaScript/TypeScript development guidelines for PhotoClove. IMPORTANT - This project uses pnpm (not npm or yarn). Use this skill when installing packages, running scripts, or managing dependencies.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
JavaScript Development
PhotoClove uses pnpm as its package manager. Never use npm or yarn.
Package Manager: pnpm
CRITICAL: This project uses pnpm, not npm or yarn.
Common Commands
| Task | Command |
|---|---|
| Install all dependencies | pnpm install |
| Add a package | pnpm add <package> |
| Add a dev dependency | pnpm add -D <package> |
| Remove a package | pnpm remove <package> |
| Run a script | pnpm run <script> or pnpm <script> |
| Update packages | pnpm update |
| Check outdated | pnpm outdated |
Build & Development
# Development server (frontend only)
pnpm dev
# Build for production
pnpm build
# Run Tauri development (full app)
pnpm tauri dev
# Build Tauri app
pnpm tauri build
Vite Commands
# Build with vite directly
pnpm vite build
# Development build (for debugging)
pnpm vite build --mode development
# Preview production build
pnpm vite preview
Project Structure
/
├── src/ # Frontend (React/Vite)
│ ├── App/ # Main application components
│ ├── components/ # Reusable components
│ ├── context/ # React contexts
│ ├── domain/ # Domain models
│ ├── hooks/ # Custom hooks
│ ├── services/ # Service layer
│ └── styles/ # CSS files
├── src-tauri/ # Backend (Rust/Tauri)
├── public/ # Static assets
├── package.json # pnpm package config
└── pnpm-lock.yaml # pnpm lockfile
Frontend Tech Stack
- Framework: React 18
- Build Tool: Vite 4.x
- Desktop: Tauri 2.x
- State: React Context + custom hooks
- Styling: CSS Modules + CSS Variables
Common Development Tasks
Adding a New Component
- Create component file:
src/components/ComponentName.jsx - Create CSS Module:
src/components/ComponentName.module.css - Use CSS variables from
src/styles/base.css - Import and use in parent component
Running Tests
# Run tests (if configured)
pnpm test
# Run specific test file
pnpm test src/test/ViewMode.test.js
Type Checking (if using TypeScript)
pnpm tsc --noEmit
Troubleshooting
"Module not found" errors
# Clear node_modules and reinstall
rm -rf node_modules
pnpm install
Lock file conflicts
# Regenerate lock file
rm pnpm-lock.yaml
pnpm install
Cache issues
# Clear pnpm cache
pnpm store prune
Important Reminders
-
Always use pnpm - Never use
npmoryarncommands - Check package.json - Before adding new dependencies
- Use CSS variables - Never hardcode colors/sizes
- Use CSS Modules - For component-specific styles
-
Follow logging standards - Use
loggerservice, notconsole.log
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!