@replaystage/cli 2.1.0 → 2.1.1
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/dist/commands/creator-publish.d.ts +5 -0
- package/dist/commands/creator-publish.js +315 -0
- package/dist/commands/creator-scaffold.d.ts +5 -0
- package/dist/commands/creator-scaffold.js +362 -0
- package/dist/commands/creator.d.ts +2 -7
- package/dist/commands/creator.js +25 -667
- package/dist/index.js +1 -1
- package/dist/manifest.d.ts +1 -0
- package/dist/manifest.js +47 -6
- package/dist/validate.d.ts +2 -2
- package/dist/validate.js +16 -2
- package/package.json +2 -2
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import { cp, mkdir, readdir, readFile, stat, writeFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { DEFAULT_PORTAL_ORIGIN, findPlatformWorkspaceRoot } from '../config.js';
|
|
4
|
+
import { HEX_COLOR_RE, SLUG_RE, VALID_GENRES, buildStarterManifest, slugToTitle, writeStarterManifest, } from '../manifest.js';
|
|
5
|
+
import { CliError, assertNoUnknownFlags, emitSuccess, extractBoolFlag, extractFlag, } from '../output.js';
|
|
6
|
+
async function exists(targetPath) {
|
|
7
|
+
try {
|
|
8
|
+
await stat(targetPath);
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function formatBytes(bytes) {
|
|
16
|
+
if (bytes < 1024)
|
|
17
|
+
return `${bytes} B`;
|
|
18
|
+
if (bytes < 1024 * 1024)
|
|
19
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
20
|
+
return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;
|
|
21
|
+
}
|
|
22
|
+
export async function cmdInit(args, opts) {
|
|
23
|
+
let rest = args;
|
|
24
|
+
const dirFlag = extractFlag(rest, ['--dir']);
|
|
25
|
+
rest = dirFlag.rest;
|
|
26
|
+
const titleFlag = extractFlag(rest, ['--title']);
|
|
27
|
+
rest = titleFlag.rest;
|
|
28
|
+
const zhFlag = extractFlag(rest, ['--zh']);
|
|
29
|
+
rest = zhFlag.rest;
|
|
30
|
+
const genreFlag = extractFlag(rest, ['--genre']);
|
|
31
|
+
rest = genreFlag.rest;
|
|
32
|
+
const accentFlag = extractFlag(rest, ['--accent']);
|
|
33
|
+
rest = accentFlag.rest;
|
|
34
|
+
const forceFlag = extractBoolFlag(rest, ['--force', '-f']);
|
|
35
|
+
rest = forceFlag.rest;
|
|
36
|
+
assertNoUnknownFlags(rest);
|
|
37
|
+
const slug = rest[0]?.trim().toLowerCase();
|
|
38
|
+
if (!slug || !SLUG_RE.test(slug) || slug.length < 2 || slug.length > 40) {
|
|
39
|
+
throw new CliError('INVALID_ARGUMENTS', 'Usage: replaystage init <slug> [--dir <path>] [--title "<English>"] [--zh "<中文>"] [--genre arcade|puzzle|mystery|strategy] [--accent "#0F62FE"] [--force]');
|
|
40
|
+
}
|
|
41
|
+
const genre = (genreFlag.value || 'arcade');
|
|
42
|
+
if (!VALID_GENRES.includes(genre)) {
|
|
43
|
+
throw new CliError('INVALID_ARGUMENTS', `Invalid --genre "${genre}". Expected one of: ${VALID_GENRES.join(', ')}`);
|
|
44
|
+
}
|
|
45
|
+
const accentColor = accentFlag.value || '#0F62FE';
|
|
46
|
+
if (!HEX_COLOR_RE.test(accentColor)) {
|
|
47
|
+
throw new CliError('INVALID_ARGUMENTS', `Invalid --accent "${accentColor}". Expected 6-digit hex like "#0F62FE".`);
|
|
48
|
+
}
|
|
49
|
+
const targetDir = path.resolve(opts.cwd, dirFlag.value || '.');
|
|
50
|
+
await mkdir(targetDir, { recursive: true });
|
|
51
|
+
const manifest = buildStarterManifest({
|
|
52
|
+
slug,
|
|
53
|
+
titleEn: titleFlag.value,
|
|
54
|
+
titleZh: zhFlag.value,
|
|
55
|
+
genre,
|
|
56
|
+
accentColor,
|
|
57
|
+
});
|
|
58
|
+
const writtenPath = await writeStarterManifest(path.join(targetDir, 'replaystage.manifest.json'), manifest, forceFlag.present);
|
|
59
|
+
emitSuccess(opts, { slug, manifestPath: writtenPath, manifest }, () => [
|
|
60
|
+
`Created ${writtenPath}`,
|
|
61
|
+
'Next steps:',
|
|
62
|
+
' 1. Replace the placeholder tagline/description/howToPlay with real bilingual (en + zh-Hans) copy.',
|
|
63
|
+
` 2. Add icon.png and cover.png under public/media/${slug}/ (<= 2 MB each).`,
|
|
64
|
+
' 3. Build your game and run `npx -y replaystage validate ./dist --json`.',
|
|
65
|
+
' 4. Publish an unlisted preview with `npx -y replaystage publish ./dist --json`.',
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
export async function cmdCreateGame(args, opts) {
|
|
69
|
+
let rest = args;
|
|
70
|
+
const dirFlag = extractFlag(rest, ['--dir']);
|
|
71
|
+
rest = dirFlag.rest;
|
|
72
|
+
const titleFlag = extractFlag(rest, ['--title']);
|
|
73
|
+
rest = titleFlag.rest;
|
|
74
|
+
const zhFlag = extractFlag(rest, ['--zh']);
|
|
75
|
+
rest = zhFlag.rest;
|
|
76
|
+
const genreFlag = extractFlag(rest, ['--genre']);
|
|
77
|
+
rest = genreFlag.rest;
|
|
78
|
+
assertNoUnknownFlags(rest);
|
|
79
|
+
const slug = rest[0]?.trim().toLowerCase();
|
|
80
|
+
if (!slug || !SLUG_RE.test(slug) || slug.length < 2 || slug.length > 40) {
|
|
81
|
+
throw new CliError('INVALID_ARGUMENTS', 'Usage: replaystage create-game <slug> [--dir <path>] [--title "<English>"] [--zh "<中文>"] [--genre arcade|puzzle|mystery|strategy]');
|
|
82
|
+
}
|
|
83
|
+
const titleEn = titleFlag.value?.trim() || slugToTitle(slug);
|
|
84
|
+
const titleZh = zhFlag.value?.trim() || titleEn;
|
|
85
|
+
const genre = (genreFlag.value || 'arcade');
|
|
86
|
+
if (!VALID_GENRES.includes(genre)) {
|
|
87
|
+
throw new CliError('INVALID_ARGUMENTS', `Invalid --genre "${genre}".`);
|
|
88
|
+
}
|
|
89
|
+
const workspaceRoot = await findPlatformWorkspaceRoot(opts.cwd);
|
|
90
|
+
const targetDir = dirFlag.value
|
|
91
|
+
? path.resolve(opts.cwd, dirFlag.value)
|
|
92
|
+
: workspaceRoot
|
|
93
|
+
? path.resolve(workspaceRoot, '..', slug)
|
|
94
|
+
: path.resolve(opts.cwd, slug);
|
|
95
|
+
if (await exists(targetDir)) {
|
|
96
|
+
const existing = await readdir(targetDir);
|
|
97
|
+
if (existing.length > 0) {
|
|
98
|
+
throw new CliError('TARGET_NOT_EMPTY', `Target directory is not empty: ${targetDir}`, {
|
|
99
|
+
details: { targetDir },
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
await mkdir(targetDir, { recursive: true });
|
|
104
|
+
let mode = 'standalone-starter';
|
|
105
|
+
if (workspaceRoot && (await exists(path.join(workspaceRoot, 'templates', 'starter-web-game')))) {
|
|
106
|
+
mode = 'workspace-template';
|
|
107
|
+
const templateDir = path.join(workspaceRoot, 'templates', 'starter-web-game');
|
|
108
|
+
await cp(templateDir, targetDir, { recursive: true });
|
|
109
|
+
const replacements = [
|
|
110
|
+
['package.json', [['"name": "replaystage-starter-game"', `"name": "${slug}"`]]],
|
|
111
|
+
['index.html', [['<title>ReplayStage Starter Game</title>', `<title>${titleEn}</title>`]]],
|
|
112
|
+
['.github/workflows/publish-replaystage.yml', [['slug: starter-game', `slug: ${slug}`]]],
|
|
113
|
+
[
|
|
114
|
+
'replaystage.manifest.json',
|
|
115
|
+
[
|
|
116
|
+
['"slug": "starter-game"', `"slug": "${slug}"`],
|
|
117
|
+
['"originSlug": "starter-game"', `"originSlug": "${slug}"`],
|
|
118
|
+
['"genre": "arcade"', `"genre": "${genre}"`],
|
|
119
|
+
['"title": "Pulse Tap"', `"title": ${JSON.stringify(titleEn)}`],
|
|
120
|
+
['"title": "节拍点按"', `"title": ${JSON.stringify(titleZh)}`],
|
|
121
|
+
],
|
|
122
|
+
],
|
|
123
|
+
[
|
|
124
|
+
'src/main.ts',
|
|
125
|
+
[
|
|
126
|
+
[
|
|
127
|
+
"const STORAGE_KEY = 'rs_starter_save_v1';",
|
|
128
|
+
`const STORAGE_KEY = 'rs_${slug.replace(/-/g, '_')}_save_v1';`,
|
|
129
|
+
],
|
|
130
|
+
["title: 'PULSE TAP'", `title: ${JSON.stringify(titleEn.toUpperCase())}`],
|
|
131
|
+
["title: '节拍点按'", `title: ${JSON.stringify(titleZh)}`],
|
|
132
|
+
],
|
|
133
|
+
],
|
|
134
|
+
['public/cover.svg', [['PULSE TAP', titleEn.toUpperCase()]]],
|
|
135
|
+
];
|
|
136
|
+
for (const [relFile, pairs] of replacements) {
|
|
137
|
+
const full = path.join(targetDir, relFile);
|
|
138
|
+
if (!(await exists(full)))
|
|
139
|
+
continue;
|
|
140
|
+
let content = await readFile(full, 'utf8');
|
|
141
|
+
for (const [from, to] of pairs) {
|
|
142
|
+
content = content.replace(from, to);
|
|
143
|
+
}
|
|
144
|
+
await writeFile(full, content, 'utf8');
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
// Standalone zero-install Tier 2 starter using ReplayStage hosted CDN SDK
|
|
149
|
+
const manifest = buildStarterManifest({ slug, titleEn, titleZh, genre });
|
|
150
|
+
await writeFile(path.join(targetDir, 'replaystage.manifest.json'), `${JSON.stringify(manifest, null, 2)}\n`, 'utf8');
|
|
151
|
+
await mkdir(path.join(targetDir, 'dist'), { recursive: true });
|
|
152
|
+
await mkdir(path.join(targetDir, '.github', 'workflows'), { recursive: true });
|
|
153
|
+
await writeFile(path.join(targetDir, 'dist', 'index.html'), `<!doctype html>
|
|
154
|
+
<html lang="en">
|
|
155
|
+
<head>
|
|
156
|
+
<meta charset="utf-8" />
|
|
157
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
158
|
+
<title>${titleEn}</title>
|
|
159
|
+
<style>
|
|
160
|
+
:root { color-scheme: light dark; --bg: #f4f7fb; --card: #ffffff; --ink: #0f172a; --muted: #475569; --accent: #0f62fe; --accent-ink: #ffffff; }
|
|
161
|
+
:root[data-theme='dark'] { --bg: #0b111b; --card: #111a29; --ink: #f1f5f9; --muted: #94a3b8; --accent: #38bdf8; --accent-ink: #061826; }
|
|
162
|
+
html, body { margin: 0; height: 100dvh; overflow: hidden; touch-action: manipulation; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, sans-serif; display: grid; place-items: center; }
|
|
163
|
+
main { text-align: center; padding: 24px; width: min(320px, 90vw); background: var(--card); border-radius: 20px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12); display: grid; gap: 12px; }
|
|
164
|
+
h1 { margin: 0; font-size: 1.5rem; }
|
|
165
|
+
p { margin: 0; color: var(--muted); }
|
|
166
|
+
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
|
|
167
|
+
button { padding: 12px 20px; border-radius: 11px; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 15px; font-weight: 700; cursor: pointer; }
|
|
168
|
+
button.ghost { background: transparent; color: var(--muted); border: 1px solid color-mix(in oklab, var(--muted) 30%, transparent); }
|
|
169
|
+
[hidden] { display: none !important; }
|
|
170
|
+
</style>
|
|
171
|
+
</head>
|
|
172
|
+
<body>
|
|
173
|
+
<main>
|
|
174
|
+
<h1 id="title">${titleEn}</h1>
|
|
175
|
+
<p id="score">Score: 0</p>
|
|
176
|
+
<div class="row">
|
|
177
|
+
<button id="start" type="button">Start</button>
|
|
178
|
+
<button id="tap" type="button" hidden>Tap +1</button>
|
|
179
|
+
<button id="pause" type="button" class="ghost" hidden>Pause</button>
|
|
180
|
+
<button id="resume" type="button" hidden>Resume</button>
|
|
181
|
+
<button id="finish" type="button" class="ghost" hidden>Finish</button>
|
|
182
|
+
<button id="share" type="button" class="ghost" hidden>Share</button>
|
|
183
|
+
</div>
|
|
184
|
+
</main>
|
|
185
|
+
<script type="module">
|
|
186
|
+
import { initReplayStageGame } from 'https://replaystage.com/sdk/v1/replaystage.esm.js';
|
|
187
|
+
const titleMap = { en: ${JSON.stringify(titleEn)}, 'zh-Hans': ${JSON.stringify(titleZh)} };
|
|
188
|
+
let score = 0;
|
|
189
|
+
let playing = false;
|
|
190
|
+
|
|
191
|
+
const elTitle = document.getElementById('title');
|
|
192
|
+
const elScore = document.getElementById('score');
|
|
193
|
+
const btnStart = document.getElementById('start');
|
|
194
|
+
const btnTap = document.getElementById('tap');
|
|
195
|
+
const btnPause = document.getElementById('pause');
|
|
196
|
+
const btnResume = document.getElementById('resume');
|
|
197
|
+
const btnFinish = document.getElementById('finish');
|
|
198
|
+
const btnShare = document.getElementById('share');
|
|
199
|
+
|
|
200
|
+
const rs = initReplayStageGame({
|
|
201
|
+
gameVersion: '1.0.0',
|
|
202
|
+
onLocaleChange: render,
|
|
203
|
+
onThemeChange: theme => { document.documentElement.dataset.theme = theme; },
|
|
204
|
+
onPauseChange: render,
|
|
205
|
+
});
|
|
206
|
+
document.documentElement.dataset.theme = rs.theme;
|
|
207
|
+
|
|
208
|
+
function render() {
|
|
209
|
+
const zh = rs.locale === 'zh-Hans';
|
|
210
|
+
elTitle.textContent = zh ? titleMap['zh-Hans'] : titleMap.en;
|
|
211
|
+
elScore.textContent = (zh ? '得分:' : 'Score: ') + score + (rs.paused ? (zh ? '(已暂停)' : ' (Paused)') : '');
|
|
212
|
+
btnStart.textContent = zh ? '开始游戏' : 'Start';
|
|
213
|
+
btnTap.textContent = zh ? '点按 +1' : 'Tap +1';
|
|
214
|
+
btnPause.textContent = zh ? '暂停' : 'Pause';
|
|
215
|
+
btnResume.textContent = zh ? '继续' : 'Resume';
|
|
216
|
+
btnFinish.textContent = zh ? '结算' : 'Finish';
|
|
217
|
+
btnShare.textContent = zh ? '分享挑战' : 'Share';
|
|
218
|
+
btnStart.hidden = playing;
|
|
219
|
+
btnTap.hidden = !playing || rs.paused;
|
|
220
|
+
btnPause.hidden = !playing || rs.paused;
|
|
221
|
+
btnResume.hidden = !playing || !rs.paused;
|
|
222
|
+
btnFinish.hidden = !playing;
|
|
223
|
+
btnShare.hidden = playing || score <= 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
btnStart.addEventListener('click', () => {
|
|
227
|
+
score = 0;
|
|
228
|
+
playing = true;
|
|
229
|
+
rs.gameplayStart();
|
|
230
|
+
render();
|
|
231
|
+
});
|
|
232
|
+
btnTap.addEventListener('click', () => {
|
|
233
|
+
score += 1;
|
|
234
|
+
rs.haptics.tap();
|
|
235
|
+
render();
|
|
236
|
+
});
|
|
237
|
+
btnPause.addEventListener('click', () => { rs.pause(); render(); });
|
|
238
|
+
btnResume.addEventListener('click', () => { rs.resume(); render(); });
|
|
239
|
+
btnFinish.addEventListener('click', () => {
|
|
240
|
+
playing = false;
|
|
241
|
+
rs.gameplayStop();
|
|
242
|
+
rs.reportResult({ score, scoreUnit: 'pts', completed: true });
|
|
243
|
+
render();
|
|
244
|
+
});
|
|
245
|
+
btnShare.addEventListener('click', () => {
|
|
246
|
+
rs.shareChallenge({ title: elTitle.textContent + ' — ' + score, score, scoreUnit: 'pts' });
|
|
247
|
+
});
|
|
248
|
+
render();
|
|
249
|
+
</script>
|
|
250
|
+
</body>
|
|
251
|
+
</html>
|
|
252
|
+
`, 'utf8');
|
|
253
|
+
await writeFile(path.join(targetDir, '.github', 'workflows', 'publish-replaystage.yml'), `name: Publish to ReplayStage
|
|
254
|
+
|
|
255
|
+
on:
|
|
256
|
+
push:
|
|
257
|
+
branches:
|
|
258
|
+
- main
|
|
259
|
+
workflow_dispatch:
|
|
260
|
+
|
|
261
|
+
jobs:
|
|
262
|
+
publish:
|
|
263
|
+
uses: replaystage/platform/.github/workflows/publish-game-reusable.yml@main
|
|
264
|
+
with:
|
|
265
|
+
slug: ${slug}
|
|
266
|
+
manifest_path: replaystage.manifest.json
|
|
267
|
+
dist_dir: dist
|
|
268
|
+
build_command: "true"
|
|
269
|
+
package_manager: npm
|
|
270
|
+
secrets:
|
|
271
|
+
REPLAYSTAGE_PUBLISH_TOKEN: \${{ secrets.REPLAYSTAGE_PUBLISH_TOKEN }}
|
|
272
|
+
`, 'utf8');
|
|
273
|
+
}
|
|
274
|
+
emitSuccess(opts, { slug, targetDir, mode, titleEn, titleZh, genre }, () => [
|
|
275
|
+
`Created Tier 2 starter project "${slug}" at ${targetDir} (${mode})`,
|
|
276
|
+
'Next steps:',
|
|
277
|
+
` 1. cd ${targetDir}`,
|
|
278
|
+
' 2. Build your game and run `npx -y replaystage validate ./dist --json`',
|
|
279
|
+
' 3. Publish an unlisted preview with `npx -y replaystage publish ./dist --json`',
|
|
280
|
+
]);
|
|
281
|
+
}
|
|
282
|
+
export async function cmdSdk(args, opts) {
|
|
283
|
+
const [sub, ...restArgs] = args;
|
|
284
|
+
if (sub !== 'sync') {
|
|
285
|
+
throw new CliError('INVALID_ARGUMENTS', 'Usage: replaystage sdk sync [targetDir] [--url <sdkBaseUrl>] [--json]');
|
|
286
|
+
}
|
|
287
|
+
const urlFlag = extractFlag(restArgs, ['--url']);
|
|
288
|
+
assertNoUnknownFlags(urlFlag.rest);
|
|
289
|
+
const targetDir = path.resolve(opts.cwd, urlFlag.rest[0] || 'src/sdk');
|
|
290
|
+
await mkdir(targetDir, { recursive: true });
|
|
291
|
+
const workspaceRoot = await findPlatformWorkspaceRoot(opts.cwd);
|
|
292
|
+
let version = 'unknown';
|
|
293
|
+
let source = '';
|
|
294
|
+
let esmContent;
|
|
295
|
+
let dtsContent;
|
|
296
|
+
if (!urlFlag.value &&
|
|
297
|
+
workspaceRoot &&
|
|
298
|
+
(await exists(path.join(workspaceRoot, 'apps', 'portal', 'public', 'sdk', 'v1', 'replaystage.esm.js')))) {
|
|
299
|
+
const localSdkDir = path.join(workspaceRoot, 'apps', 'portal', 'public', 'sdk', 'v1');
|
|
300
|
+
source = localSdkDir;
|
|
301
|
+
const manifestJson = JSON.parse(await readFile(path.join(localSdkDir, 'manifest.json'), 'utf8'));
|
|
302
|
+
version = manifestJson.version ?? 'unknown';
|
|
303
|
+
esmContent = await readFile(path.join(localSdkDir, 'replaystage.esm.js'), 'utf8');
|
|
304
|
+
dtsContent = await readFile(path.join(localSdkDir, 'replaystage.d.ts'), 'utf8');
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
const base = (urlFlag.value || `${DEFAULT_PORTAL_ORIGIN}/sdk/v1`).replace(/\/+$/, '');
|
|
308
|
+
source = base;
|
|
309
|
+
const fetchText = async (url) => {
|
|
310
|
+
const controller = new AbortController();
|
|
311
|
+
const timer = setTimeout(() => controller.abort(), 20_000);
|
|
312
|
+
try {
|
|
313
|
+
const res = await fetch(url, { signal: controller.signal });
|
|
314
|
+
if (!res.ok) {
|
|
315
|
+
throw new CliError('SDK_FETCH_FAILED', `Failed to fetch ${url}: HTTP ${res.status}`, {
|
|
316
|
+
status: res.status,
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
return await res.text();
|
|
320
|
+
}
|
|
321
|
+
catch (err) {
|
|
322
|
+
if (err instanceof CliError)
|
|
323
|
+
throw err;
|
|
324
|
+
throw new CliError('NETWORK_ERROR', `Failed to fetch ${url}: ${err instanceof Error ? err.message : String(err)}`);
|
|
325
|
+
}
|
|
326
|
+
finally {
|
|
327
|
+
clearTimeout(timer);
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
const [manifestRaw, esmRaw, dtsRaw] = await Promise.all([
|
|
331
|
+
fetchText(`${base}/manifest.json`),
|
|
332
|
+
fetchText(`${base}/replaystage.esm.js`),
|
|
333
|
+
fetchText(`${base}/replaystage.d.ts`),
|
|
334
|
+
]);
|
|
335
|
+
const manifestJson = JSON.parse(manifestRaw);
|
|
336
|
+
version = manifestJson.version ?? 'unknown';
|
|
337
|
+
if (manifestJson.sizes?.esmBytes !== undefined &&
|
|
338
|
+
Buffer.byteLength(esmRaw, 'utf8') !== manifestJson.sizes.esmBytes) {
|
|
339
|
+
throw new CliError('SDK_INTEGRITY_MISMATCH', `Downloaded replaystage.esm.js size (${Buffer.byteLength(esmRaw, 'utf8')} B) does not match manifest (${manifestJson.sizes.esmBytes} B).`);
|
|
340
|
+
}
|
|
341
|
+
esmContent = esmRaw;
|
|
342
|
+
dtsContent = dtsRaw;
|
|
343
|
+
}
|
|
344
|
+
const esmPath = path.join(targetDir, 'replaystage.esm.js');
|
|
345
|
+
const dtsPath = path.join(targetDir, 'replaystage.esm.d.ts');
|
|
346
|
+
await Promise.all([
|
|
347
|
+
writeFile(esmPath, esmContent, 'utf8'),
|
|
348
|
+
writeFile(dtsPath, dtsContent, 'utf8'),
|
|
349
|
+
]);
|
|
350
|
+
const esmBytes = Buffer.byteLength(esmContent, 'utf8');
|
|
351
|
+
emitSuccess(opts, {
|
|
352
|
+
version,
|
|
353
|
+
source,
|
|
354
|
+
targetDir,
|
|
355
|
+
files: [esmPath, dtsPath],
|
|
356
|
+
esmBytes,
|
|
357
|
+
}, () => [
|
|
358
|
+
`Synced @replaystage/sdk v${version} (${formatBytes(esmBytes)}) -> ${targetDir}`,
|
|
359
|
+
` ${esmPath}`,
|
|
360
|
+
` ${dtsPath}`,
|
|
361
|
+
]);
|
|
362
|
+
}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { type GlobalOptions } from '../output.js';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export declare function cmdValidate(args: string[], opts: GlobalOptions): Promise<void>;
|
|
5
|
-
export declare function cmdPublish(args: string[], opts: GlobalOptions): Promise<void>;
|
|
2
|
+
export { cmdCreateGame, cmdInit, cmdSdk } from './creator-scaffold.js';
|
|
3
|
+
export { cmdPublish, cmdReleases, cmdRollback, cmdValidate } from './creator-publish.js';
|
|
6
4
|
export declare function cmdUpdate(args: string[], opts: GlobalOptions): Promise<void>;
|
|
7
5
|
export declare function cmdDelete(args: string[], opts: GlobalOptions): Promise<void>;
|
|
8
|
-
export declare function cmdSdk(args: string[], opts: GlobalOptions): Promise<void>;
|
|
9
6
|
export declare function cmdGames(args: string[], opts: GlobalOptions): Promise<void>;
|
|
10
|
-
export declare function cmdReleases(args: string[], opts: GlobalOptions): Promise<void>;
|
|
11
|
-
export declare function cmdRollback(args: string[], opts: GlobalOptions): Promise<void>;
|
|
12
7
|
export declare function cmdVisibility(args: string[], opts: GlobalOptions): Promise<void>;
|
|
13
8
|
export declare function cmdTokens(args: string[], opts: GlobalOptions): Promise<void>;
|
|
14
9
|
export declare function cmdStats(args: string[], opts: GlobalOptions): Promise<void>;
|