@tscircuit/fake-snippets 0.0.1
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/.github/CODEOWNERS +1 -0
- package/.github/workflows/bun-formatcheck.yml +26 -0
- package/.github/workflows/bun-test.yml +28 -0
- package/.github/workflows/bun-typecheck.yml +26 -0
- package/.github/workflows/bundle-size-analysis.yml +79 -0
- package/.github/workflows/playwright-test.yml +37 -0
- package/.github/workflows/stale.yml +40 -0
- package/.github/workflows/update-snapshots.yml +49 -0
- package/CONTRIBUTING.md +59 -0
- package/LICENSE +21 -0
- package/README.md +113 -0
- package/biome.json +60 -0
- package/bun-tests/fake-snippets-api/fixtures/get-circuit-json.ts +148 -0
- package/bun-tests/fake-snippets-api/fixtures/get-test-server.ts +96 -0
- package/bun-tests/fake-snippets-api/fixtures/start-server.ts +44 -0
- package/bun-tests/fake-snippets-api/routes/accounts/get_account_balance.test.ts +18 -0
- package/bun-tests/fake-snippets-api/routes/health.test.ts +9 -0
- package/bun-tests/fake-snippets-api/routes/order_files/get.test.ts +48 -0
- package/bun-tests/fake-snippets-api/routes/order_files/upload.test.ts +77 -0
- package/bun-tests/fake-snippets-api/routes/orders/create.test.ts +19 -0
- package/bun-tests/fake-snippets-api/routes/orders/get.test.ts +38 -0
- package/bun-tests/fake-snippets-api/routes/orders/list.test.ts +30 -0
- package/bun-tests/fake-snippets-api/routes/orders/update.test.ts +46 -0
- package/bun-tests/fake-snippets-api/routes/snippets/add_star.test.ts +114 -0
- package/bun-tests/fake-snippets-api/routes/snippets/create.test.ts +28 -0
- package/bun-tests/fake-snippets-api/routes/snippets/delete.test.ts +106 -0
- package/bun-tests/fake-snippets-api/routes/snippets/download.test.ts +90 -0
- package/bun-tests/fake-snippets-api/routes/snippets/generate_from_jlcpcb.test.ts +25 -0
- package/bun-tests/fake-snippets-api/routes/snippets/get_image.test.ts +113 -0
- package/bun-tests/fake-snippets-api/routes/snippets/images.test.ts +112 -0
- package/bun-tests/fake-snippets-api/routes/snippets/list.test.ts +62 -0
- package/bun-tests/fake-snippets-api/routes/snippets/list_newest.test.ts +48 -0
- package/bun-tests/fake-snippets-api/routes/snippets/list_trending.test.ts +69 -0
- package/bun-tests/fake-snippets-api/routes/snippets/remove_star.test.ts +110 -0
- package/bun-tests/fake-snippets-api/routes/snippets/search.test.ts +75 -0
- package/bun-tests/fake-snippets-api/routes/snippets/star-count.test.ts +44 -0
- package/bun-tests/fake-snippets-api/routes/snippets/update.test.ts +116 -0
- package/bun-tests/parts-engine.test.ts +18 -0
- package/bun.lockb +0 -0
- package/bunfig.toml +2 -0
- package/components.json +20 -0
- package/dist/assets/editor_example_1-1000w.webp +0 -0
- package/dist/assets/editor_example_1-1200w.webp +0 -0
- package/dist/assets/editor_example_1-1600w.webp +0 -0
- package/dist/assets/editor_example_1-2000w.webp +0 -0
- package/dist/assets/editor_example_1-400w.webp +0 -0
- package/dist/assets/editor_example_1-600w.webp +0 -0
- package/dist/assets/editor_example_1-800w.webp +0 -0
- package/dist/assets/editor_example_1_more_square-1000w.webp +0 -0
- package/dist/assets/editor_example_1_more_square-1200w.webp +0 -0
- package/dist/assets/editor_example_1_more_square-1600w.webp +0 -0
- package/dist/assets/editor_example_1_more_square-2000w.webp +0 -0
- package/dist/assets/editor_example_1_more_square-400w.webp +0 -0
- package/dist/assets/editor_example_1_more_square-600w.webp +0 -0
- package/dist/assets/editor_example_1_more_square-800w.webp +0 -0
- package/dist/assets/editor_example_2-1000w.webp +0 -0
- package/dist/assets/editor_example_2-1200w.webp +0 -0
- package/dist/assets/editor_example_2-1600w.webp +0 -0
- package/dist/assets/editor_example_2-2000w.webp +0 -0
- package/dist/assets/editor_example_2-400w.webp +0 -0
- package/dist/assets/editor_example_2-600w.webp +0 -0
- package/dist/assets/editor_example_2-800w.webp +0 -0
- package/dist/assets/example_schematic-1000w.webp +0 -0
- package/dist/assets/example_schematic-1200w.webp +0 -0
- package/dist/assets/example_schematic-1600w.webp +0 -0
- package/dist/assets/example_schematic-2000w.webp +0 -0
- package/dist/assets/example_schematic-400w.webp +0 -0
- package/dist/assets/example_schematic-600w.webp +0 -0
- package/dist/assets/example_schematic-800w.webp +0 -0
- package/dist/bundle.js +3270 -0
- package/dist/robots.txt +9 -0
- package/dist/sitemap.xml +118 -0
- package/docs/CIRCUIT_JSON_SOURCE_COMPONENT_OVERVIEW.md +151 -0
- package/fake-snippets-api/README.md +6 -0
- package/fake-snippets-api/biome.json +47 -0
- package/fake-snippets-api/bun.lockb +0 -0
- package/fake-snippets-api/lib/db/autoload-dev-snippets.ts +84 -0
- package/fake-snippets-api/lib/db/autoload-snippets.json +24 -0
- package/fake-snippets-api/lib/db/db-client.ts +343 -0
- package/fake-snippets-api/lib/db/schema.ts +112 -0
- package/fake-snippets-api/lib/db/seed.ts +1608 -0
- package/fake-snippets-api/lib/middleware/with-ctx-error.ts +26 -0
- package/fake-snippets-api/lib/middleware/with-db.ts +15 -0
- package/fake-snippets-api/lib/middleware/with-error-handling.ts +24 -0
- package/fake-snippets-api/lib/middleware/with-optional-session-auth.ts +34 -0
- package/fake-snippets-api/lib/middleware/with-request-logging.ts +54 -0
- package/fake-snippets-api/lib/middleware/with-session-auth.ts +39 -0
- package/fake-snippets-api/lib/middleware/with-winter-spec.ts +24 -0
- package/fake-snippets-api/next-env.d.ts +5 -0
- package/fake-snippets-api/routes/api/accounts/get.ts +21 -0
- package/fake-snippets-api/routes/api/accounts/get_account_balance.ts +22 -0
- package/fake-snippets-api/routes/api/accounts/update.ts +32 -0
- package/fake-snippets-api/routes/api/ai/[...anyroute].ts +31 -0
- package/fake-snippets-api/routes/api/ai.ts +2 -0
- package/fake-snippets-api/routes/api/aistream/[...anyroute].ts +65 -0
- package/fake-snippets-api/routes/api/health.ts +9 -0
- package/fake-snippets-api/routes/api/internal/sessions/create_without_auth.ts +63 -0
- package/fake-snippets-api/routes/api/order_files/get.ts +28 -0
- package/fake-snippets-api/routes/api/order_files/upload.ts +43 -0
- package/fake-snippets-api/routes/api/orders/create.ts +41 -0
- package/fake-snippets-api/routes/api/orders/get.ts +28 -0
- package/fake-snippets-api/routes/api/orders/list.ts +15 -0
- package/fake-snippets-api/routes/api/orders/update.ts +50 -0
- package/fake-snippets-api/routes/api/snippets/add_star.ts +42 -0
- package/fake-snippets-api/routes/api/snippets/create.ts +55 -0
- package/fake-snippets-api/routes/api/snippets/delete.ts +41 -0
- package/fake-snippets-api/routes/api/snippets/download.ts +148 -0
- package/fake-snippets-api/routes/api/snippets/generate_from_jlcpcb.ts +55 -0
- package/fake-snippets-api/routes/api/snippets/get.ts +50 -0
- package/fake-snippets-api/routes/api/snippets/get_image.ts +65 -0
- package/fake-snippets-api/routes/api/snippets/images/[author]/[snippet_name]/[typeFormat].ts +74 -0
- package/fake-snippets-api/routes/api/snippets/list.ts +28 -0
- package/fake-snippets-api/routes/api/snippets/list_newest.ts +13 -0
- package/fake-snippets-api/routes/api/snippets/list_trending.ts +21 -0
- package/fake-snippets-api/routes/api/snippets/remove_star.ts +42 -0
- package/fake-snippets-api/routes/api/snippets/search.ts +18 -0
- package/fake-snippets-api/routes/api/snippets/update.ts +86 -0
- package/favicon.ico +0 -0
- package/index.html +23 -0
- package/landing.html +23 -0
- package/package.json +164 -0
- package/playwright-tests/ai-page.spec.ts +19 -0
- package/playwright-tests/cmd-click.spec.ts +43 -0
- package/playwright-tests/dashboard-page.spec.ts +10 -0
- package/playwright-tests/editor-page.spec.ts +15 -0
- package/playwright-tests/files-dialog.spec.ts +19 -0
- package/playwright-tests/footprint-dialog/footprint-dialog.spec.ts +27 -0
- package/playwright-tests/footprint-dialog/footprint-insertion.spec.ts +38 -0
- package/playwright-tests/footprint-dialog/footprint-preview.spec.ts +34 -0
- package/playwright-tests/footprint-dialog/footprint-selection.spec.ts +29 -0
- package/playwright-tests/handle-manual-edits.spec.ts +55 -0
- package/playwright-tests/home-page.spec.ts +10 -0
- package/playwright-tests/images.spec.ts +17 -0
- package/playwright-tests/manual-edits.spec.ts +89 -0
- package/playwright-tests/preview-page.spec.ts +14 -0
- package/playwright-tests/quickstart-page.spec.ts +10 -0
- package/playwright-tests/search-links.spec.ts +21 -0
- package/playwright-tests/search.spec.ts +27 -0
- package/playwright-tests/snapshots/ai-page.spec.ts-AI-Page-lg.png +0 -0
- package/playwright-tests/snapshots/ai-page.spec.ts-AI-Page-md.png +0 -0
- package/playwright-tests/snapshots/ai-page.spec.ts-AI-Page-xs.png +0 -0
- package/playwright-tests/snapshots/cmd-click.spec.ts-underlined-imports.png +0 -0
- package/playwright-tests/snapshots/dashboard-page.spec.ts-Dashboard-page-lg.png +0 -0
- package/playwright-tests/snapshots/dashboard-page.spec.ts-Dashboard-page-md.png +0 -0
- package/playwright-tests/snapshots/dashboard-page.spec.ts-Dashboard-page-xs.png +0 -0
- package/playwright-tests/snapshots/editor-page.spec.ts-editor-with-snippet.png +0 -0
- package/playwright-tests/snapshots/error-fallback.spec.ts-error-fallback-lg.png +0 -0
- package/playwright-tests/snapshots/error-fallback.spec.ts-error-fallback-md.png +0 -0
- package/playwright-tests/snapshots/error-fallback.spec.ts-error-fallback-xs.png +0 -0
- package/playwright-tests/snapshots/files-dialog.spec.ts-view-snippet-files.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-lg.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-md.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-xs.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-lg.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-md.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-xs.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-lg.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-md.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-xs.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-lg.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-md.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-xs.png +0 -0
- package/playwright-tests/snapshots/handle-manual-edits.spec.ts-handle-manual-edits.png +0 -0
- package/playwright-tests/snapshots/home-page.spec.ts-Home-page-lg.png +0 -0
- package/playwright-tests/snapshots/home-page.spec.ts-Home-page-md.png +0 -0
- package/playwright-tests/snapshots/home-page.spec.ts-Home-page-xs.png +0 -0
- package/playwright-tests/snapshots/images.spec.ts-pcb-image.png +0 -0
- package/playwright-tests/snapshots/images.spec.ts-schematic-image.png +0 -0
- package/playwright-tests/snapshots/manual-edits.spec.ts-editor-manual-edits.png +0 -0
- package/playwright-tests/snapshots/manual-edits.spec.ts-manual-edits-view.png +0 -0
- package/playwright-tests/snapshots/preview-page.spec.ts-preview-snippet-pcb.png +0 -0
- package/playwright-tests/snapshots/preview-page.spec.ts-preview-snippet-schematic.png +0 -0
- package/playwright-tests/snapshots/quickstart-page.spec.ts-Quickstart-Pagelg.png +0 -0
- package/playwright-tests/snapshots/quickstart-page.spec.ts-Quickstart-Pagemd.png +0 -0
- package/playwright-tests/snapshots/quickstart-page.spec.ts-Quickstart-Pagexs.png +0 -0
- package/playwright-tests/snapshots/search-links.spec.ts-search-links.png +0 -0
- package/playwright-tests/snapshots/search.spec.ts-search-lg.png +0 -0
- package/playwright-tests/snapshots/search.spec.ts-search-md.png +0 -0
- package/playwright-tests/snapshots/search.spec.ts-search-xs.png +0 -0
- package/playwright-tests/snapshots/star.spec.ts-remove-star-button.png +0 -0
- package/playwright-tests/snapshots/star.spec.ts-star-button.png +0 -0
- package/playwright-tests/snapshots/update-description.spec.ts-update-description.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-after-lg.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-after-md.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-after-xs.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-before-lg.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-before-md.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-before-xs.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-files.png +0 -0
- package/playwright-tests/star.spec.ts +40 -0
- package/playwright-tests/update-description.spec.ts +18 -0
- package/playwright-tests/view-snippet.spec.ts +35 -0
- package/playwright-tests/viewports.ts +5 -0
- package/playwright.config.ts +27 -0
- package/postcss.config.js +6 -0
- package/public/robots.txt +9 -0
- package/renovate.json +24 -0
- package/scripts/generate-image-sizes.ts +58 -0
- package/scripts/generate-sitemap.ts +103 -0
- package/scripts/generate_bundle_stats.js +192 -0
- package/scripts/snapshot.ts +35 -0
- package/src/App.tsx +113 -0
- package/src/ContextProviders.tsx +9 -0
- package/src/assets/originals/editor_example_1.webp +0 -0
- package/src/assets/originals/editor_example_1_more_square.webp +0 -0
- package/src/assets/originals/editor_example_2.webp +0 -0
- package/src/assets/originals/example_schematic.webp +0 -0
- package/src/components/AiChatInterface.tsx +221 -0
- package/src/components/AiChatMessage.tsx +86 -0
- package/src/components/Analytics.tsx +30 -0
- package/src/components/BomTable.tsx +69 -0
- package/src/components/ChatInput.tsx +53 -0
- package/src/components/CircuitToSvgWithMouseControl.tsx +78 -0
- package/src/components/CmdKMenu.tsx +301 -0
- package/src/components/CodeAndPreview.tsx +258 -0
- package/src/components/CodeEditor.tsx +460 -0
- package/src/components/CodeEditorHeader.tsx +160 -0
- package/src/components/CreateNewSnippetWithAiHero.tsx +77 -0
- package/src/components/DownloadButtonAndMenu.tsx +212 -0
- package/src/components/EditorNav.tsx +428 -0
- package/src/components/ErrorFallback.tsx +25 -0
- package/src/components/ErrorTabContent.tsx +122 -0
- package/src/components/FAQ.tsx +113 -0
- package/src/components/Footer.tsx +134 -0
- package/src/components/Footer2.tsx +100 -0
- package/src/components/FootprintDialog.tsx +342 -0
- package/src/components/Header.tsx +187 -0
- package/src/components/Header2.tsx +135 -0
- package/src/components/HeaderDropdown.tsx +83 -0
- package/src/components/HeaderLogin.tsx +94 -0
- package/src/components/JLCPCBImportDialog.tsx +155 -0
- package/src/components/LandingHero.tsx +175 -0
- package/src/components/LatestSnippets.tsx +39 -0
- package/src/components/OptimizedImage.tsx +96 -0
- package/src/components/OrderPreviewContent.tsx +61 -0
- package/src/components/ParametersEditor.tsx +140 -0
- package/src/components/PcbViewerWithContainerHeight.tsx +47 -0
- package/src/components/PrefetchPageLink.tsx +45 -0
- package/src/components/PreviewContent.tsx +375 -0
- package/src/components/PreviewEmptyState.tsx +16 -0
- package/src/components/RunButton.tsx +27 -0
- package/src/components/SearchComponent.tsx +163 -0
- package/src/components/ShippingInformationForm.tsx +423 -0
- package/src/components/SnippetLink.tsx +37 -0
- package/src/components/StaticPreviewContent.tsx +89 -0
- package/src/components/StaticViewSnippetHeader.tsx +70 -0
- package/src/components/StaticViewSnippetSidebar.tsx +100 -0
- package/src/components/TableViewer/CircuitJsonTableViewer.tsx +316 -0
- package/src/components/TableViewer/ClickableText.tsx +21 -0
- package/src/components/TableViewer/HeaderCell.tsx +27 -0
- package/src/components/TableViewer/Modal.tsx +39 -0
- package/src/components/TrendingSnippetCarousel.tsx +77 -0
- package/src/components/TypeBadge.tsx +31 -0
- package/src/components/ViewSnippetHeader.tsx +144 -0
- package/src/components/ViewSnippetSidebar.tsx +162 -0
- package/src/components/dialogs/confirm-delete-snippet-dialog.tsx +80 -0
- package/src/components/dialogs/create-order-dialog.tsx +146 -0
- package/src/components/dialogs/create-use-dialog.tsx +34 -0
- package/src/components/dialogs/edit-description-dialog.tsx +96 -0
- package/src/components/dialogs/files-dialog.tsx +70 -0
- package/src/components/dialogs/import-snippet-dialog.tsx +84 -0
- package/src/components/dialogs/rename-snippet-dialog.tsx +81 -0
- package/src/components/dialogs/view-ts-files-dialog.tsx +89 -0
- package/src/components/ui/accordion.tsx +55 -0
- package/src/components/ui/alert-dialog.tsx +139 -0
- package/src/components/ui/alert.tsx +59 -0
- package/src/components/ui/aspect-ratio.tsx +5 -0
- package/src/components/ui/avatar.tsx +48 -0
- package/src/components/ui/badge.tsx +36 -0
- package/src/components/ui/breadcrumb.tsx +118 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/calendar.tsx +73 -0
- package/src/components/ui/card.tsx +76 -0
- package/src/components/ui/carousel.tsx +260 -0
- package/src/components/ui/chart.tsx +363 -0
- package/src/components/ui/checkbox.tsx +28 -0
- package/src/components/ui/collapsible.tsx +9 -0
- package/src/components/ui/combobox.tsx +178 -0
- package/src/components/ui/command.tsx +151 -0
- package/src/components/ui/context-menu.tsx +202 -0
- package/src/components/ui/dialog.tsx +120 -0
- package/src/components/ui/drawer.tsx +116 -0
- package/src/components/ui/dropdown-menu.tsx +203 -0
- package/src/components/ui/form.tsx +182 -0
- package/src/components/ui/hover-card.tsx +27 -0
- package/src/components/ui/input-otp.tsx +69 -0
- package/src/components/ui/input.tsx +25 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/menubar.tsx +238 -0
- package/src/components/ui/navigation-menu.tsx +129 -0
- package/src/components/ui/pagination.tsx +121 -0
- package/src/components/ui/popover.tsx +31 -0
- package/src/components/ui/progress.tsx +26 -0
- package/src/components/ui/radio-group.tsx +42 -0
- package/src/components/ui/resizable.tsx +43 -0
- package/src/components/ui/scroll-area.tsx +46 -0
- package/src/components/ui/searchable-select.tsx +94 -0
- package/src/components/ui/select.tsx +162 -0
- package/src/components/ui/separator.tsx +29 -0
- package/src/components/ui/sheet.tsx +141 -0
- package/src/components/ui/skeleton.tsx +18 -0
- package/src/components/ui/slider.tsx +26 -0
- package/src/components/ui/sonner.tsx +30 -0
- package/src/components/ui/switch.tsx +27 -0
- package/src/components/ui/table.tsx +120 -0
- package/src/components/ui/tabs.tsx +53 -0
- package/src/components/ui/textarea.tsx +24 -0
- package/src/components/ui/toast.tsx +128 -0
- package/src/components/ui/toaster.tsx +33 -0
- package/src/components/ui/toggle-group.tsx +59 -0
- package/src/components/ui/toggle.tsx +43 -0
- package/src/components/ui/tooltip.tsx +28 -0
- package/src/entry-server.tsx +12 -0
- package/src/hooks/use-account-balance.ts +24 -0
- package/src/hooks/use-ai-api.ts +35 -0
- package/src/hooks/use-axios.ts +20 -0
- package/src/hooks/use-code-completion-ai-api.ts +11 -0
- package/src/hooks/use-compiled-tsx.ts +37 -0
- package/src/hooks/use-copy-to-clipboard.ts +26 -0
- package/src/hooks/use-create-snippet-mutation.ts +62 -0
- package/src/hooks/use-current-snippet-id.ts +75 -0
- package/src/hooks/use-current-snippet.ts +24 -0
- package/src/hooks/use-global-store.ts +33 -0
- package/src/hooks/use-is-using-fake-api.ts +3 -0
- package/src/hooks/use-run-tsx/construct-circuit.tsx +64 -0
- package/src/hooks/use-run-tsx/eval-compiled-js.ts +9 -0
- package/src/hooks/use-run-tsx/index.tsx +251 -0
- package/src/hooks/use-save-snippet.ts +66 -0
- package/src/hooks/use-sign-in.ts +22 -0
- package/src/hooks/use-snippet-by-name.ts +25 -0
- package/src/hooks/use-snippet.ts +23 -0
- package/src/hooks/use-snippets-base-api-url.ts +3 -0
- package/src/hooks/use-toast.tsx +208 -0
- package/src/hooks/use-typecheck.ts +54 -0
- package/src/hooks/use-url-params.ts +31 -0
- package/src/hooks/use-warn-user-on-page-change.ts +23 -0
- package/src/hooks/useForkSnippetMutation.ts +52 -0
- package/src/index.css +21 -0
- package/src/lib/__tests__/constants.test.ts +66 -0
- package/src/lib/base64ToBytes.ts +5 -0
- package/src/lib/bytesToBase64.ts +4 -0
- package/src/lib/codemirror/basic-setup.ts +51 -0
- package/src/lib/constants.ts +12 -0
- package/src/lib/decodeUrlHashToText.ts +15 -0
- package/src/lib/defaultCodeForBlankCode.tsx +7 -0
- package/src/lib/download-fns/createBlobURL.ts +4 -0
- package/src/lib/download-fns/download-assembly-svg.ts +12 -0
- package/src/lib/download-fns/download-circuit-json-fn.ts +12 -0
- package/src/lib/download-fns/download-dsn-file-fn.ts +12 -0
- package/src/lib/download-fns/download-fabrication-files.ts +233 -0
- package/src/lib/download-fns/download-gltf.ts +49 -0
- package/src/lib/download-fns/download-kicad-files.ts +27 -0
- package/src/lib/download-fns/download-readable-netlist.ts +12 -0
- package/src/lib/download-fns/download-schematic-svg.ts +12 -0
- package/src/lib/download-fns/download-simple-route-json.ts +17 -0
- package/src/lib/encodeTextToUrlHash.ts +17 -0
- package/src/lib/get-snippet-template.ts +26 -0
- package/src/lib/handleManualEditsImport.tsx +65 -0
- package/src/lib/jlc-parts-engine.ts +69 -0
- package/src/lib/templates/blank-3d-model-template.ts +12 -0
- package/src/lib/templates/blank-circuit-board-template.ts +24 -0
- package/src/lib/templates/blank-footprint-template.ts +29 -0
- package/src/lib/templates/blank-package-template.ts +22 -0
- package/src/lib/templates/blinking-led-board-template.ts +63 -0
- package/src/lib/templates/manual-edits-template.ts +5 -0
- package/src/lib/templates/usb-c-led-flashlight-template.ts +22 -0
- package/src/lib/utils/checkIfManualEditsImported.ts +6 -0
- package/src/lib/utils/getSyntaxError.ts +13 -0
- package/src/lib/utils/index.ts +6 -0
- package/src/lib/utils/load-prettier.ts +18 -0
- package/src/lib/utils/parseFootprintParams.ts +52 -0
- package/src/lib/utils/parseJsonOrNull.ts +8 -0
- package/src/lib/utils/pcbManualEditEventHandler.ts +156 -0
- package/src/main.tsx +10 -0
- package/src/pages/ai.tsx +92 -0
- package/src/pages/authorize.tsx +54 -0
- package/src/pages/dashboard.tsx +165 -0
- package/src/pages/dev-login.tsx +68 -0
- package/src/pages/editor.tsx +28 -0
- package/src/pages/landing.tsx +236 -0
- package/src/pages/my-orders.tsx +54 -0
- package/src/pages/newest.tsx +16 -0
- package/src/pages/preview.tsx +70 -0
- package/src/pages/quickstart.tsx +198 -0
- package/src/pages/search.tsx +26 -0
- package/src/pages/settings.tsx +25 -0
- package/src/pages/user-profile.tsx +97 -0
- package/src/pages/view-order.tsx +123 -0
- package/src/pages/view-snippet.tsx +149 -0
- package/src/prettier.ts +9 -0
- package/src/vite-env.d.ts +1 -0
- package/tailwind.config.js +47 -0
- package/tsconfig.json +30 -0
- package/vercel.json +50 -0
- package/vite.config.ts +146 -0
- package/winterspec.config.ts +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @seveibar @tscircuit/core
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
|
|
2
|
+
name: Format Check
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [main]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
format-check:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v3
|
|
16
|
+
|
|
17
|
+
- name: Setup bun
|
|
18
|
+
uses: oven-sh/setup-bun@v1
|
|
19
|
+
with:
|
|
20
|
+
bun-version: latest
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: bun install
|
|
24
|
+
|
|
25
|
+
- name: Run format check
|
|
26
|
+
run: bun run lint
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
|
|
2
|
+
name: Bun Test
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
pull_request:
|
|
6
|
+
push:
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
timeout-minutes: 5
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout code
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Setup bun
|
|
20
|
+
uses: oven-sh/setup-bun@v1
|
|
21
|
+
with:
|
|
22
|
+
bun-version: latest
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: bun install
|
|
26
|
+
|
|
27
|
+
- name: Run tests
|
|
28
|
+
run: bun test
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
|
|
2
|
+
name: Type Check
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [main]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
type-check:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v3
|
|
16
|
+
|
|
17
|
+
- name: Setup bun
|
|
18
|
+
uses: oven-sh/setup-bun@v1
|
|
19
|
+
with:
|
|
20
|
+
bun-version: latest
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: bun i
|
|
24
|
+
|
|
25
|
+
- name: Run type check
|
|
26
|
+
run: bunx tsc --noEmit
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: Bundle Size Analysis
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- 'package.json'
|
|
8
|
+
- 'bun.lockb'
|
|
9
|
+
- '.github/workflows/bundle-size-analysis.yml'
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
pull-requests: write
|
|
14
|
+
issues: write
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Setup Bun
|
|
23
|
+
uses: oven-sh/setup-bun@v1
|
|
24
|
+
with:
|
|
25
|
+
bun-version: latest
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: bun install
|
|
29
|
+
|
|
30
|
+
- name: Build PR branch with stats
|
|
31
|
+
run: |
|
|
32
|
+
VITE_BUNDLE_ANALYZE=true bun run build --mode production
|
|
33
|
+
|
|
34
|
+
- name: Save stats as artifact
|
|
35
|
+
if: success()
|
|
36
|
+
uses: actions/upload-artifact@v3
|
|
37
|
+
with:
|
|
38
|
+
name: bundle-stats
|
|
39
|
+
path: dist/stats.html
|
|
40
|
+
|
|
41
|
+
- name: Checkout main branch
|
|
42
|
+
uses: actions/checkout@v4
|
|
43
|
+
with:
|
|
44
|
+
ref: main
|
|
45
|
+
path: main-branch
|
|
46
|
+
|
|
47
|
+
- name: Build main branch stats
|
|
48
|
+
run: |
|
|
49
|
+
cd main-branch
|
|
50
|
+
bun install
|
|
51
|
+
VITE_BUNDLE_ANALYZE=true bun run build --mode production
|
|
52
|
+
cd ..
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
- name: Generate bundle stats
|
|
56
|
+
id: bundle-stats
|
|
57
|
+
run: |
|
|
58
|
+
node scripts/generate_bundle_stats.js dist/stats.html main-branch/dist/stats.html
|
|
59
|
+
echo 'STATS_CONTENT<<EOF' >> $GITHUB_ENV
|
|
60
|
+
cat dist/bundle_stats.md >> $GITHUB_ENV
|
|
61
|
+
echo 'EOF' >> $GITHUB_ENV
|
|
62
|
+
|
|
63
|
+
- name: Read and post stats
|
|
64
|
+
if: success()
|
|
65
|
+
uses: mshick/add-pr-comment@v2
|
|
66
|
+
with:
|
|
67
|
+
message: |
|
|
68
|
+
## 📊 Bundle Size Analysis
|
|
69
|
+
|
|
70
|
+
${{ env.STATS_CONTENT }}
|
|
71
|
+
|
|
72
|
+
<details>
|
|
73
|
+
<summary>What is this?</summary>
|
|
74
|
+
This is an automated bundle size report generated during the build process.
|
|
75
|
+
</details>
|
|
76
|
+
proxy-url: https://add-pr-comment-proxy-tscircuit.vercel.app/api
|
|
77
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
78
|
+
allow-repeats: false
|
|
79
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
|
|
2
|
+
name: Playwright Test
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
timeout-minutes: 10
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout code
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Setup bun
|
|
19
|
+
uses: oven-sh/setup-bun@v1
|
|
20
|
+
with:
|
|
21
|
+
bun-version: latest
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: bun install
|
|
25
|
+
|
|
26
|
+
- name: Install Playwright browsers
|
|
27
|
+
run: bunx playwright install
|
|
28
|
+
|
|
29
|
+
- name: Run tests
|
|
30
|
+
run: bun run playwright
|
|
31
|
+
|
|
32
|
+
- uses: actions/upload-artifact@v4
|
|
33
|
+
if: ${{ !cancelled() }}
|
|
34
|
+
with:
|
|
35
|
+
name: test-results
|
|
36
|
+
path: test-results/
|
|
37
|
+
retention-days: 30
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Mark stale issues and pull requests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: '0 0 * * *' # Run daily at midnight UTC
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
stale:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
issues: write
|
|
12
|
+
pull-requests: write
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/stale@v9
|
|
16
|
+
with:
|
|
17
|
+
# Issues config
|
|
18
|
+
days-before-stale: 60
|
|
19
|
+
days-before-close: 7
|
|
20
|
+
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
|
|
21
|
+
close-issue-message: 'This issue has been automatically closed due to inactivity. Please feel free to reopen it if you believe it still needs attention.'
|
|
22
|
+
|
|
23
|
+
# Pull request config
|
|
24
|
+
stale-pr-message: 'This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs.'
|
|
25
|
+
close-pr-message: 'This PR was closed because it has been inactive for 1 day since being marked as stale.'
|
|
26
|
+
days-before-pr-stale: 2
|
|
27
|
+
days-before-pr-close: 1
|
|
28
|
+
|
|
29
|
+
# Labels
|
|
30
|
+
stale-issue-label: 'stale'
|
|
31
|
+
stale-pr-label: 'stale'
|
|
32
|
+
|
|
33
|
+
# Exempt labels
|
|
34
|
+
exempt-issue-labels: 'pinned,security,help wanted,good first issue,bug'
|
|
35
|
+
exempt-pr-labels: 'pinned,security,work in progress'
|
|
36
|
+
|
|
37
|
+
# Additional settings
|
|
38
|
+
exempt-all-milestones: true # Don't mark issues/PRs with milestones as stale
|
|
39
|
+
operations-per-run: 100 # Limit operations per run to avoid hitting API limits
|
|
40
|
+
remove-stale-when-updated: true # Remove stale label when updated
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
name: Update Playwright Snapshots
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment:
|
|
5
|
+
types: [created, edited]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
pull-requests: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
update-snapshots:
|
|
13
|
+
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'update snapshots') }}
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: React to the triggering comment
|
|
18
|
+
run: |
|
|
19
|
+
hub api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions --raw-field 'content=+1'
|
|
20
|
+
env:
|
|
21
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
22
|
+
|
|
23
|
+
- name: Checkout code
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
env:
|
|
26
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
27
|
+
|
|
28
|
+
- name: Setup bun
|
|
29
|
+
uses: oven-sh/setup-bun@v1
|
|
30
|
+
with:
|
|
31
|
+
bun-version: latest
|
|
32
|
+
|
|
33
|
+
- name: Install dependencies
|
|
34
|
+
run: bun install
|
|
35
|
+
|
|
36
|
+
- name: Install Playwright browsers
|
|
37
|
+
run: bunx playwright install
|
|
38
|
+
|
|
39
|
+
- name: Run tests
|
|
40
|
+
run: bun run playwright:update
|
|
41
|
+
|
|
42
|
+
# Commit the changes
|
|
43
|
+
- name: Commit changes
|
|
44
|
+
run: |
|
|
45
|
+
git config --global user.name 'github-actions'
|
|
46
|
+
git config --global user.email 'github-actions@github.com'
|
|
47
|
+
git add playwright-tests/snapshots
|
|
48
|
+
git commit -m 'chore(playwright): update snapshots'
|
|
49
|
+
git push
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Contributing to TSCircuit Snippets
|
|
2
|
+
|
|
3
|
+
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
|
|
4
|
+
|
|
5
|
+
- Reporting a bug
|
|
6
|
+
- Discussing the current state of the code
|
|
7
|
+
- Submitting a fix
|
|
8
|
+
- Proposing new features
|
|
9
|
+
- Becoming a maintainer
|
|
10
|
+
|
|
11
|
+
## We Develop with Github
|
|
12
|
+
|
|
13
|
+
We use github to host code, to track issues and feature requests, as well as accept pull requests.
|
|
14
|
+
|
|
15
|
+
## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests
|
|
16
|
+
|
|
17
|
+
Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests:
|
|
18
|
+
|
|
19
|
+
1. Fork the repo and create your branch from `main`.
|
|
20
|
+
2. If you've added code that should be tested, add tests.
|
|
21
|
+
3. If you've changed APIs, update the documentation.
|
|
22
|
+
4. Ensure the test suite passes.
|
|
23
|
+
5. Make sure your code lints.
|
|
24
|
+
6. Issue that pull request!
|
|
25
|
+
|
|
26
|
+
## Any contributions you make will be under the MIT Software License
|
|
27
|
+
|
|
28
|
+
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
|
|
29
|
+
|
|
30
|
+
## Report bugs using Github's [issues](https://github.com/tscircuit/snippets/issues)
|
|
31
|
+
|
|
32
|
+
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/tscircuit/snippets/issues/new); it's that easy!
|
|
33
|
+
|
|
34
|
+
## Write bug reports with detail, background, and sample code
|
|
35
|
+
|
|
36
|
+
**Great Bug Reports** tend to have:
|
|
37
|
+
|
|
38
|
+
- A quick summary and/or background
|
|
39
|
+
- Steps to reproduce
|
|
40
|
+
- Be specific!
|
|
41
|
+
- Give sample code if you can.
|
|
42
|
+
- What you expected would happen
|
|
43
|
+
- What actually happens
|
|
44
|
+
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
|
|
45
|
+
|
|
46
|
+
People _love_ thorough bug reports. I'm not even kidding.
|
|
47
|
+
|
|
48
|
+
## Use a Consistent Coding Style
|
|
49
|
+
|
|
50
|
+
- 2 spaces for indentation rather than tabs
|
|
51
|
+
- You can try running `bun run lint` for style unification
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
By contributing, you agree that your contributions will be licensed under its MIT License.
|
|
56
|
+
|
|
57
|
+
## References
|
|
58
|
+
|
|
59
|
+
This document was adapted from the open-source contribution guidelines for [Facebook's Draft](https://github.com/facebook/draft-js/blob/a9316a723f9e918afde44dea68b5f9f39b7d9b00/CONTRIBUTING.md)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 tscircuit Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# TSCircuit Snippets
|
|
2
|
+
<a href="https://console.algora.io/org/tscircuit/bounties?status=completed">
|
|
3
|
+
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fconsole.algora.io%2Fapi%2Fshields%2Ftscircuit%2Fbounties%3Fstatus%3Dcompleted" alt="Rewarded Bounties">
|
|
4
|
+
</a>
|
|
5
|
+
<a href="https://console.algora.io/org/tscircuit/bounties?status=open">
|
|
6
|
+
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fconsole.algora.io%2Fapi%2Fshields%2Ftscircuit%2Fbounties%3Fstatus%3Dopen" alt="Open Bounties">
|
|
7
|
+
</a>
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
[Docs](https://docs.tscircuit.com) · [Website](https://tscircuit.com) · [Twitter](https://x.com/tscircuit) · [discord](https://tscircuit.com/community/join-redirect) · [Quickstart](https://docs.tscircuit.com/quickstart) · [Online Playground](https://tscircuit.com/playground)
|
|
11
|
+
|
|
12
|
+
TSCircuit Snippets is a web application for creating, sharing, and managing circuit designs using TypeScript and React. It provides an intuitive interface for designing circuit boards, packages, footprints, and 3D models.
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- Create and edit circuit designs using TypeScript and React
|
|
17
|
+
- Real-time preview of PCB layouts and 3D models
|
|
18
|
+
- Share and collaborate on circuit designs
|
|
19
|
+
- AI-assisted circuit design and error correction
|
|
20
|
+
- Import and export designs in various formats
|
|
21
|
+
|
|
22
|
+
## Getting Started
|
|
23
|
+
|
|
24
|
+
### Prerequisites
|
|
25
|
+
|
|
26
|
+
- [Bun](https://bun.sh/) (latest version)
|
|
27
|
+
|
|
28
|
+
### Installation
|
|
29
|
+
|
|
30
|
+
1. Clone the repository:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
git clone https://github.com/tscircuit/snippets.git
|
|
34
|
+
cd snippets
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
2. Install dependencies:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
bun install
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Running the Development Server
|
|
44
|
+
|
|
45
|
+
To start the development server:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
bun run dev
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This command will build the fake API and start the Vite development server. Open [http://localhost:5173](http://localhost:5173) in your browser to view the application.
|
|
52
|
+
|
|
53
|
+
### Testing the AI in Development
|
|
54
|
+
|
|
55
|
+
Create a `.env` file with the following:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
VITE_USE_DIRECT_AI_REQUESTS=true
|
|
59
|
+
VITE_ANTHROPIC_API_KEY=<your-key-here>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Building for Production
|
|
63
|
+
|
|
64
|
+
To build the project for production:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
bun run build
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This will create a production-ready build in the `dist` directory.
|
|
71
|
+
|
|
72
|
+
## Project Structure
|
|
73
|
+
|
|
74
|
+
- `src/`: Contains the main React application code
|
|
75
|
+
- `fake-snippets-api/`: Contains the mock API for development
|
|
76
|
+
- `public/`: Static assets
|
|
77
|
+
- `src/components/`: Reusable React components
|
|
78
|
+
- `src/hooks/`: Custom React hooks
|
|
79
|
+
- `src/pages/`: Main page components
|
|
80
|
+
- `src/lib/`: Utility functions and helpers
|
|
81
|
+
- `playwright-tests/`: Playwright test files
|
|
82
|
+
- `playwright-tests/snapshots/`: Visual regression test snapshots
|
|
83
|
+
|
|
84
|
+
## Snapshots
|
|
85
|
+
|
|
86
|
+
We use Playwright for visual regression testing. Snapshots are stored in the `playwright-tests/snapshots/` directory.
|
|
87
|
+
|
|
88
|
+
To update a single snapshot run...
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
bun run snapshot
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This will prompt you to select a specific test file to update.
|
|
95
|
+
|
|
96
|
+
## Contributing
|
|
97
|
+
|
|
98
|
+
We welcome contributions to TSCircuit Snippets! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
99
|
+
|
|
100
|
+
## Example Snippets
|
|
101
|
+
|
|
102
|
+
- [Arduino Nano Servo Breakout Board](https://tscircuit.com/Abse2001/Arduino-Nano-Servo-Breakout)
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
107
|
+
|
|
108
|
+
## Acknowledgments
|
|
109
|
+
|
|
110
|
+
- Inspired by [val.town](https://val.town), [codesandbox.io](https://codesandbox.io/), and [v0.dev](https://v0.dev)
|
|
111
|
+
- Built with [React](https://reactjs.org/), [Vite](https://vitejs.dev/), and [Tailwind CSS](https://tailwindcss.com/)
|
|
112
|
+
|
|
113
|
+
For more information, visit [tscircuit.com](https://tscircuit.com).
|
package/biome.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
|
|
3
|
+
"organizeImports": {
|
|
4
|
+
"enabled": true
|
|
5
|
+
},
|
|
6
|
+
"formatter": {
|
|
7
|
+
"enabled": true,
|
|
8
|
+
"indentStyle": "space"
|
|
9
|
+
},
|
|
10
|
+
"files": {
|
|
11
|
+
"ignore": ["cosmos-export", "dist", "package.json", ".vercel"]
|
|
12
|
+
},
|
|
13
|
+
"javascript": {
|
|
14
|
+
"formatter": {
|
|
15
|
+
"jsxQuoteStyle": "double",
|
|
16
|
+
"quoteProperties": "asNeeded",
|
|
17
|
+
"trailingCommas": "all",
|
|
18
|
+
"semicolons": "asNeeded",
|
|
19
|
+
"arrowParentheses": "always",
|
|
20
|
+
"bracketSpacing": true,
|
|
21
|
+
"bracketSameLine": false
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"linter": {
|
|
25
|
+
"enabled": false,
|
|
26
|
+
"rules": {
|
|
27
|
+
"recommended": true,
|
|
28
|
+
"suspicious": {
|
|
29
|
+
"noExplicitAny": "off"
|
|
30
|
+
},
|
|
31
|
+
"style": {
|
|
32
|
+
"noNonNullAssertion": "off",
|
|
33
|
+
"useNumberNamespace": "off",
|
|
34
|
+
"useFilenamingConvention": {
|
|
35
|
+
"level": "error",
|
|
36
|
+
"options": {
|
|
37
|
+
"strictCase": true,
|
|
38
|
+
"requireAscii": true,
|
|
39
|
+
"filenameCases": ["kebab-case", "export"]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"useNamingConvention": {
|
|
43
|
+
"level": "error",
|
|
44
|
+
"options": {
|
|
45
|
+
"strictCase": true,
|
|
46
|
+
"requireAscii": true,
|
|
47
|
+
"conventions": [
|
|
48
|
+
{
|
|
49
|
+
"selector": {
|
|
50
|
+
"kind": "const"
|
|
51
|
+
},
|
|
52
|
+
"formats": ["camelCase"]
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|