Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions packages/create-typegpu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# create-typegpu

This package is a proxy for the [`@typegpu/cli`](https://github.com/software-mansion/TypeGPU/tree/main/packages/typegpu-cli), and allows you to
spin up new TypeGPU projects with the `npm create typegpu` command.

```sh
npx @typegpu/cli@latest

# Alternate ways to invoke the CLI:
npx typegpu@latest
npm create typegpu
```

## TypeGPU is created by Software Mansion

[![swm](https://logo.swmansion.com/logo?color=white&variant=desktop&width=150&tag=typegpu-github 'Software Mansion')](https://swmansion.com)

Since 2012 [Software Mansion](https://swmansion.com) is a software agency with
experience in building web and mobile apps. We are Core React Native
Contributors and experts in dealing with all kinds of React Native issues. We
can help you build your next dream product –
[Hire us](https://swmansion.com/contact/projects?utm_source=typegpu&utm_medium=readme).
36 changes: 36 additions & 0 deletions packages/create-typegpu/bin.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env node
// @ts-check

import { spawn } from 'node:child_process';

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);
return;
}

resolve(code ?? 0);
});

child.on('error', (err) => {
reject(err);
});
});
}

(async () => {
const npxCommand = process.platform === 'win32' ? 'npx.cmd' : 'npx';
try {
const code = await asyncSpawn(npxCommand, ['@typegpu/cli@latest', ...process.argv.slice(2)], {
stdio: 'inherit',
});
process.exit(code);
} catch (err) {
console.error('Failed to run @typegpu/cli via npx:', err);
process.exit(1);
}
})();
33 changes: 33 additions & 0 deletions packages/create-typegpu/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "create-typegpu",
"version": "0.0.1",
"description": "A CLI tool for bootstrapping TypeGPU projects.",
"homepage": "https://typegpu.com",
"bugs": {
"url": "https://github.com/software-mansion/TypeGPU/issues"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/software-mansion/TypeGPU.git#main",
"directory": "packages/create-typegpu"
},
"bin": {
"create-typegpu": "./bin.mjs"
},
"files": [
"bin.mjs"
],
"type": "module",
"scripts": {
"test:types": "tsc --p ./tsconfig.json --noEmit"
},
"devDependencies": {
"@types/node": "catalog:types",
"typescript": "catalog:types"
},
"engines": {
"node": ">=22.0.0"
},
"packageManager": "pnpm@11.1.2+sha512.415a1cc25974731e75455c1468371be74c5aa5fb7621b50d4056d222451609f11412f23fd602e6169f1e060466641f798597e1be961a10688836a67b16569499"
}
8 changes: 8 additions & 0 deletions packages/create-typegpu/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["@types/node"]
},
"include": ["bin.mjs"],
"exclude": ["node_modules", "dist"]
}
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading