Skip to content
Draft
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
1 change: 1 addition & 0 deletions packages/create-typegpu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# create-typegpu
3 changes: 3 additions & 0 deletions packages/create-typegpu/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

import './dist/index.mjs';
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",
"type": "module",
"version": "0.0.0",
"description": "A CLI tool for bootstrapping TypeGPU projects.",
"license": "MIT",
"bin": {
"create-typegpu": "./index.js"
},
"files": [
"dist",
"index.js"
],
"engines": {
"node": ">=20.0.0"
},
"scripts": {
"dev": "tsdown --watch",
"build": "tsdown",
"test:types": "tsc",
"prepublishOnly": "npm run build"
},
"dependencies": {
"arg": "^5.0.2",
"arktype": "catalog:",
"consola": "^3.4.0",
"execa": "^9.6.0"
},
"packageManager": "[email protected]+sha512.34e538c329b5553014ca8e8f4535997f96180a1d0f614339357449935350d924e22f8614682191264ec33d1462ac21561aff97f6bb18065351c162c7e8f6de67",
"devDependencies": {
"tsdown": "^0.16.1"
}
}
26 changes: 26 additions & 0 deletions packages/create-typegpu/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { consola } from 'consola';
import { execa } from 'execa';

type ProjectType = 'Vite' | 'React Native';

consola.box('Creating TypeGPU project...');
const projectType = await consola.prompt('Project type:', {
type: 'select',
options: ['Vite', 'React Native'],
}) as ProjectType;

const ProjectSetups = {
'Vite': async () => {
await execa({ stdio: 'inherit' })`npm create vite`;
},
'React Native': async () => {
console.error('React Native setup not implemented yet');
process.exit(1);
},
};

// Bootstrapping the project
await ProjectSetups[projectType]();

// Installing TypeGPU dependencies
await execa({ stdio: 'inherit' })`npm install typegpu`;
5 changes: 5 additions & 0 deletions packages/create-typegpu/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
8 changes: 8 additions & 0 deletions packages/create-typegpu/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'tsdown';

export default defineConfig(() => ({
entry: ['src/index.ts'],
target: 'node20',
minify: true,
plugins: [],
}));
Loading