feat: Select ecosystem packages in CLI#2556
Conversation
|
pkg.pr.new packages benchmark commit |
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:No major changes. 📋 All resultsClick to reveal the results table (355 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
Resolution Time Benchmark---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.97, 1.89, 3.95, 6.29, 7.19, 10.11, 22.49, 24.61]
line [0.98, 1.90, 4.32, 6.02, 7.22, 11.52, 21.29, 21.71]
line [1.01, 2.01, 4.47, 6.47, 7.35, 10.28, 20.98, 21.54]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.32, 0.53, 0.68, 0.89, 1.18, 1.20, 1.47, 1.61]
line [0.31, 0.53, 0.66, 0.83, 1.10, 1.23, 1.42, 1.65]
line [0.31, 0.56, 0.71, 0.90, 1.14, 1.26, 1.49, 1.68]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.87, 1.96, 3.63, 6.22, 13.61, 26.88, 54.49, 112.28]
line [0.96, 2.01, 3.41, 6.12, 12.11, 26.73, 54.44, 111.14]
line [0.83, 2.08, 4.08, 6.42, 12.69, 27.23, 56.56, 116.41]
|
There was a problem hiding this comment.
Pull request overview
This PR updates the @typegpu/cli create/enhance flows to let users optionally select and install additional TypeGPU ecosystem packages (instead of always including some in the template).
Changes:
- Removes
@typegpu/colorand@typegpu/noisefrom the Vite simple template dependencies. - Adds a reusable multiselect prompt + a
typegpuPkgslist of ecosystem packages. - Hooks package selection into both
createandenhanceflows, and adds a no-op path for empty installs.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/typegpu-cli/templates/template-vite-simple/_package.json | Removes default ecosystem deps so installs become user-selected. |
| packages/typegpu-cli/src/utils/pm.ts | Adds an early return for empty pmAdd package lists. |
| packages/typegpu-cli/src/utils/pkg.ts | Introduces the selectable ecosystem package registry (typegpuPkgs). |
| packages/typegpu-cli/src/utils/inputs.ts | Adds selectPkgs() multiselect helper. |
| packages/typegpu-cli/src/steps/typegpu.ts | Adds askForPkgs() to install selected ecosystem packages during enhance. |
| packages/typegpu-cli/src/enhance.ts | Calls askForPkgs() in the Vite enhance flow. |
| packages/typegpu-cli/src/create.ts | Calls selectPkgs() + installs selected packages during project creation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Since the CLI versioning is supposed to match the targeted TypeGPU major & minor, I would fetch the latest versions of the ecosystem packages with the matching major & minor of the CLI package. I also think we can minimize the amount of bookkeeping we need to do by using something like |
…s-packages-in-cli
| return name in deps || name in devDeps || name in peerDeps; | ||
| } | ||
|
|
||
| export const VERSION = '^0.11.0'; |
There was a problem hiding this comment.
Hardcoded. If we wish, we can create a map from package to version in future.
| } | ||
|
|
||
| export function copyTemplate(templateDir: string, projectDir: string, packageName: string) { | ||
| export async function scaffoldProject( |
There was a problem hiding this comment.
I dislike how this function became async, but we cannot ask for packages to add before reading the JSON (otherwise, we might suggest packages already present in the preset)
|
Now the dependencies are added directly to package.json, without use of the package manager (thus no install happens) |
| export const PackageJsonSchema = type({ | ||
| name: 'string', | ||
| 'dependencies?': 'Record<string, string>', | ||
| 'devDependencies?': 'Record<string, string>', | ||
| 'peerDependencies?': 'Record<string, string>', | ||
| }); |
There was a problem hiding this comment.
do we care?
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…s-packages-in-cli
I did some additional refactoring and small changes.