create-gamecn
v0.0.7
Published
Workspace-internal source for the `create-gamecn` scaffolding CLI. Published unscoped at the same name on npm.
Readme
create-gamecn
Workspace-internal source for the create-gamecn scaffolding CLI. Published unscoped at the same name on npm.
Run from source
bun run src/index.ts demo --template phaser-endless-runner --no-install --yesBuild the published bundle
bun run build # bun build src/index.ts → dist/index.js
bun run publish:dry # build + npm pack --dry-run from dist/
bun run publish:npm # build + npm publish from dist/What it does
- Validates the project name (npm-style).
- Resolves the template via the standard resolver chain (namespace, GitHub, HTTPS, local).
- Refuses to overwrite a non-empty target dir without
--force. - Runs the same
executePlanfrom@gamecn/corethatgamecn adduses — templates are just registry items withtype: registry:template. - Rewrites
package.json#nameto the user's chosen project name (one-off; not a generic templating system). - Runs the package manager's
install(or skip with--no-install).
API surface
The scaffolding logic is exported as a function for tests and downstream consumers:
import { scaffold } from "create-gamecn/scaffold";
await scaffold({
name: "my-game",
template: "phaser-endless-runner", // bare name → @main/<name>
registry: "https://example.com/r/{name}.json",
packageManager: "pnpm",
skipInstall: false,
parentDir: process.cwd(),
});The CLI in src/index.ts is a thin commander wrapper around this.
Source layout
src/
scaffold.ts scaffold() function — testable, no I/O outside opts.parentDir
index.ts commander bootstrap — interactive prompts, calls scaffold()Notes
- Templates and components share one install path. If you find yourself writing
if (item.type === "registry:template")branches in core, stop and reconsider. - The package name is unscoped (
create-gamecn) sonpx create-gamecnworks. This is the npm convention forcreate-*packages.
