@rodyssey/cli 0.1.0 → 0.1.2
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/cli.js +150 -81
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __getProtoOf = Object.getPrototypeOf;
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -17,7 +17,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
20
|
-
var __require = import.meta.
|
|
20
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
21
21
|
|
|
22
22
|
// node_modules/commander/lib/error.js
|
|
23
23
|
var require_error = __commonJS((exports) => {
|
|
@@ -725,11 +725,11 @@ var require_suggestSimilar = __commonJS((exports) => {
|
|
|
725
725
|
|
|
726
726
|
// node_modules/commander/lib/command.js
|
|
727
727
|
var require_command = __commonJS((exports) => {
|
|
728
|
-
var EventEmitter = __require("events").EventEmitter;
|
|
729
|
-
var childProcess = __require("child_process");
|
|
730
|
-
var path = __require("path");
|
|
731
|
-
var fs = __require("fs");
|
|
732
|
-
var process2 = __require("process");
|
|
728
|
+
var EventEmitter = __require("node:events").EventEmitter;
|
|
729
|
+
var childProcess = __require("node:child_process");
|
|
730
|
+
var path = __require("node:path");
|
|
731
|
+
var fs = __require("node:fs");
|
|
732
|
+
var process2 = __require("node:process");
|
|
733
733
|
var { Argument, humanReadableArgName } = require_argument();
|
|
734
734
|
var { CommanderError } = require_error();
|
|
735
735
|
var { Help, stripColor } = require_help();
|
|
@@ -2070,13 +2070,13 @@ var {
|
|
|
2070
2070
|
} = import__.default;
|
|
2071
2071
|
|
|
2072
2072
|
// src/create.ts
|
|
2073
|
-
import { execSync } from "child_process";
|
|
2074
|
-
import { existsSync, rmSync } from "fs";
|
|
2075
|
-
import path2 from "path";
|
|
2073
|
+
import { execSync } from "node:child_process";
|
|
2074
|
+
import { existsSync, rmSync } from "node:fs";
|
|
2075
|
+
import path2 from "node:path";
|
|
2076
2076
|
|
|
2077
2077
|
// src/utils.ts
|
|
2078
|
-
import { readFileSync, writeFileSync } from "fs";
|
|
2079
|
-
import path from "path";
|
|
2078
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
2079
|
+
import path from "node:path";
|
|
2080
2080
|
function replaceInFile(filePath, search, replace) {
|
|
2081
2081
|
const content = readFileSync(filePath, "utf-8");
|
|
2082
2082
|
const updated = content.replaceAll(search, replace);
|
|
@@ -2104,12 +2104,12 @@ async function create(projectName, repoUrl, templateName) {
|
|
|
2104
2104
|
const targetDir = path2.resolve(process.cwd(), projectName);
|
|
2105
2105
|
if (existsSync(targetDir)) {
|
|
2106
2106
|
console.error(`
|
|
2107
|
-
|
|
2107
|
+
✖ Directory "${projectName}" already exists.
|
|
2108
2108
|
`);
|
|
2109
2109
|
process.exit(1);
|
|
2110
2110
|
}
|
|
2111
2111
|
console.log(`
|
|
2112
|
-
|
|
2112
|
+
⏳ Cloning template "${templateName}"...
|
|
2113
2113
|
`);
|
|
2114
2114
|
try {
|
|
2115
2115
|
execSync(`git clone --depth 1 ${repoUrl} ${projectName}`, {
|
|
@@ -2118,7 +2118,7 @@ async function create(projectName, repoUrl, templateName) {
|
|
|
2118
2118
|
});
|
|
2119
2119
|
} catch {
|
|
2120
2120
|
console.error(`
|
|
2121
|
-
|
|
2121
|
+
✖ Failed to clone template. Make sure you have SSH access to the repo.
|
|
2122
2122
|
`);
|
|
2123
2123
|
process.exit(1);
|
|
2124
2124
|
}
|
|
@@ -2134,7 +2134,7 @@ async function create(projectName, repoUrl, templateName) {
|
|
|
2134
2134
|
}
|
|
2135
2135
|
execSync("git init", { stdio: "ignore", cwd: targetDir });
|
|
2136
2136
|
console.log(`
|
|
2137
|
-
|
|
2137
|
+
✅ Project "${projectName}" created successfully!
|
|
2138
2138
|
|
|
2139
2139
|
Next steps:
|
|
2140
2140
|
|
|
@@ -2145,10 +2145,9 @@ async function create(projectName, repoUrl, templateName) {
|
|
|
2145
2145
|
}
|
|
2146
2146
|
|
|
2147
2147
|
// src/deploy.ts
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
import {
|
|
2151
|
-
import { join } from "path";
|
|
2148
|
+
import { execSync as execSync2 } from "node:child_process";
|
|
2149
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, readdirSync, statSync, unlinkSync } from "node:fs";
|
|
2150
|
+
import { join } from "node:path";
|
|
2152
2151
|
var DEVELOPMENT_URL = "https://development-cms.rodyssey.ai/api/webapps/deploy";
|
|
2153
2152
|
var STAGING_URL = "https://staging-cms.rodyssey.ai/api/webapps/deploy";
|
|
2154
2153
|
var PRODUCTION_URL = "https://cms.rodyssey.ai/api/webapps/deploy";
|
|
@@ -2175,10 +2174,14 @@ function getAllFiles(dirPath, arrayOfFiles = []) {
|
|
|
2175
2174
|
});
|
|
2176
2175
|
return arrayOfFiles;
|
|
2177
2176
|
}
|
|
2177
|
+
function fileToBlob(filePath) {
|
|
2178
|
+
const buffer = readFileSync2(filePath);
|
|
2179
|
+
return new Blob([buffer]);
|
|
2180
|
+
}
|
|
2178
2181
|
async function deploy(env = "development") {
|
|
2179
2182
|
const DEPLOY_URL = DEPLOY_URLS[env];
|
|
2180
2183
|
if (!DEPLOY_URL) {
|
|
2181
|
-
console.error(
|
|
2184
|
+
console.error(`❌ Unknown environment "${env}". Available: ${Object.keys(DEPLOY_URLS).join(", ")}`);
|
|
2182
2185
|
process.exit(1);
|
|
2183
2186
|
}
|
|
2184
2187
|
const ASSETS_URL = DEPLOY_URL.replace("/webapps/deploy", "/webapps/assets");
|
|
@@ -2188,13 +2191,13 @@ async function deploy(env = "development") {
|
|
|
2188
2191
|
console.log(`\uD83D\uDCCD Assets URL: ${ASSETS_URL}
|
|
2189
2192
|
`);
|
|
2190
2193
|
if (!process.env.DEPLOY_TOKEN) {
|
|
2191
|
-
console.error("
|
|
2194
|
+
console.error("❌ Error: DEPLOY_TOKEN is not set in environment variables.");
|
|
2192
2195
|
console.info(`\uD83D\uDCA1 Please check your .env or .env.${env} file.`);
|
|
2193
2196
|
process.exit(1);
|
|
2194
2197
|
}
|
|
2195
2198
|
console.log("\uD83D\uDCE6 Step 1: Building the webapp...");
|
|
2196
|
-
|
|
2197
|
-
console.log(
|
|
2199
|
+
execSync2("npm run build", { stdio: "inherit" });
|
|
2200
|
+
console.log(`✅ Build completed
|
|
2198
2201
|
`);
|
|
2199
2202
|
const allFiles = getAllFiles(BUILD_DIR);
|
|
2200
2203
|
const htmlFiles = allFiles.filter((f) => f.endsWith(".html"));
|
|
@@ -2224,7 +2227,7 @@ async function deploy(env = "development") {
|
|
|
2224
2227
|
const formData = new FormData;
|
|
2225
2228
|
for (const filePath of batch) {
|
|
2226
2229
|
const relativePath = filePath.substring(BUILD_DIR.length + 1).replace(/\\/g, "/");
|
|
2227
|
-
formData.append(relativePath,
|
|
2230
|
+
formData.append(relativePath, fileToBlob(filePath), relativePath);
|
|
2228
2231
|
}
|
|
2229
2232
|
const response = await fetch(ASSETS_URL, {
|
|
2230
2233
|
method: "POST",
|
|
@@ -2239,18 +2242,18 @@ async function deploy(env = "development") {
|
|
|
2239
2242
|
${errorText}`);
|
|
2240
2243
|
}
|
|
2241
2244
|
batchIndex++;
|
|
2242
|
-
console.log(
|
|
2245
|
+
console.log(`✅ Batch ${batchIndex}/${batches.length} uploaded successfully`);
|
|
2243
2246
|
});
|
|
2244
2247
|
await Promise.all(uploadPromises);
|
|
2245
2248
|
} else {
|
|
2246
|
-
console.log("
|
|
2249
|
+
console.log("✅ No heavy assets to upload");
|
|
2247
2250
|
}
|
|
2248
2251
|
console.log();
|
|
2249
2252
|
if (scriptFiles.length > 0) {
|
|
2250
2253
|
console.log(`\uD83D\uDCDC Step 3: Setting up ${scriptFiles.length} scripts (APIs & Crons)...`);
|
|
2251
2254
|
const scriptsPayload = { api: {}, cron: {}, cronConfig: null };
|
|
2252
2255
|
for (const f of scriptFiles) {
|
|
2253
|
-
const content =
|
|
2256
|
+
const content = readFileSync2(f, "utf-8");
|
|
2254
2257
|
const relativePath = f.substring(BUILD_DIR.length + 1).replace(/\\/g, "/");
|
|
2255
2258
|
if (relativePath === "cron-jobs/cron.config.json") {
|
|
2256
2259
|
scriptsPayload.cronConfig = JSON.parse(content);
|
|
@@ -2276,21 +2279,21 @@ ${errorText}`);
|
|
|
2276
2279
|
throw new Error(`Scripts setup failed: ${response.status} ${response.statusText}
|
|
2277
2280
|
${errorText}`);
|
|
2278
2281
|
}
|
|
2279
|
-
console.log(
|
|
2282
|
+
console.log(`✅ Scripts synced successfully`);
|
|
2280
2283
|
} else {
|
|
2281
2284
|
console.log(`\uD83D\uDCDC Step 3: No scripts found to sync.`);
|
|
2282
2285
|
}
|
|
2283
2286
|
console.log();
|
|
2284
|
-
console.log(`\uD83D\uDDDC
|
|
2287
|
+
console.log(`\uD83D\uDDDC️ Step 4: Zipping ${htmlFiles.length} HTML files...`);
|
|
2285
2288
|
if (htmlFiles.length === 0) {
|
|
2286
|
-
console.warn("
|
|
2289
|
+
console.warn("⚠️ No HTML files found to zip! Deployment might fail if CMS expects an HTML file.");
|
|
2287
2290
|
}
|
|
2288
2291
|
const relativeHtmlFiles = htmlFiles.map((f) => f.substring(BUILD_DIR.length + 1).replace(/\\/g, "/"));
|
|
2289
|
-
|
|
2290
|
-
console.log(
|
|
2292
|
+
execSync2(`cd ${BUILD_DIR} && zip ../${ZIP_FILE} ${relativeHtmlFiles.join(" ")}`, { stdio: "inherit" });
|
|
2293
|
+
console.log(`✅ Created ${ZIP_FILE}
|
|
2291
2294
|
`);
|
|
2292
|
-
console.log("
|
|
2293
|
-
const
|
|
2295
|
+
console.log("☁️ Step 5: Deploying HTML zip to server...");
|
|
2296
|
+
const zipBuffer = readFileSync2(ZIP_FILE);
|
|
2294
2297
|
try {
|
|
2295
2298
|
const response = await fetch(DEPLOY_URL, {
|
|
2296
2299
|
method: "POST",
|
|
@@ -2298,7 +2301,7 @@ ${errorText}`);
|
|
|
2298
2301
|
Authorization: `Bearer ${process.env.DEPLOY_TOKEN}`,
|
|
2299
2302
|
"Content-Type": "application/zip"
|
|
2300
2303
|
},
|
|
2301
|
-
body:
|
|
2304
|
+
body: zipBuffer
|
|
2302
2305
|
});
|
|
2303
2306
|
if (!response.ok) {
|
|
2304
2307
|
const errorText = await response.text();
|
|
@@ -2306,26 +2309,26 @@ ${errorText}`);
|
|
|
2306
2309
|
${errorText}`);
|
|
2307
2310
|
}
|
|
2308
2311
|
const result = await response.json();
|
|
2309
|
-
console.log("
|
|
2312
|
+
console.log("✅ Deploy completed");
|
|
2310
2313
|
console.log(`
|
|
2311
2314
|
\uD83D\uDCCB Deployment result:`, result);
|
|
2312
2315
|
} catch (error) {
|
|
2313
|
-
console.error("
|
|
2316
|
+
console.error("❌ Deploy failed:", error);
|
|
2314
2317
|
throw error;
|
|
2315
2318
|
} finally {
|
|
2316
2319
|
if (existsSync2(ZIP_FILE)) {
|
|
2317
|
-
|
|
2320
|
+
unlinkSync(ZIP_FILE);
|
|
2318
2321
|
console.log(`
|
|
2319
2322
|
\uD83E\uDDF9 Cleaned up ${ZIP_FILE}`);
|
|
2320
2323
|
}
|
|
2321
2324
|
}
|
|
2322
2325
|
console.log(`
|
|
2323
|
-
|
|
2326
|
+
✨ Deployment successful!`);
|
|
2324
2327
|
}
|
|
2325
2328
|
|
|
2326
|
-
// src/upgrade-
|
|
2327
|
-
import { execSync as
|
|
2328
|
-
import { existsSync as existsSync3 } from "fs";
|
|
2329
|
+
// src/upgrade-template.ts
|
|
2330
|
+
import { execSync as execSync3 } from "node:child_process";
|
|
2331
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync, copyFileSync, rmSync as rmSync2 } from "node:fs";
|
|
2329
2332
|
var TEMPLATES = {
|
|
2330
2333
|
webapp: {
|
|
2331
2334
|
name: "webapp (SPA)",
|
|
@@ -2352,6 +2355,11 @@ var TEMPLATES = {
|
|
|
2352
2355
|
]
|
|
2353
2356
|
}
|
|
2354
2357
|
};
|
|
2358
|
+
var CLI_SCRIPTS = {
|
|
2359
|
+
"link-game-sdk": "bunx @rodyssey/cli app update-game-sdk",
|
|
2360
|
+
deploy: "bunx @rodyssey/cli app deploy",
|
|
2361
|
+
"upgrade-template": "bunx @rodyssey/cli app upgrade-template"
|
|
2362
|
+
};
|
|
2355
2363
|
function detectTemplate() {
|
|
2356
2364
|
if (existsSync3("app")) {
|
|
2357
2365
|
console.log(`\uD83D\uDD0D Detected fullstack template (found app/ directory)
|
|
@@ -2363,52 +2371,113 @@ function detectTemplate() {
|
|
|
2363
2371
|
`);
|
|
2364
2372
|
return TEMPLATES["webapp"];
|
|
2365
2373
|
}
|
|
2366
|
-
console.log(
|
|
2374
|
+
console.log(`⚠️ Could not detect template type, defaulting to SPA
|
|
2367
2375
|
`);
|
|
2368
2376
|
return TEMPLATES["webapp"];
|
|
2369
2377
|
}
|
|
2370
|
-
|
|
2378
|
+
function updatePackageJsonScripts() {
|
|
2379
|
+
const pkgPath = "package.json";
|
|
2380
|
+
if (!existsSync3(pkgPath)) {
|
|
2381
|
+
console.log("⚠️ No package.json found, skipping scripts update");
|
|
2382
|
+
return;
|
|
2383
|
+
}
|
|
2384
|
+
const pkg = JSON.parse(readFileSync3(pkgPath, "utf-8"));
|
|
2385
|
+
if (!pkg.scripts) {
|
|
2386
|
+
pkg.scripts = {};
|
|
2387
|
+
}
|
|
2388
|
+
let updated = false;
|
|
2389
|
+
for (const [name, cmd] of Object.entries(CLI_SCRIPTS)) {
|
|
2390
|
+
if (pkg.scripts[name] !== cmd) {
|
|
2391
|
+
const action = pkg.scripts[name] ? "Updated" : "Added";
|
|
2392
|
+
pkg.scripts[name] = cmd;
|
|
2393
|
+
console.log(` \uD83D\uDCDD ${action} script: "${name}"`);
|
|
2394
|
+
updated = true;
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
if (updated) {
|
|
2398
|
+
writeFileSync2(pkgPath, JSON.stringify(pkg, null, 2) + `
|
|
2399
|
+
`, "utf-8");
|
|
2400
|
+
console.log(`✅ package.json scripts updated
|
|
2401
|
+
`);
|
|
2402
|
+
} else {
|
|
2403
|
+
console.log(`✅ package.json scripts already up to date
|
|
2404
|
+
`);
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
function updateCliSkill() {
|
|
2408
|
+
const cliRemote = "ro-cli";
|
|
2409
|
+
const cliRepo = "https://github.com/airconcepts/ro-cli.git";
|
|
2410
|
+
try {
|
|
2411
|
+
let remoteExists = false;
|
|
2412
|
+
try {
|
|
2413
|
+
execSync3(`git remote get-url ${cliRemote}`, { stdio: "ignore" });
|
|
2414
|
+
remoteExists = true;
|
|
2415
|
+
} catch {}
|
|
2416
|
+
if (!remoteExists) {
|
|
2417
|
+
console.log(` ➕ Adding remote '${cliRemote}'...`);
|
|
2418
|
+
execSync3(`git remote add ${cliRemote} ${cliRepo}`, { stdio: "inherit" });
|
|
2419
|
+
}
|
|
2420
|
+
execSync3(`git fetch ${cliRemote}`, { stdio: "inherit" });
|
|
2421
|
+
execSync3(`git checkout ${cliRemote}/main -- skills/ro-cli/SKILL.md`, { stdio: "inherit" });
|
|
2422
|
+
if (existsSync3("skills/ro-cli/SKILL.md")) {
|
|
2423
|
+
mkdirSync(".agent/skills/ro-cli", { recursive: true });
|
|
2424
|
+
copyFileSync("skills/ro-cli/SKILL.md", ".agent/skills/ro-cli/SKILL.md");
|
|
2425
|
+
rmSync2("skills", { recursive: true, force: true });
|
|
2426
|
+
console.log(` ✅ CLI skill updated
|
|
2427
|
+
`);
|
|
2428
|
+
}
|
|
2429
|
+
} catch (error) {
|
|
2430
|
+
console.log(` ⚠️ Failed to update CLI skill: ${error instanceof Error ? error.message : error}
|
|
2431
|
+
`);
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
async function upgradeTemplate() {
|
|
2371
2435
|
const template = detectTemplate();
|
|
2372
2436
|
try {
|
|
2373
|
-
console.log(`\uD83D\uDD04 Starting
|
|
2437
|
+
console.log(`\uD83D\uDD04 Starting template upgrade for ${template.name}...`);
|
|
2374
2438
|
let remoteExists = false;
|
|
2375
2439
|
try {
|
|
2376
|
-
|
|
2440
|
+
execSync3(`git remote get-url ${template.remoteName}`, { stdio: "ignore" });
|
|
2377
2441
|
remoteExists = true;
|
|
2378
2442
|
} catch {}
|
|
2379
2443
|
if (!remoteExists) {
|
|
2380
|
-
console.log(
|
|
2381
|
-
|
|
2444
|
+
console.log(`➕ Adding remote '${template.remoteName}'...`);
|
|
2445
|
+
execSync3(`git remote add ${template.remoteName} ${template.repo}`, { stdio: "inherit" });
|
|
2382
2446
|
} else {
|
|
2383
|
-
console.log(
|
|
2447
|
+
console.log(`ℹ️ Remote '${template.remoteName}' already exists.`);
|
|
2384
2448
|
}
|
|
2385
|
-
console.log("
|
|
2386
|
-
|
|
2387
|
-
console.log("\uD83D\uDCC2 Updating
|
|
2449
|
+
console.log("⬇️ Fetching latest changes from template...");
|
|
2450
|
+
execSync3(`git fetch ${template.remoteName}`, { stdio: "inherit" });
|
|
2451
|
+
console.log("\uD83D\uDCC2 Updating template files...");
|
|
2388
2452
|
const checkoutList = template.checkoutFiles.join(" ");
|
|
2389
|
-
|
|
2390
|
-
for (const
|
|
2391
|
-
if (!existsSync3(
|
|
2392
|
-
console.log(`\uD83D\uDCC2 Checking out ${
|
|
2453
|
+
execSync3(`git checkout ${template.remoteName}/main -- ${checkoutList}`, { stdio: "inherit" });
|
|
2454
|
+
for (const file of template.newFiles) {
|
|
2455
|
+
if (!existsSync3(file)) {
|
|
2456
|
+
console.log(`\uD83D\uDCC2 Checking out ${file}...`);
|
|
2393
2457
|
try {
|
|
2394
|
-
|
|
2458
|
+
execSync3(`git checkout ${template.remoteName}/main -- ${file}`, { stdio: "inherit" });
|
|
2395
2459
|
} catch {
|
|
2396
|
-
console.log(
|
|
2460
|
+
console.log(`⚠️ Failed to checkout ${file}`);
|
|
2397
2461
|
}
|
|
2398
2462
|
} else {
|
|
2399
|
-
console.log(
|
|
2463
|
+
console.log(`⏭️ Skipping ${file} (already exists)`);
|
|
2400
2464
|
}
|
|
2401
2465
|
}
|
|
2402
|
-
console.log(
|
|
2466
|
+
console.log(`
|
|
2467
|
+
\uD83D\uDD27 Updating CLI skill documentation...`);
|
|
2468
|
+
updateCliSkill();
|
|
2469
|
+
console.log("\uD83D\uDCE6 Updating package.json scripts...");
|
|
2470
|
+
updatePackageJsonScripts();
|
|
2471
|
+
console.log("✅ Template upgrade complete! Please check git status for changes.");
|
|
2403
2472
|
} catch (error) {
|
|
2404
|
-
console.error("
|
|
2473
|
+
console.error("❌ Upgrade failed:", error);
|
|
2405
2474
|
process.exit(1);
|
|
2406
2475
|
}
|
|
2407
2476
|
}
|
|
2408
2477
|
|
|
2409
2478
|
// src/update-game-sdk.ts
|
|
2410
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
2411
|
-
import { dirname, join as join2 } from "path";
|
|
2479
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
2480
|
+
import { dirname, join as join2 } from "node:path";
|
|
2412
2481
|
var BASE_URL = "https://development-app.rodyssey.ai";
|
|
2413
2482
|
var FILES = [
|
|
2414
2483
|
{
|
|
@@ -2441,11 +2510,11 @@ async function downloadFile(url, path3, description) {
|
|
|
2441
2510
|
const dir = dirname(path3);
|
|
2442
2511
|
await mkdir(dir, { recursive: true });
|
|
2443
2512
|
await writeFile(path3, content, "utf-8");
|
|
2444
|
-
console.log(
|
|
2513
|
+
console.log(`✅ Downloaded ${description} (${content.length} bytes)
|
|
2445
2514
|
`);
|
|
2446
2515
|
return true;
|
|
2447
2516
|
} catch (error) {
|
|
2448
|
-
console.error(
|
|
2517
|
+
console.error(`❌ Failed to download ${description}:`);
|
|
2449
2518
|
console.error(` ${error instanceof Error ? error.message : String(error)}
|
|
2450
2519
|
`);
|
|
2451
2520
|
return false;
|
|
@@ -2462,14 +2531,14 @@ async function downloadManifest() {
|
|
|
2462
2531
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
2463
2532
|
}
|
|
2464
2533
|
const manifest = await response.json();
|
|
2465
|
-
console.log(
|
|
2534
|
+
console.log(`✅ Manifest downloaded successfully`);
|
|
2466
2535
|
console.log(` Name: ${manifest.name}`);
|
|
2467
2536
|
console.log(` Version: ${manifest.version}`);
|
|
2468
2537
|
console.log(` Documentation files: ${manifest.documentation.length}
|
|
2469
2538
|
`);
|
|
2470
2539
|
return manifest;
|
|
2471
2540
|
} catch (error) {
|
|
2472
|
-
console.error("
|
|
2541
|
+
console.error("❌ Failed to download manifest:");
|
|
2473
2542
|
console.error(` ${error instanceof Error ? error.message : String(error)}
|
|
2474
2543
|
`);
|
|
2475
2544
|
return null;
|
|
@@ -2493,9 +2562,9 @@ async function downloadDocumentation(manifest) {
|
|
|
2493
2562
|
}
|
|
2494
2563
|
console.log(`
|
|
2495
2564
|
\uD83D\uDCCA Documentation download summary:`);
|
|
2496
|
-
console.log(`
|
|
2565
|
+
console.log(` ✅ Success: ${successCount}`);
|
|
2497
2566
|
if (failCount > 0) {
|
|
2498
|
-
console.log(`
|
|
2567
|
+
console.log(` ❌ Failed: ${failCount}`);
|
|
2499
2568
|
}
|
|
2500
2569
|
console.log();
|
|
2501
2570
|
return { successCount, failCount };
|
|
@@ -2508,8 +2577,8 @@ async function updateGameSdk() {
|
|
|
2508
2577
|
let totalFail = 0;
|
|
2509
2578
|
console.log(`\uD83D\uDCE6 Downloading core SDK files...
|
|
2510
2579
|
`);
|
|
2511
|
-
for (const
|
|
2512
|
-
const success = await downloadFile(
|
|
2580
|
+
for (const file of FILES) {
|
|
2581
|
+
const success = await downloadFile(file.url, file.path, file.description);
|
|
2513
2582
|
if (success) {
|
|
2514
2583
|
totalSuccess++;
|
|
2515
2584
|
} else {
|
|
@@ -2522,22 +2591,22 @@ async function updateGameSdk() {
|
|
|
2522
2591
|
totalSuccess += successCount;
|
|
2523
2592
|
totalFail += failCount;
|
|
2524
2593
|
} else {
|
|
2525
|
-
console.log(
|
|
2594
|
+
console.log(`⚠️ Skipping documentation download due to manifest error
|
|
2526
2595
|
`);
|
|
2527
2596
|
}
|
|
2528
2597
|
console.log("=".repeat(60));
|
|
2529
2598
|
console.log(`\uD83C\uDF89 Download Complete!
|
|
2530
2599
|
`);
|
|
2531
2600
|
console.log(`\uD83D\uDCCA Final Summary:`);
|
|
2532
|
-
console.log(`
|
|
2601
|
+
console.log(` ✅ Successfully downloaded: ${totalSuccess} files`);
|
|
2533
2602
|
if (totalFail > 0) {
|
|
2534
|
-
console.log(`
|
|
2603
|
+
console.log(` ❌ Failed: ${totalFail} files`);
|
|
2535
2604
|
console.log(`
|
|
2536
|
-
|
|
2605
|
+
⚠️ Some files failed to download. Please check the errors above.`);
|
|
2537
2606
|
process.exit(1);
|
|
2538
2607
|
} else {
|
|
2539
2608
|
console.log(`
|
|
2540
|
-
|
|
2609
|
+
✨ All files downloaded successfully!`);
|
|
2541
2610
|
}
|
|
2542
2611
|
}
|
|
2543
2612
|
|
|
@@ -2560,10 +2629,10 @@ async function selectTemplate() {
|
|
|
2560
2629
|
Available templates:
|
|
2561
2630
|
`);
|
|
2562
2631
|
entries.forEach((t, i) => {
|
|
2563
|
-
console.log(` ${i + 1}. ${t.name}
|
|
2632
|
+
console.log(` ${i + 1}. ${t.name} — ${t.description}`);
|
|
2564
2633
|
});
|
|
2565
2634
|
console.log();
|
|
2566
|
-
const readline = await import("readline");
|
|
2635
|
+
const readline = await import("node:readline");
|
|
2567
2636
|
const rl = readline.createInterface({
|
|
2568
2637
|
input: process.stdin,
|
|
2569
2638
|
output: process.stdout
|
|
@@ -2603,7 +2672,7 @@ app.command("update-game-sdk").description("Download and update the GameSDK libr
|
|
|
2603
2672
|
app.command("deploy").description("Build and deploy the webapp to the server").option("-e, --env <environment>", "Target environment (development | staging | production)", "development").action(async (options) => {
|
|
2604
2673
|
await deploy(options.env);
|
|
2605
2674
|
});
|
|
2606
|
-
app.command("upgrade-
|
|
2607
|
-
await
|
|
2675
|
+
app.command("upgrade-template").description("Upgrade template files and CLI scripts from the template repository").action(async () => {
|
|
2676
|
+
await upgradeTemplate();
|
|
2608
2677
|
});
|
|
2609
2678
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rodyssey/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Scaffold new projects from airconcepts templates",
|
|
5
5
|
"bin": {
|
|
6
6
|
"@rodyssey/cli": "dist/cli.js"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"module": "index.ts",
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "bun build src/cli.ts --outdir dist --target
|
|
14
|
+
"build": "bun build src/cli.ts --outdir dist --target node",
|
|
15
15
|
"start": "bun dist/cli.js",
|
|
16
16
|
"prepublishOnly": "bun run build"
|
|
17
17
|
},
|
|
@@ -24,4 +24,4 @@
|
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"typescript": "^5"
|
|
26
26
|
}
|
|
27
|
-
}
|
|
27
|
+
}
|