create-okona-game 0.1.2 → 0.2.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/index.js +7 -5
- package/package.json +1 -1
- package/template/README.md +7 -4
- package/template/index.html +1 -1
- package/template/okona.json +8 -0
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
|
|
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("
|
|
63
|
-
console.log(" npx okona-cli
|
|
64
|
-
console.log(" npx okona-cli push . --
|
|
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 # → https://play.okonaonline.com/games/?id=<id>");
|
|
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.
|
|
3
|
+
"version": "0.2.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",
|
package/template/README.md
CHANGED
|
@@ -5,6 +5,7 @@ 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
|
|
|
@@ -16,9 +17,11 @@ The `okona` CLI is the npm package `okona-cli` (Node 18.17+); `npx` runs it with
|
|
|
16
17
|
|
|
17
18
|
```
|
|
18
19
|
npx okona-cli login # once: approve a code in the portal
|
|
19
|
-
npx okona-cli create
|
|
20
|
-
npx okona-cli push . --
|
|
21
|
-
npx okona-cli push . --
|
|
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 # → https://play.okonaonline.com/games/?id=<id>
|
|
22
23
|
```
|
|
23
24
|
|
|
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
|
+
|
|
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()`.
|
package/template/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
game at one link. 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 . --
|
|
10
|
+
Publish: 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">
|