Skip to content
Merged
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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Thanks for your interest in contributing to oncyberio! This guide will help you
### Setup

```bash
git clone <repo-url>
git clone https://github.com/oncyberio/awe.git
cd awe
pnpm install
```
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ This scaffolds a full Next.js project with the oncyberio engine pre-configured,
### Monorepo Development

```bash
git clone <repo-url>
git clone https://github.com/oncyberio/awe.git
cd awe
pnpm install
```
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "awe",
"private": true,
"packageManager": "pnpm@10.10.0",
"engines": {
"node": ">=20.9.0"
},
Expand Down
19 changes: 9 additions & 10 deletions packages/create-oncyber-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Scaffold a new 3D game powered by the oncyberio engine.
```bash
npx create-oncyber-app my-game
cd my-game
npm run dev
pnpm dev
```

Open [http://localhost:3000](http://localhost:3000) to see your game, or [http://localhost:3000/_studio](http://localhost:3000/_studio) for the visual editor.
Expand All @@ -18,34 +18,33 @@ Open [http://localhost:3000](http://localhost:3000) to see your game, or [http:/
npx create-oncyber-app [project-name] [options]
```

When run without a project name, the CLI starts in interactive mode and prompts for a name and package manager.
When run without a project name, the CLI starts in interactive mode and prompts for a name and template. The generated project uses pnpm.

## Options

| Flag | Description |
| --- | --- |
| `--use-npm` | Use npm as the package manager |
| `--use-pnpm` | Use pnpm as the package manager |
| `--use-yarn` | Use yarn as the package manager |
| `--skip-install` | Skip automatic dependency installation |
| `--skip-git` | Skip git repository initialization |
| `--help` | Show the help message |
| `--version` | Show the CLI version |

The CLI uses pnpm automatically. If pnpm is missing, it will try to enable it with Corepack.

## Examples

```bash
# Interactive mode — prompts for name and package manager
# Interactive mode — prompts for name and template
npx create-oncyber-app

# Create a project with a specific name
npx create-oncyber-app my-game

# Use pnpm and skip git init
npx create-oncyber-app my-game --use-pnpm --skip-git
# Skip git init
npx create-oncyber-app my-game --skip-git

# Scaffold only — no install, no git
npx create-oncyber-app my-game --use-npm --skip-install --skip-git
npx create-oncyber-app my-game --skip-install --skip-git
```

## What's Included
Expand Down Expand Up @@ -102,7 +101,7 @@ my-game/

## Next Steps

1. Run `npm run dev` to start the dev server
1. Run `pnpm dev` to start the dev server
2. Open [http://localhost:3000](http://localhost:3000) to see your game
3. Open [http://localhost:3000/_studio](http://localhost:3000/_studio) to edit the scene visually
4. Edit `src/components/game-script.tsx` to add game logic
Expand Down
43 changes: 40 additions & 3 deletions packages/create-oncyber-app/src/__tests__/cli-integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,23 @@ describe("CLI integration", { timeout: 30000 }, () => {
expect(rootPkg.scripts["dev"]).toBeDefined();
});

it("writes pnpm workspace scripts for generated projects", () => {
runCli("pnpm-script-test --template starter --skip-install --skip-git", tmpDir);

const rootPkg = JSON.parse(
fs.readFileSync(path.join(tmpDir, "pnpm-script-test", "package.json"), "utf-8"),
);

expect(rootPkg.packageManager).toBe("pnpm@10.10.0");
expect(rootPkg.workspaces).toEqual(["packages/*", "apps/*"]);
expect(rootPkg.scripts["dev"]).toBe(
"pnpm --filter pnpm-script-test dev",
);
expect(rootPkg.scripts["build"]).toBe(
"pnpm --filter pnpm-script-test build",
);
});

it("removes examples/* from pnpm-workspace.yaml and keeps apps/*", () => {
runCli("workspace-test --template starter --use-pnpm --skip-install --skip-git", tmpDir);

Expand Down Expand Up @@ -147,6 +164,26 @@ describe("CLI integration", { timeout: 30000 }, () => {
expect(stdout).toContain("nonexistent");
});

it("fails fast when --use-npm is passed", () => {
const { exitCode, stdout } = runCli(
"bad-package-manager --use-npm --skip-install --skip-git",
tmpDir,
);

expect(exitCode).not.toBe(0);
expect(stdout).toContain("pnpm only");
});

it("fails fast when --use-yarn is passed", () => {
const { exitCode, stdout } = runCli(
"bad-package-manager --use-yarn --skip-install --skip-git",
tmpDir,
);

expect(exitCode).not.toBe(0);
expect(stdout).toContain("pnpm only");
});

it("initializes git repo when --skip-git is not passed", () => {
runCli("git-test --template starter --use-pnpm --skip-install", tmpDir);

Expand Down Expand Up @@ -184,11 +221,11 @@ describe("CLI integration", { timeout: 30000 }, () => {
expect(exitCode).toBe(0);
expect(stdout).toContain("Usage:");
expect(stdout).toContain("--template");
expect(stdout).toContain("--use-npm");
expect(stdout).toContain("--use-pnpm");
expect(stdout).toContain("--use-yarn");
expect(stdout).toContain("--skip-install");
expect(stdout).toContain("--skip-git");
expect(stdout).toContain("Uses pnpm automatically");
expect(stdout).not.toContain("--use-npm");
expect(stdout).not.toContain("--use-yarn");
expect(stdout).toContain("update");
expect(stdout).toContain("Templates:");
expect(stdout).toContain("starter");
Expand Down

This file was deleted.

14 changes: 2 additions & 12 deletions packages/create-oncyber-app/src/__tests__/parse-args.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,11 @@ describe("parseArgs", () => {
expect(result.projectName).toBe("my-game");
});

it("parses --use-npm flag", () => {
const result = parseArgs(["node", "create-oncyber-app", "--use-npm"]);
expect(result.packageManager).toBe("npm");
});

it("parses --use-pnpm flag", () => {
const result = parseArgs(["node", "create-oncyber-app", "--use-pnpm"]);
expect(result.packageManager).toBe("pnpm");
});

it("parses --use-yarn flag", () => {
const result = parseArgs(["node", "create-oncyber-app", "--use-yarn"]);
expect(result.packageManager).toBe("yarn");
});

it("parses --skip-install flag", () => {
const result = parseArgs(["node", "create-oncyber-app", "--skip-install"]);
expect(result.skipInstall).toBe(true);
Expand Down Expand Up @@ -117,11 +107,11 @@ describe("parseArgs", () => {
"create-oncyber-app",
"--skip-git",
"my-game",
"--use-npm",
"--use-pnpm",
]);
expect(result.projectName).toBe("my-game");
expect(result.skipGit).toBe(true);
expect(result.packageManager).toBe("npm");
expect(result.packageManager).toBe("pnpm");
});

it("parses --local flag", () => {
Expand Down
11 changes: 0 additions & 11 deletions packages/create-oncyber-app/src/detect-package-manager.ts

This file was deleted.

Loading