Skip to content

Commit 2069a76

Browse files
committed
Running a different script as part of the typegpu package
1 parent 97f64df commit 2069a76

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

packages/typegpu/bin.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env node
2+
import { spawn } from 'node:child_process';
3+
4+
const child = spawn(
5+
'npx',
6+
['create-typegpu@latest', ...process.argv.slice(2)],
7+
{ stdio: 'inherit' },
8+
);
9+
10+
child.on('exit', (code, signal) => {
11+
if (signal) {
12+
process.kill(process.pid, signal);
13+
} else {
14+
process.exit(code ?? 0);
15+
}
16+
});

packages/typegpu/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
},
2525
"type": "module",
2626
"sideEffects": false,
27+
"bin": {
28+
"tgpu": "./bin.mjs"
29+
},
2730
"exports": {
2831
"./package.json": "./package.json",
2932
".": {
@@ -77,7 +80,7 @@
7780
"types": "./dist/index.d.ts"
7881
},
7982
"scripts": {
80-
"build": "tsdown",
83+
"build": "tsdown && cp bin.mjs dist/bin.mjs",
8184
"test:types": "pnpm tsc --p ./tsconfig.test.json --noEmit",
8285
"prepublishOnly": "tgpu-dev-cli prepack"
8386
},

0 commit comments

Comments
 (0)