feat: "create-typegpu" CLI package#1903
Conversation
|
pkg.pr.new packages benchmark commit |
a1e106e to
ece16aa
Compare
Bundle size comparison (
|
| 🟢 Decreased | ➖ Unchanged | 🔴 Increased | ❔ Unknown |
|---|---|---|---|
| 0 | 321 | 0 | 0 |
import { ... } in PR vs import * as ... in PR (is the library tree-Shakeable?):
| Test | tsdown |
|---|---|
| tgpu_init.ts | 256.41 kB ( |
| tgpu_initFromDevice.ts | 255.90 kB ( |
| tgpu_resolve.ts | 187.13 kB ( |
| tgpu_resolveWithContext.ts | 187.07 kB ( |
| tgpu_bindGroupLayout.ts | 69.01 kB ( |
| tgpu_mutableAccessor.ts | 65.98 kB ( |
| tgpu_accessor.ts | 65.97 kB ( |
| tgpu_privateVar.ts | 65.30 kB ( |
| tgpu_workgroupVar.ts | 65.30 kB ( |
| tgpu_const.ts | 64.53 kB ( |
| tgpu_fn.ts | 37.94 kB ( |
| tgpu_fragmentFn.ts | 37.87 kB ( |
| tgpu_vertexFn.ts | 37.69 kB ( |
| tgpu_computeFn.ts | 37.39 kB ( |
| tgpu_vertexLayout.ts | 26.61 kB ( |
| tgpu_comptime.ts | 14.41 kB ( |
| tgpu_unroll.ts | 2.60 kB ( |
| tgpu_slot.ts | 1.57 kB ( |
| tgpu_lazy.ts | 1.22 kB ( |
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.82, 1.72, 3.81, 5.95, 6.49, 10.90, 19.60, 22.65]
line [0.86, 1.70, 3.96, 5.34, 6.35, 11.56, 20.04, 19.74]
line [0.73, 1.59, 3.41, 5.64, 6.72, 9.55, 19.87, 20.41]
---
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.67, 0.74, 1.08, 1.16, 1.36, 1.49]
line [0.25, 0.49, 0.62, 0.78, 1.04, 1.06, 1.28, 1.46]
line [0.33, 0.53, 0.60, 0.73, 0.96, 1.03, 1.25, 1.35]
---
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.80, 1.91, 4.35, 5.57, 10.96, 24.24, 50.13, 101.49]
line [0.85, 1.88, 3.93, 5.73, 11.01, 22.76, 50.22, 101.55]
line [0.73, 1.88, 3.87, 5.52, 11.02, 22.91, 49.49, 101.94]
|
ee9887c to
95e76c3
Compare
Update pnpm-lock.yaml Add files Not private
Update pnpm-lock.yaml Add files Not private
95e76c3 to
c07313d
Compare
5aa7c55 to
1b9c59a
Compare
1b9c59a to
9c77259
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new create-typegpu workspace package intended to support npm create typegpu by delegating execution to the latest released @typegpu/cli.
Changes:
- Introduces
packages/create-typegpuwith a Node shebangbin.mjsthat spawnsnpx @typegpu/cli@latest. - Adds package metadata (
package.json), minimal TS config, and a README for the new package. - Updates
pnpm-lock.yamlto include the new workspace package’s devDependencies.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds lockfile entries for the new create-typegpu workspace package. |
| packages/create-typegpu/tsconfig.json | Adds a minimal TS config for type-checking the package entrypoint. |
| packages/create-typegpu/README.md | Documents the new npm create typegpu entrypoint and relationship to @typegpu/cli. |
| packages/create-typegpu/package.json | Declares the new package, its bin entry, scripts, and engine constraints. |
| packages/create-typegpu/bin.mjs | Implements the proxy behavior by spawning npx @typegpu/cli@latest. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function asyncSpawn(/** @type {Parameters<typeof spawn>} */ ...args) { | ||
| return new Promise((resolve, _reject) => { | ||
| const child = spawn(...args); | ||
|
|
||
| child.on('exit', (code, signal) => { | ||
| if (signal) { | ||
| process.kill(process.pid, signal); | ||
| process.exit(0); | ||
| return; | ||
| } | ||
|
|
||
| resolve(code); | ||
| }); | ||
| }); | ||
| } |
| (async () => { | ||
| const code = await asyncSpawn('npx', [`@typegpu/cli@latest`, ...process.argv.slice(2)], { | ||
| stdio: 'inherit', | ||
| }); | ||
| process.exit(code ?? 0); | ||
| })(); |
There was a problem hiding this comment.
Important
The proxy wrapper has a couple of small but real correctness issues (signal exit codes and missing spawn-error handling) plus a README markdown typo that should be fixed before merge.
Reviewed changes — adds the create-typegpu npm initializer package that forwards npm create typegpu (and npx create-typegpu) to npx @typegpu/cli@latest.
- Adds
packages/create-typegpu/package.json,bin.mjs,tsconfig.json, andREADME.md. bin.mjsspawns@typegpu/cli@latestwith inherited stdio and returns the child exit code.- Adds the new workspace package to
pnpm-lock.yaml.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — follow-up commit on feat/create-typegpu addresses prior Pullfrog review feedback and hardens the initializer's cross-platform behavior.
- Fixed the malformed
@typegpu/climarkdown link in the README. - Removed
process.exit(0)after signal forwarding inbin.mjs, so the proxy no longer reports success when the child is killed by a signal. - Added a
child.on('error')listener that rejects the spawn promise, plus a top-leveltry/catchthat logs spawn failures and exits non-zero. - Switched the spawned command to
npx.cmdon Windows so the wrapper works outside WSL. - Updated
test:typesto target the projecttsconfig.jsonwithout emit and raised the declared Node engine to>=22.0.0.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
a896887 to
697cbad
Compare

Executing
npm create typegpuhas the same behavior asnpx typegpu@latest. It's important to note that it always targets the latest released version of@typegpu/cli