create-okona-game 0.1.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,6 +6,6 @@ npm create okona-game my-party-game
6
6
 
7
7
  Scaffolds a phone-controlled multiplayer HTML5 game for [Okona](https://okonaonline.com): a lobby that shows the join code until the room is full, six seats with names and colours pushed to each phone, the frame loop, and a `game.js` with `start` / `update` / `draw` hooks holding a small sample (a coin-grab race) to replace with your game.
8
8
 
9
- Open `index.html` in a browser and the keyboard is P1 — no build step, no `package.json`. Ship it with the [`okona` CLI](https://www.npmjs.com/package/okona-cli) (`npx okona-cli`, Node 18.17+): push to your sandbox first to try it with real phones, then publish, and phones join by scanning the code on the TV.
9
+ Open `index.html` in a browser and the keyboard is P1 — no build step, no `package.json`. Ship it with the [`okona` CLI](https://www.npmjs.com/package/okona-cli) (`npx okona-cli`, Node 18.17+): push to your sandbox first to try it with real phones, then submit it to the Okona catalog; once it's approved, players join by scanning the code on the TV.
10
10
 
11
11
  Zero dependencies. Docs: https://okonaonline.com/developers/docs.html#html5 · SDK reference: https://okonaonline.com/developers/docs.html#js-sdk
package/index.js CHANGED
@@ -4,7 +4,8 @@
4
4
  // npm create okona-game my-game (or: npx create-okona-game my-game)
5
5
  //
6
6
  // Copies the template (lobby + join code + seats in index.html, your game in
7
- // game.js, an icon, a README) into ./my-game with the name filled in. Zero
7
+ // game.js, an icon, an okona.json catalog record, a README) into ./my-game
8
+ // with the name filled in. Zero
8
9
  // dependencies, Node ≥ 18. `--force` writes into a non-empty directory.
9
10
  import { mkdir, readdir, readFile, writeFile, copyFile, stat } from "node:fs/promises";
10
11
  import { join, resolve, dirname, basename } from "node:path";
@@ -35,7 +36,7 @@ export async function scaffold(target, { name, force = false } = {}) {
35
36
  const src = join(TEMPLATE, f);
36
37
  if ((await stat(src)).isDirectory()) continue;
37
38
  const dest = join(dir, f === "gitignore" ? ".gitignore" : f);
38
- if (/\.(html|js|md)$/.test(f) || f === "gitignore") {
39
+ if (/\.(html|js|md|json)$/.test(f) || f === "gitignore") {
39
40
  const text = (await readFile(src, "utf8")).split("{{NAME}}").join(title);
40
41
  await writeFile(dest, text);
41
42
  } else {
@@ -59,9 +60,10 @@ if (isMain) {
59
60
  console.log(" Next:");
60
61
  console.log(" open index.html in a browser — the keyboard is P1 (WASD + Space)");
61
62
  console.log(" edit game.js — start / update / draw are yours");
62
- console.log(" npx okona-cli login && npx okona-cli create --title \"" + r.title + "\" --description \"…\" --runtime html5");
63
- console.log(" npx okona-cli push . --game <id> --icon icon.png --sandbox # try it with real phones first");
64
- console.log(" npx okona-cli push . --game <id> --icon icon.png --publish # → https://play.okonaonline.com/games/?id=<id>");
63
+ console.log(" edit okona.json — title, description, keywords (the icon is icon.png; add \"screenshots\": \"shots\" for a folder of them)");
64
+ console.log(" npx okona-cli login && npx okona-cli create # reads okona.json, writes the new game id back into it");
65
+ console.log(" npx okona-cli push . --sandbox # catalog + icon + build; try it with real phones first");
66
+ console.log(" npx okona-cli push . --publish # submit for review: Okona approves it into the catalog");
65
67
  console.log(" (npx okona-cli runs the okona command without installing it; Node 18.17+)\n");
66
68
  console.log(" Docs: https://okonaonline.com/developers/docs.html#html5\n");
67
69
  }).catch((e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-okona-game",
3
- "version": "0.1.3",
3
+ "version": "0.3.0",
4
4
  "description": "Scaffold a phone-controlled multiplayer HTML5 game for Okona: lobby, join code, six seats, and a game.js to make yours.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://okonaonline.com/developers/docs.html#html5",
@@ -5,20 +5,23 @@ A phone-controlled multiplayer game for [Okona](https://okonaonline.com). Up to
5
5
  - `index.html` — the lobby, join code, seats and frame loop (rarely needs changes)
6
6
  - `game.js` — **your game**: `start`, `update`, `draw`, and the join/leave/park/resume hooks
7
7
  - `icon.png` — the icon shown in the Okona portal (replace it)
8
+ - `okona.json` — the catalog record: title, description, genre, keywords, the icon, screenshots. `okona push` syncs it
8
9
 
9
10
  ## Play it locally
10
11
 
11
12
  Open `index.html` in a browser (or `npx serve .`). The keyboard is P1: WASD/arrows move, Space is A, Shift is B. Phones need the real thing, below.
12
13
 
13
- ## Publish
14
+ ## Submit to Okona
14
15
 
15
16
  The `okona` CLI is the npm package `okona-cli` (Node 18.17+); `npx` runs it without installing.
16
17
 
17
18
  ```
18
19
  npx okona-cli login # once: approve a code in the portal
19
- npx okona-cli create --title "{{NAME}}" --description "…" --runtime html5
20
- npx okona-cli push . --game <id> --icon icon.png --sandbox # try it with real phones first
21
- npx okona-cli push . --game <id> --icon icon.png --publish # → https://play.okonaonline.com/games/?id=<id>
20
+ npx okona-cli create # reads okona.json, writes the new game id back into it
21
+ npx okona-cli push . --sandbox # catalog + icon + build in one go; try it with real phones first
22
+ npx okona-cli push . --publish # submit for review: Okona approves it into the catalog or sends it back
22
23
  ```
23
24
 
25
+ Screenshots: put up to six images in a `shots/` folder and add `"screenshots": "shots"` to `okona.json` — the next push uploads them in name order (1.png, 2.png, …). `npx okona-cli update --title "…"` changes a field without a build upload; `npx okona-cli game <id>` shows what the portal has.
26
+
24
27
  Docs: https://okonaonline.com/developers/docs.html#html5 · SDK reference: https://okonaonline.com/developers/docs.html#js-sdk · The contract in one line: `Okona.pads()`, `Okona.on('join'|'leave'|'park'|'resume'|'pairing')`, `Okona.drawQr()`, `Okona.players.setIdentity()`, `Okona.rumble()`, `Okona.track()`.
@@ -3,11 +3,11 @@
3
3
  {{NAME}} — an Okona game.
4
4
 
5
5
  This file is the LOBBY and the game loop; your game lives in game.js.
6
- Six phones scan the code on screen and become gamepads. Okona hosts the
7
- game at one link. Open this file in a browser and the keyboard is P1
6
+ Six phones scan the code on screen and become gamepads. Submit it to the
7
+ Okona catalog when it's ready. Open this file in a browser and the keyboard is P1
8
8
  (WASD/arrows, Space = A, Shift = B) so you can play what you build.
9
9
 
10
- Publish: npx okona-cli push . --game <id> --icon icon.png --publish
10
+ Submit: npx okona-cli create && npx okona-cli push . --publish (okona.json holds the title, icon, screenshots)
11
11
  Docs: https://okonaonline.com/developers/docs.html#html5
12
12
  -->
13
13
  <html lang="en">
@@ -0,0 +1,8 @@
1
+ {
2
+ "title": "{{NAME}}",
3
+ "description": "A phone-controlled multiplayer game. Scan the code on screen to play.",
4
+ "genre": "multiplayer-party",
5
+ "keywords": ["party", "multiplayer"],
6
+ "controller": "basic",
7
+ "icon": "icon.png"
8
+ }