feat: tgpu CLI#2463
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 (353 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.81, 1.75, 3.80, 5.40, 6.41, 10.26, 18.71, 19.02]
line [0.86, 1.67, 3.64, 5.64, 6.34, 9.48, 18.13, 19.92]
line [0.89, 1.76, 3.86, 5.23, 6.69, 11.11, 18.96, 19.75]
---
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.26, 0.50, 0.62, 0.73, 1.01, 1.02, 1.31, 1.49]
line [0.32, 0.50, 0.66, 0.77, 1.03, 1.08, 1.36, 1.42]
line [0.34, 0.53, 0.67, 0.82, 1.06, 1.14, 1.35, 1.47]
---
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.82, 1.99, 4.31, 6.14, 11.05, 22.60, 47.49, 97.01]
line [0.83, 1.72, 3.64, 5.32, 10.49, 22.62, 47.99, 96.83]
line [0.81, 1.83, 4.41, 5.47, 10.87, 22.20, 48.37, 101.49]
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a new tgpu Node CLI package in the monorepo to scaffold new TypeGPU projects from templates and to “enhance” existing projects (currently focused on Vite). It also updates WebGPU type definitions in the testing utility and refreshes lockfile dependencies to support the new package.
Changes:
- Add
packages/tgpuCLI implementation (create+enhanceflows) with supporting utilities and steps (Vite config +@webgpu/typesregistration). - Add a “vite simple” project template (HTML/CSS/TS, lint/format/editor settings, assets).
- Update
@webgpu/typesversion and extend test globals withGPUTextureUsage.TRANSIENT_ATTACHMENT.
Reviewed changes
Copilot reviewed 31 out of 37 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Updates lockfile for @webgpu/types bump and new tgpu workspace dependencies. |
| packages/typegpu-testing-utility/src/webgpuGlobals.ts | Adds GPUTextureUsage.TRANSIENT_ATTACHMENT to the test WebGPU globals. |
| packages/tgpu/tsdown.config.ts | Build config for bundling the tgpu CLI entrypoint. |
| packages/tgpu/tsconfig.json | TypeScript config for the tgpu package. |
| packages/tgpu/src/index.ts | CLI entrypoint and argument parsing for tgpu. |
| packages/tgpu/src/create.ts | Implements interactive project scaffolding from templates. |
| packages/tgpu/src/enhance.ts | Implements interactive “enhance existing project” flow (currently Vite-focused). |
| packages/tgpu/src/steps/typegpu.ts | Step to install typegpu dependency. |
| packages/tgpu/src/steps/vite.ts | Step to install/configure unplugin-typegpu in Vite config. |
| packages/tgpu/src/steps/webgpu-types.ts | Step to install @webgpu/types and register it in tsconfig. |
| packages/tgpu/src/utils/config.ts | Helper to locate config files by name. |
| packages/tgpu/src/utils/files.ts | Template directory preparation + copy/rename logic. |
| packages/tgpu/src/utils/inputs.ts | Interactive input collection and validation (dir/package name). |
| packages/tgpu/src/utils/pkg.ts | Helpers to detect dependencies/expo presence in package.json. |
| packages/tgpu/src/utils/pm.ts | Package-manager command resolution and install/add/run helpers. |
| packages/tgpu/src/utils/prompts.ts | Prompt helpers (cancel/fail/confirm) and colored labels. |
| packages/tgpu/src/utils/types.ts | Arktype schemas used for parsing package.json/tsconfig fragments. |
| packages/tgpu/package.json | Defines the new tgpu published package, bin entry, deps, and engines. |
| packages/tgpu/README.md | Usage docs for running the tgpu CLI via dlx/npx/etc. |
| packages/tgpu/LICENSE | CC0 license statement for files in template-* directories. |
| packages/tgpu/templates/template-vite-simple/index.html | Template HTML landing page and external links. |
| packages/tgpu/templates/template-vite-simple/vite.config.ts | Template Vite config enabling unplugin-typegpu. |
| packages/tgpu/templates/template-vite-simple/tsconfig.json | Template TS config including @webgpu/types and Vite types. |
| packages/tgpu/templates/template-vite-simple/oxlint.config.ts | Template oxlint configuration including TypeGPU rules. |
| packages/tgpu/templates/template-vite-simple/src/main.ts | Template WebGPU draw example using TypeGPU. |
| packages/tgpu/templates/template-vite-simple/src/style.css | Template styling for the simple Vite page. |
| packages/tgpu/templates/template-vite-simple/public/favicon.svg | Template favicon asset. |
| packages/tgpu/templates/template-vite-simple/public/icons.svg | Template SVG symbols used in the page. |
| packages/tgpu/templates/template-vite-simple/public/vite.svg | Template Vite logo asset. |
| packages/tgpu/templates/template-vite-simple/public/typegpu-logo-light.svg | Template TypeGPU logo (light). |
| packages/tgpu/templates/template-vite-simple/public/typegpu-logo-dark.svg | Template TypeGPU logo (dark). |
| packages/tgpu/templates/template-vite-simple/_gitignore | Template gitignore (renamed to .gitignore by scaffolder). |
| packages/tgpu/templates/template-vite-simple/_nvmrc | Template Node version file (renamed to .nvmrc). |
| packages/tgpu/templates/template-vite-simple/_oxfmtrc.json | Template formatter config (renamed to .oxfmtrc.json). |
| packages/tgpu/templates/template-vite-simple/_package.json | Template package.json (renamed + name replaced during scaffolding). |
| packages/tgpu/templates/template-vite-simple/_vscode/settings.json | Template VS Code settings (renamed to .vscode/settings.json). |
| packages/tgpu/templates/template-vite-simple/_zed/settings.json | Template Zed editor settings (renamed to .zed/settings.json). |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (5)
packages/tgpu/templates/template-vite-simple/index.html:55
- This external link uses
target="_blank"withoutrel="noopener noreferrer", which can allow reverse-tabnabbing viawindow.opener. Add an appropriaterelattribute.
<a
href="https://github.com/software-mansion/typegpu"
target="_blank"
>
packages/tgpu/templates/template-vite-simple/index.html:70
- This external link uses
target="_blank"withoutrel="noopener noreferrer", which can allow reverse-tabnabbing viawindow.opener. Add an appropriaterelattribute.
<a
href="https://discord.gg/8jpfgDqPcM"
target="_blank"
>
packages/tgpu/templates/template-vite-simple/index.html:91
- This external link uses
target="_blank"withoutrel="noopener noreferrer", which can allow reverse-tabnabbing viawindow.opener. Add an appropriaterelattribute.
<a href="https://vite.dev/" target="_blank">
packages/tgpu/templates/template-vite-simple/index.html:106
- This external link uses
target="_blank"withoutrel="noopener noreferrer", which can allow reverse-tabnabbing viawindow.opener. Add an appropriaterelattribute.
<a
href="https://github.com/vitejs/vite"
target="_blank"
>
packages/tgpu/templates/template-vite-simple/index.html:118
- This external link uses
target="_blank"withoutrel="noopener noreferrer", which can allow reverse-tabnabbing viawindow.opener. Add an appropriaterelattribute.
<a href="https://chat.vite.dev/" target="_blank">
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const templateDir = path.resolve( | ||
| import.meta.dirname, | ||
| '../templates', | ||
| `template-${projectTemplate}`, | ||
| ); |
iwoplaza
left a comment
There was a problem hiding this comment.
I love it! Let's merge after the fixes ![]()
| @@ -0,0 +1,15 @@ | |||
| // Folder-specific settings | |||
There was a problem hiding this comment.
Does this work? I don't think json supports comments
There was a problem hiding this comment.
It does depending on how it's interpreted, in the case of Zed it handles it fine
| @@ -0,0 +1,42 @@ | |||
| { | |||
| "name": "tgpu", | |||
| "version": "0.0.1", | |||
There was a problem hiding this comment.
| "version": "0.0.1", | |
| "version": "0.11.0", |
This script serves two purposes:
Note: vite template will be changed
TODO: