star-sdk-cli 0.1.10 → 0.1.11

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +38 -15
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -23,6 +23,23 @@ import Star from 'star-sdk';
23
23
 
24
24
  **CRITICAL:** Always use \`import Star from 'star-sdk'\` - not destructured imports.
25
25
 
26
+ ## Setup (Required for Leaderboards)
27
+
28
+ Before writing any leaderboard code, register your game by running this command in the terminal:
29
+
30
+ \`\`\`bash
31
+ npx star-sdk init "Your Game Name"
32
+ \`\`\`
33
+
34
+ This creates a \`.starrc\` file containing your gameId. Open \`.starrc\`, copy the \`gameId\` value, and pass it to \`Star.init()\`:
35
+
36
+ \`\`\`javascript
37
+ import Star from 'star-sdk';
38
+ Star.init({ gameId: '<paste gameId from .starrc>' });
39
+ \`\`\`
40
+
41
+ **The gameId is a unique token issued by the Star API. Do not make one up \u2014 it will not work. You must run \`npx star-sdk init\` first and use the gameId it gives you.**
42
+
26
43
  ## API Overview
27
44
 
28
45
  | API | Use When | Docs |
@@ -35,7 +52,7 @@ import Star from 'star-sdk';
35
52
 
36
53
  \`\`\`javascript
37
54
  import Star from 'star-sdk';
38
- Star.init({ gameId: 'YOUR_GAME_ID' }); // from .starrc
55
+ Star.init({ gameId: '<gameId from .starrc>' }); // run: npx star-sdk init
39
56
 
40
57
  Star.game(ctx => {
41
58
  const { canvas, width, height, ctx: c } = ctx;
@@ -109,7 +126,7 @@ Only these 17 presets exist:
109
126
 
110
127
  \`\`\`javascript
111
128
  import Star from 'star-sdk';
112
- Star.init({ gameId: 'YOUR_GAME_ID' }); // from .starrc
129
+ Star.init({ gameId: '<gameId from .starrc>' }); // run: npx star-sdk init
113
130
 
114
131
  Star.game(ctx => {
115
132
  const { canvas, width, height, ctx: c } = ctx;
@@ -665,7 +682,7 @@ game(({ ctx, width, height, loop, toStagePoint, canvas }) => {
665
682
  import { game } from 'star-canvas';
666
683
  import { createLeaderboard } from 'star-leaderboard';
667
684
 
668
- const leaderboard = createLeaderboard({ gameId: 'YOUR_GAME_ID' });
685
+ const leaderboard = createLeaderboard({ gameId: '<gameId from .starrc>' });
669
686
 
670
687
  game(({ ctx, width, height, loop, ui, on, canvas, toStagePoint }) => {
671
688
  let score = 0;
@@ -1006,6 +1023,16 @@ var LEADERBOARD_DOCS = `**Installation**
1006
1023
  yarn add star-leaderboard
1007
1024
  \`\`\`
1008
1025
 
1026
+ **Setup (do this first):**
1027
+
1028
+ Register your game by running this in the terminal:
1029
+
1030
+ \`\`\`bash
1031
+ npx star-sdk init "Game Name"
1032
+ \`\`\`
1033
+
1034
+ This creates a \`.starrc\` file. Open it, copy the \`gameId\` value, and use it below. The gameId is a server-issued token \u2014 do not invent one. It must come from \`npx star-sdk init\`.
1035
+
1009
1036
  ### Star Leaderboard SDK
1010
1037
 
1011
1038
  **Simple leaderboards for Star games.** Submit scores, show rankings, share results. Never crashes your game.
@@ -1013,7 +1040,7 @@ yarn add star-leaderboard
1013
1040
  **Import:**
1014
1041
  \`\`\`javascript
1015
1042
  import { createLeaderboard } from 'star-leaderboard';
1016
- const leaderboard = createLeaderboard({ gameId: 'YOUR_GAME_ID' });
1043
+ const leaderboard = createLeaderboard({ gameId: '<gameId from .starrc>' });
1017
1044
  \`\`\`
1018
1045
 
1019
1046
  **CRITICAL:** Import in JavaScript - don't add \`<script>\` tags.
@@ -1026,7 +1053,7 @@ const leaderboard = createLeaderboard({ gameId: 'YOUR_GAME_ID' });
1026
1053
  import { createLeaderboard } from 'star-leaderboard';
1027
1054
  import { game } from 'star-canvas';
1028
1055
 
1029
- const leaderboard = createLeaderboard({ gameId: 'YOUR_GAME_ID' });
1056
+ const leaderboard = createLeaderboard({ gameId: '<gameId from .starrc>' });
1030
1057
 
1031
1058
  game(({ ctx, width, height, loop, ui, on, canvas }) => {
1032
1059
  let score = 0;
@@ -1082,7 +1109,7 @@ leaderboard.showLeaderboard() // Same as show()
1082
1109
  \`\`\`javascript
1083
1110
  import { createLeaderboard } from 'star-leaderboard';
1084
1111
 
1085
- const leaderboard = createLeaderboard({ gameId: 'YOUR_GAME_ID' });
1112
+ const leaderboard = createLeaderboard({ gameId: '<gameId from .starrc>' });
1086
1113
 
1087
1114
  function gameOver(finalScore) {
1088
1115
  // Fire and forget - simplest approach
@@ -1096,7 +1123,7 @@ function gameOver(finalScore) {
1096
1123
  \`\`\`javascript
1097
1124
  import { createLeaderboard } from 'star-leaderboard';
1098
1125
 
1099
- const leaderboard = createLeaderboard({ gameId: 'YOUR_GAME_ID' });
1126
+ const leaderboard = createLeaderboard({ gameId: '<gameId from .starrc>' });
1100
1127
 
1101
1128
  async function gameOver(finalScore) {
1102
1129
  const { success, rank } = await leaderboard.submit(finalScore);
@@ -1115,7 +1142,7 @@ async function gameOver(finalScore) {
1115
1142
  import { createLeaderboard } from 'star-leaderboard';
1116
1143
  import { game } from 'star-canvas';
1117
1144
 
1118
- const leaderboard = createLeaderboard({ gameId: 'YOUR_GAME_ID' });
1145
+ const leaderboard = createLeaderboard({ gameId: '<gameId from .starrc>' });
1119
1146
 
1120
1147
  game(({ ui, on }) => {
1121
1148
  ui.render(\`
@@ -1136,7 +1163,7 @@ game(({ ui, on }) => {
1136
1163
  \`\`\`javascript
1137
1164
  import { createLeaderboard } from 'star-leaderboard';
1138
1165
 
1139
- const leaderboard = createLeaderboard({ gameId: 'YOUR_GAME_ID' });
1166
+ const leaderboard = createLeaderboard({ gameId: '<gameId from .starrc>' });
1140
1167
 
1141
1168
  async function showCustomLeaderboard() {
1142
1169
  const { scores, you, config } = await leaderboard.getScores({
@@ -1161,7 +1188,7 @@ async function showCustomLeaderboard() {
1161
1188
  import { createLeaderboard } from 'star-leaderboard';
1162
1189
  import { game } from 'star-canvas';
1163
1190
 
1164
- const leaderboard = createLeaderboard({ gameId: 'YOUR_GAME_ID' });
1191
+ const leaderboard = createLeaderboard({ gameId: '<gameId from .starrc>' });
1165
1192
 
1166
1193
  game(({ ctx, width, height, loop, ui, on, canvas }) => {
1167
1194
  let score = 0;
@@ -1214,11 +1241,7 @@ game(({ ctx, width, height, loop, ui, on, canvas }) => {
1214
1241
 
1215
1242
  **Configuration:**
1216
1243
 
1217
- Always pass your gameId (from \`.starrc\`, created by \`npx star-sdk init\`):
1218
- \`\`\`javascript
1219
- import { createLeaderboard } from 'star-leaderboard';
1220
- const leaderboard = createLeaderboard({ gameId: 'YOUR_GAME_ID' });
1221
- \`\`\`
1244
+ Your gameId comes from \`.starrc\` (created by \`npx star-sdk init\`). See Setup at the top.
1222
1245
 
1223
1246
  ---
1224
1247
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "star-sdk-cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "CLI tool for Star SDK - register games and manage leaderboards",
5
5
  "type": "module",
6
6
  "bin": {