Conversation
abef8e3 to
deb55be
Compare
…balls
Add `basic` and `minimal` project templates under `packages/viola/templates/`.
Add a Vite plugin `serveTemplates()` that packages each template into a `.tar.gz`
on demand and serves it at `/templates/{name}.tar.gz`.
- Add `tar` dependency for tarball creation
- Exclude `templates/**/*` from Biome linting
- Gitignore generated `public/templates/*.tar.gz`
…t` to `drafts` - Use `file.filename` directly (relative to entryContext) in sandbox files map - Compute `prevFileDir` relative to `entryContext` when creating new files - Remove `defaultDraftDir` export from `sandbox.ts` (now inlined) - Rename template draft directories from `draft` to `drafts` - Add `entryContext: "drafts"` to minimal template config
There was a problem hiding this comment.
Pull request overview
This PR implements a template feature for project boilerplate generation. It introduces a comprehensive project creation flow that allows users to select from official templates (minimal and basic), customize project details, and configure themes during project setup. The implementation spans store refactoring to a class-based architecture, new UI components for template selection, and server-side template serving infrastructure.
Changes:
- Added template serving infrastructure via Vite plugin with tar.gz compression
- Refactored global state management from flat proxy objects to scoped, class-based architecture with proper dependency injection
- Implemented new project creation workflow with template selection and project customization panes
- Added comprehensive template files (minimal and basic) with documentation and configuration examples
- Extended UI component library with new controls (radio groups, popovers, labels, command palettes)
- Updated dependencies including new packages for state management (bunshi), template serving (tar), and UI components
Reviewed changes
Copilot reviewed 95 out of 99 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
pnpm-workspace.yaml |
Updated dependency versions (vite, vitest, bunshi, valtio-reactive, tar) |
patches/vite@6.3.5.patch, patches/buffer@6.0.3.patch |
Patches for dependency compatibility issues |
packages/viola/vite.config.ts |
Added template serving plugin with tar.gz compression |
packages/viola/templates/ |
New minimal and basic project templates with docs and examples |
packages/viola/src/stores/proxies/ |
Refactored state management to class-based architecture |
packages/viola/src/stores/accessors.ts |
New centralized store accessor layer |
packages/viola/src/components/panes/ |
New pane system and UI components for project creation flow |
packages/ui/src/ |
New UI components (radio, popover, label, dialog, command) |
packages/cli-bundle/ |
Updates to support template generation and Node.js polyfills |
I've reviewed this large PR thoroughly. Here are my findings:
<store_comment>
<comment_type>bug</comment_type>
<comment_content>In packages/ui/package.json, there is a spurious dependency "add": "2.0.6" that does not appear to be used anywhere in the codebase. This should likely be removed or clarified if it is intentional.</comment_content>
<file_location>packages/ui/package.json</file_location>
<start_line>34</start_line>
<end_line>34</end_line>
false
moderate
</store_comment>
<store_comment>
<comment_type>best_practices</comment_type>
<comment_content>The packages/viola/templates directory is added to .gitignore for tar.gz files, but the template source files (markdown, JSON, CSS) are being committed. Consider documenting whether template source files should be committed or generated. Additionally, the .gitignore entry public/templates/*.tar.gz suggests templates are expected to be generated in a public directory, but the vite config generates them to dist/templates. These paths should be consistent.</comment_content>
<file_location>packages/viola/.gitignore</file_location>
<start_line>3</start_line>
<end_line>3</end_line>
false
moderate
</store_comment>
<store_comment>
<comment_type>codebase_conventions</comment_type>
<comment_content>The PanePropertyMap interface is declared globally in multiple pane files (pane.start.tsx, pane.preview.tsx, pane.new-project.tsx, pane.edit.tsx, pane.bibliography.tsx, pane.theme.tsx) using declare global. This pattern for building a discriminated union through multiple global declarations is non-standard and could be fragile. Consider centralizing PanePropertyMap in a single location or using a more conventional pattern like module augmentation in a dedicated types file.</comment_content>
<file_location>packages/viola/src/components/panes/pane.preview.tsx</file_location>
<start_line>8</start_line>
<end_line>12</end_line>
false
moderate
</store_comment>
<store_comment>
<comment_type>api_design</comment_type>
<comment_content>In packages/viola/src/components/panes/new-project/project-detail-form.tsx, the project ID is hardcoded to 'alpha-v1' on line 179. This appears to be intentional for a demo/draft flow, but creates a limitation where only one project can be created at a time using this flow. If multiple concurrent projects need to be supported, consider generating a unique project ID instead.</comment_content>
<file_location>packages/viola/src/components/panes/new-project/project-detail-form.tsx</file_location>
<start_line>179</start_line>
<end_line>179</end_line>
false
moderate
</store_comment>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This reverts commit 1ebeeb5.
close #2