@tscircuit/fake-snippets 0.0.106 → 0.0.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +92 -0
- package/api/generated-index.js +2 -3
- package/dist/bundle.js +339 -413
- package/dist/index.d.ts +5 -0
- package/dist/index.js +24 -5
- package/dist/schema.d.ts +8 -0
- package/dist/schema.js +3 -1
- package/fake-snippets-api/lib/db/db-client.ts +9 -0
- package/fake-snippets-api/lib/db/schema.ts +3 -0
- package/fake-snippets-api/lib/db/seed.ts +17 -3
- package/fake-snippets-api/routes/api/package_builds/list.ts +0 -1
- package/package.json +3 -2
- package/src/App.tsx +19 -4
- package/src/components/PackageBreadcrumb.tsx +111 -0
- package/src/components/ViewPackagePage/components/sidebar-releases-section.tsx +17 -7
- package/src/components/preview/BuildsList.tsx +74 -168
- package/src/components/preview/ConnectedPackagesList.tsx +22 -5
- package/src/components/preview/ConnectedRepoOverview.tsx +12 -2
- package/src/components/preview/{ConnectedRepoDashboard.tsx → PackageReleasesDashboard.tsx} +30 -74
- package/src/components/preview/index.tsx +7 -4
- package/src/hooks/use-package-builds.ts +0 -48
- package/src/hooks/use-package-release-by-id-or-version.ts +36 -0
- package/src/hooks/use-package-release.ts +32 -0
- package/src/lib/utils/isUuid.ts +5 -0
- package/src/pages/preview-build.tsx +3 -3
- package/src/pages/release-builds.tsx +107 -0
- package/src/pages/release-detail.tsx +118 -0
- package/src/pages/releases.tsx +51 -0
- package/fake-snippets-api/routes/api/package_builds/latest.ts +0 -109
- package/src/pages/view-connected-repo.tsx +0 -49
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
tscircuit.com is a React-based web application for creating, sharing, and managing electronic circuit designs using TypeScript and React. It features a circuit editor, package management system, AI-assisted design tools, and visualization of PCB layouts and 3D models.
|
|
8
|
+
|
|
9
|
+
## Development Commands
|
|
10
|
+
|
|
11
|
+
- `bun run dev` - Start development server (builds fake API and runs on localhost:5173)
|
|
12
|
+
- `bun run build` - Full production build (generates images, sitemap, builds fake API, compiles TypeScript, and builds with Vite)
|
|
13
|
+
- `bun run typecheck` - Run TypeScript type checking without emitting files
|
|
14
|
+
- `bun run format` - Format code using Biome
|
|
15
|
+
- `bun run lint` - Check code formatting with Biome
|
|
16
|
+
- `bun run playwright` - Run Playwright end-to-end tests
|
|
17
|
+
- `bun run playwright:update` - Update Playwright test snapshots
|
|
18
|
+
- `bun run snapshot` - Interactive snapshot updating tool (prompts for specific test file)
|
|
19
|
+
|
|
20
|
+
### Fake API Development
|
|
21
|
+
- `bun run build:fake-api` - Build the complete fake API (TypeScript compilation, bundle generation, schema building)
|
|
22
|
+
- `bun run dev:registry` - Run dev server using registry API at localhost:3100
|
|
23
|
+
|
|
24
|
+
## Architecture
|
|
25
|
+
|
|
26
|
+
### Frontend Structure
|
|
27
|
+
- **React SPA** with Vite bundler, using Wouter for routing and lazy-loaded pages
|
|
28
|
+
- **State Management**: Zustand for global state, React Query for server state
|
|
29
|
+
- **UI Framework**: Tailwind CSS with Radix UI components and custom shadcn/ui components
|
|
30
|
+
- **Code Editor**: CodeMirror 6 with TypeScript support and AI completion
|
|
31
|
+
|
|
32
|
+
### API Architecture
|
|
33
|
+
- **Fake API**: Development API built with Winterspec, providing full backend simulation
|
|
34
|
+
- **Database Schema**: Zod-validated schemas for packages, builds, releases, snippets, accounts, orders
|
|
35
|
+
- **Authentication**: Session-based auth with GitHub integration
|
|
36
|
+
|
|
37
|
+
### Key Domains
|
|
38
|
+
- **Packages**: Reusable circuit components with versioning and releases
|
|
39
|
+
- **Package Builds**: Compilation artifacts with build status and logs
|
|
40
|
+
- **Package Releases**: Published versions with metadata and assets
|
|
41
|
+
- **Snippets**: Legacy circuit designs (being migrated to packages)
|
|
42
|
+
- **Circuit JSON**: Standard format for circuit data interchange
|
|
43
|
+
|
|
44
|
+
### File Organization
|
|
45
|
+
- `src/components/` - Reusable UI components
|
|
46
|
+
- `src/pages/` - Route-based page components
|
|
47
|
+
- `src/hooks/` - Custom React hooks for data fetching and state
|
|
48
|
+
- `src/lib/` - Utilities, constants, and helper functions
|
|
49
|
+
- `fake-snippets-api/` - Mock API implementation with Winterspec
|
|
50
|
+
- `playwright-tests/` - End-to-end tests with visual regression snapshots
|
|
51
|
+
|
|
52
|
+
## Testing Strategy
|
|
53
|
+
|
|
54
|
+
Uses Playwright for end-to-end testing with visual regression snapshots. Tests cover critical user flows including editor functionality, package management, authentication, and responsive design across viewport sizes.
|
|
55
|
+
|
|
56
|
+
## Key Technical Patterns
|
|
57
|
+
|
|
58
|
+
### Data Fetching
|
|
59
|
+
- React Query for server state with custom hooks (use-package-*, use-snippet-*, etc.)
|
|
60
|
+
- Fake API provides development backend with realistic data simulation
|
|
61
|
+
- SSR support via Vercel for SEO and performance
|
|
62
|
+
|
|
63
|
+
### Circuit Visualization
|
|
64
|
+
- Multiple viewers: PCB viewer, schematic viewer, 3D viewer, assembly viewer
|
|
65
|
+
- SVG-based rendering with interactive controls
|
|
66
|
+
- Real-time preview updates during code editing
|
|
67
|
+
|
|
68
|
+
### Code Compilation
|
|
69
|
+
- TypeScript compilation in browser using Monaco/TypeScript compiler API
|
|
70
|
+
- Circuit JSON generation from TypeScript code
|
|
71
|
+
- Error handling and display for compilation issues
|
|
72
|
+
|
|
73
|
+
### Package Management
|
|
74
|
+
- Package files with hierarchical structure
|
|
75
|
+
- Build artifacts and release management
|
|
76
|
+
- GitHub integration for repository linking
|
|
77
|
+
|
|
78
|
+
## Environment Variables
|
|
79
|
+
|
|
80
|
+
Development AI testing requires:
|
|
81
|
+
```bash
|
|
82
|
+
VITE_USE_DIRECT_AI_REQUESTS=true
|
|
83
|
+
VITE_ANTHROPIC_API_KEY=<your-key-here>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Build Tools
|
|
87
|
+
|
|
88
|
+
- **Bundler**: Vite with React plugin and image optimization
|
|
89
|
+
- **TypeScript**: Strict mode with path aliases (@/* → src/*)
|
|
90
|
+
- **Styling**: Tailwind CSS with custom design tokens
|
|
91
|
+
- **Code Quality**: Biome for formatting and linting
|
|
92
|
+
- **Package Manager**: Bun for fast installs and script execution
|
package/api/generated-index.js
CHANGED
|
@@ -31,7 +31,7 @@ const PREFETCHABLE_PAGES = new Set([
|
|
|
31
31
|
"latest",
|
|
32
32
|
"settings",
|
|
33
33
|
"quickstart",
|
|
34
|
-
"
|
|
34
|
+
"releases",
|
|
35
35
|
])
|
|
36
36
|
|
|
37
37
|
const pageDescriptions = {
|
|
@@ -51,8 +51,7 @@ const pageDescriptions = {
|
|
|
51
51
|
"Get started quickly with tscircuit. Create new circuit packages, import components from JLCPCB, or start from templates to begin your electronic design journey.",
|
|
52
52
|
settings:
|
|
53
53
|
"Manage your tscircuit account settings, shipping information, and preferences for electronic design and PCB ordering.",
|
|
54
|
-
"
|
|
55
|
-
"View and manage your connected repositories. Monitor repository status, access build information, and configure build options.",
|
|
54
|
+
releases: "View all package releases, access build information.",
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
function getPageDescription(pageName) {
|