playcademy 0.6.0 → 0.7.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/dist/index.js +194 -180
- package/dist/utils.js +54 -48
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -64,6 +64,7 @@ var init_package_json = __esm({
|
|
|
64
64
|
var file_loader_exports = {};
|
|
65
65
|
__export(file_loader_exports, {
|
|
66
66
|
findFile: () => findFile,
|
|
67
|
+
getCurrentDirectoryName: () => getCurrentDirectoryName,
|
|
67
68
|
getFileExtension: () => getFileExtension,
|
|
68
69
|
getPackageField: () => getPackageField,
|
|
69
70
|
getPackageName: () => getPackageName,
|
|
@@ -202,6 +203,11 @@ async function getPackageNameVersion(options) {
|
|
|
202
203
|
}
|
|
203
204
|
return getPackageNameVersionFromData(pkg);
|
|
204
205
|
}
|
|
206
|
+
function getCurrentDirectoryName(fallback = "unknown-directory") {
|
|
207
|
+
const cwd = process.cwd();
|
|
208
|
+
const dirName = cwd.split("/").pop();
|
|
209
|
+
return dirName || fallback;
|
|
210
|
+
}
|
|
205
211
|
function getFileExtension(path) {
|
|
206
212
|
return path.split(".").pop()?.toLowerCase();
|
|
207
213
|
}
|
|
@@ -9180,6 +9186,178 @@ var init_client = __esm2(() => {
|
|
|
9180
9186
|
init_client();
|
|
9181
9187
|
init_messaging();
|
|
9182
9188
|
|
|
9189
|
+
// src/lib/core/logger.ts
|
|
9190
|
+
import {
|
|
9191
|
+
blue,
|
|
9192
|
+
bold,
|
|
9193
|
+
cyan,
|
|
9194
|
+
dim,
|
|
9195
|
+
gray,
|
|
9196
|
+
green,
|
|
9197
|
+
greenBright,
|
|
9198
|
+
red,
|
|
9199
|
+
yellow,
|
|
9200
|
+
yellowBright
|
|
9201
|
+
} from "colorette";
|
|
9202
|
+
import { colorize } from "json-colorizer";
|
|
9203
|
+
function customTransform(text2) {
|
|
9204
|
+
const highlightCode = (text3) => text3.replace(/`([^`]+)`/g, (_, code) => greenBright(code));
|
|
9205
|
+
return highlightCode(text2);
|
|
9206
|
+
}
|
|
9207
|
+
var logger = {
|
|
9208
|
+
table: (data) => {
|
|
9209
|
+
console.table(data);
|
|
9210
|
+
},
|
|
9211
|
+
/**
|
|
9212
|
+
* Info message - general information
|
|
9213
|
+
*/
|
|
9214
|
+
info: (message, indent = 0) => {
|
|
9215
|
+
const spaces = " ".repeat(indent);
|
|
9216
|
+
console.log(`${spaces}${blue("\u2139")} ${bold(customTransform(message))}`);
|
|
9217
|
+
},
|
|
9218
|
+
/**
|
|
9219
|
+
* Admonition - highlighted note/tip/warning box (Docusaurus-style)
|
|
9220
|
+
*/
|
|
9221
|
+
admonition: (type, title, lines, indent = 0) => {
|
|
9222
|
+
const spaces = " ".repeat(indent);
|
|
9223
|
+
const configs = {
|
|
9224
|
+
note: { color: green },
|
|
9225
|
+
tip: { color: cyan },
|
|
9226
|
+
info: { color: blue },
|
|
9227
|
+
warning: { color: yellow }
|
|
9228
|
+
};
|
|
9229
|
+
const { color: color2 } = configs[type];
|
|
9230
|
+
console.log(`${spaces}${color2("\u250C\u2500")} ${bold(color2(title.toUpperCase()))}`);
|
|
9231
|
+
if (lines && lines.length > 0) {
|
|
9232
|
+
lines.forEach((line2) => {
|
|
9233
|
+
console.log(`${spaces}${color2("\u2502")} ${customTransform(line2)}`);
|
|
9234
|
+
});
|
|
9235
|
+
}
|
|
9236
|
+
console.log(`${spaces}${color2("\u2514\u2500")}`);
|
|
9237
|
+
},
|
|
9238
|
+
/**
|
|
9239
|
+
* Dim message - less important information
|
|
9240
|
+
*/
|
|
9241
|
+
dim: (message, indent = 0) => {
|
|
9242
|
+
const spaces = " ".repeat(indent);
|
|
9243
|
+
console.log(`${spaces}${dim(customTransform(message))}`);
|
|
9244
|
+
},
|
|
9245
|
+
/**
|
|
9246
|
+
* Success message - operation completed successfully
|
|
9247
|
+
*/
|
|
9248
|
+
success: (message, indent = 0) => {
|
|
9249
|
+
const spaces = " ".repeat(indent);
|
|
9250
|
+
console.log(`${spaces}${green("\u2714")} ${bold(customTransform(message))}`);
|
|
9251
|
+
},
|
|
9252
|
+
remark: (message, indent = 0) => {
|
|
9253
|
+
const spaces = " ".repeat(indent);
|
|
9254
|
+
console.log(`${spaces}${bold(yellowBright("\u2726"))} ${bold(customTransform(message))}`);
|
|
9255
|
+
},
|
|
9256
|
+
/**
|
|
9257
|
+
* Error message - operation failed
|
|
9258
|
+
*/
|
|
9259
|
+
error: (message, indent = 0) => {
|
|
9260
|
+
const spaces = " ".repeat(indent);
|
|
9261
|
+
console.error(`${spaces}${red("\u2716")} ${customTransform(message)}`);
|
|
9262
|
+
},
|
|
9263
|
+
bold: (message, indent = 0) => {
|
|
9264
|
+
const spaces = " ".repeat(indent);
|
|
9265
|
+
console.log(`${spaces}${bold(customTransform(message))}`);
|
|
9266
|
+
},
|
|
9267
|
+
/**
|
|
9268
|
+
* Warning message - something to be aware of
|
|
9269
|
+
*/
|
|
9270
|
+
warn: (message, indent = 0) => {
|
|
9271
|
+
const spaces = " ".repeat(indent);
|
|
9272
|
+
console.warn(`${spaces}${yellow("\u26A0")} ${bold(customTransform(message))}`);
|
|
9273
|
+
},
|
|
9274
|
+
/**
|
|
9275
|
+
* Debug message - only shown when DEBUG env var is set
|
|
9276
|
+
*/
|
|
9277
|
+
debug: (message, indent = 0) => {
|
|
9278
|
+
const spaces = " ".repeat(indent);
|
|
9279
|
+
if (process.env.DEBUG) {
|
|
9280
|
+
console.log(gray("[DEBUG]"), `${spaces}${message}`);
|
|
9281
|
+
}
|
|
9282
|
+
},
|
|
9283
|
+
/**
|
|
9284
|
+
* Step message - shows progress through a process
|
|
9285
|
+
*/
|
|
9286
|
+
step: (step, total, message, indent = 0) => {
|
|
9287
|
+
const spaces = " ".repeat(indent);
|
|
9288
|
+
console.log(spaces + cyan(`[${step}/${total}]`), customTransform(message));
|
|
9289
|
+
},
|
|
9290
|
+
/**
|
|
9291
|
+
* Highlighted message - draws attention
|
|
9292
|
+
*/
|
|
9293
|
+
highlight: (message, indent = 0) => {
|
|
9294
|
+
const spaces = " ".repeat(indent);
|
|
9295
|
+
console.log(bold(`${spaces}${cyan(customTransform(message))}`));
|
|
9296
|
+
},
|
|
9297
|
+
/**
|
|
9298
|
+
* Aside message - for side information
|
|
9299
|
+
*/
|
|
9300
|
+
aside: (message, indent = 0) => {
|
|
9301
|
+
const spaces = " ".repeat(indent);
|
|
9302
|
+
console.log(`${spaces}${bold(customTransform(message))}`);
|
|
9303
|
+
},
|
|
9304
|
+
/**
|
|
9305
|
+
* Data display - for structured data output
|
|
9306
|
+
*/
|
|
9307
|
+
data: (label, value, indent = 0) => {
|
|
9308
|
+
const spaces = " ".repeat(indent);
|
|
9309
|
+
if (value !== void 0) {
|
|
9310
|
+
console.log(`${spaces}${dim(label + ":")} ${bold(value)}`);
|
|
9311
|
+
} else {
|
|
9312
|
+
console.log(`${spaces}${dim(label)}`);
|
|
9313
|
+
}
|
|
9314
|
+
},
|
|
9315
|
+
/**
|
|
9316
|
+
* JSON output - pretty-printed JSON
|
|
9317
|
+
*/
|
|
9318
|
+
json: (data, indent = 0) => {
|
|
9319
|
+
const spaces = " ".repeat(indent);
|
|
9320
|
+
const jsonString = colorize(JSON.stringify(data, null, 2));
|
|
9321
|
+
jsonString.split("\n").forEach((line2) => {
|
|
9322
|
+
console.log(`${spaces}${line2}`);
|
|
9323
|
+
});
|
|
9324
|
+
},
|
|
9325
|
+
/**
|
|
9326
|
+
* New line
|
|
9327
|
+
*/
|
|
9328
|
+
newLine: () => {
|
|
9329
|
+
console.log();
|
|
9330
|
+
},
|
|
9331
|
+
/**
|
|
9332
|
+
* Raw output - no formatting, useful for ASCII art or pre-formatted text
|
|
9333
|
+
*/
|
|
9334
|
+
raw: (text2, indent = 0) => {
|
|
9335
|
+
const spaces = " ".repeat(indent);
|
|
9336
|
+
console.log(`${spaces}${text2}`);
|
|
9337
|
+
},
|
|
9338
|
+
/**
|
|
9339
|
+
* Display a configuration error with helpful suggestions
|
|
9340
|
+
*/
|
|
9341
|
+
configError: (error, indent = 0) => {
|
|
9342
|
+
const spaces = " ".repeat(indent);
|
|
9343
|
+
const isConfigError = error && typeof error === "object" && "name" in error && error.name === "ConfigError";
|
|
9344
|
+
if (isConfigError && "message" in error && "field" in error && "suggestion" in error) {
|
|
9345
|
+
const configErr = error;
|
|
9346
|
+
console.error(`${spaces}${red("\u2716")} ${bold(configErr.message)}`);
|
|
9347
|
+
if (configErr.field) {
|
|
9348
|
+
console.error(`${spaces} ${dim("Field:")} ${configErr.field}`);
|
|
9349
|
+
}
|
|
9350
|
+
if (configErr.suggestion) {
|
|
9351
|
+
console.error(`${spaces} ${dim("Fix:")} ${configErr.suggestion}`);
|
|
9352
|
+
}
|
|
9353
|
+
} else if (error instanceof Error) {
|
|
9354
|
+
console.error(`${spaces}${red("\u2716")} ${bold(error.message)}`);
|
|
9355
|
+
} else {
|
|
9356
|
+
console.error(`${spaces}${red("\u2716")} ${bold(String(error))}`);
|
|
9357
|
+
}
|
|
9358
|
+
}
|
|
9359
|
+
};
|
|
9360
|
+
|
|
9183
9361
|
// src/lib/core/client.ts
|
|
9184
9362
|
async function createClient() {
|
|
9185
9363
|
const profile = await getCurrentProfile();
|
|
@@ -9197,7 +9375,13 @@ async function createClient() {
|
|
|
9197
9375
|
async function requireAuthenticatedClient() {
|
|
9198
9376
|
const profile = await getCurrentProfile();
|
|
9199
9377
|
if (!profile) {
|
|
9200
|
-
|
|
9378
|
+
logger.newLine();
|
|
9379
|
+
logger.admonition("warning", "Login Required", [
|
|
9380
|
+
"You need to be logged in to run this command.",
|
|
9381
|
+
"Run `playcademy login` to authenticate."
|
|
9382
|
+
]);
|
|
9383
|
+
logger.newLine();
|
|
9384
|
+
process.exit(1);
|
|
9201
9385
|
}
|
|
9202
9386
|
const client = await createClient();
|
|
9203
9387
|
return client;
|
|
@@ -9236,10 +9420,10 @@ var cursor = {
|
|
|
9236
9420
|
function color(text2, colorCode) {
|
|
9237
9421
|
return `${colorCode}${text2}${styles.reset}`;
|
|
9238
9422
|
}
|
|
9239
|
-
function
|
|
9423
|
+
function dim2(text2) {
|
|
9240
9424
|
return color(text2, styles.dim);
|
|
9241
9425
|
}
|
|
9242
|
-
function
|
|
9426
|
+
function bold2(text2) {
|
|
9243
9427
|
return color(text2, styles.bold);
|
|
9244
9428
|
}
|
|
9245
9429
|
var isInteractive = typeof process !== "undefined" && process.stdout?.isTTY && !process.env.CI && process.env.TERM !== "dumb";
|
|
@@ -9369,7 +9553,7 @@ var Spinner = class {
|
|
|
9369
9553
|
// ../utils/src/log.ts
|
|
9370
9554
|
function formatDuration(ms) {
|
|
9371
9555
|
const duration = ms < 1e3 ? `${Math.round(ms)}ms` : `${(ms / 1e3).toFixed(2)}s`;
|
|
9372
|
-
return
|
|
9556
|
+
return bold2(dim2(`[${duration}]`));
|
|
9373
9557
|
}
|
|
9374
9558
|
async function runStep(text2, action, successText, options) {
|
|
9375
9559
|
const effectiveAction = action ?? (async () => void 0);
|
|
@@ -9393,7 +9577,7 @@ async function runStep(text2, action, successText, options) {
|
|
|
9393
9577
|
} else {
|
|
9394
9578
|
finalSuccessText = successText ?? text2;
|
|
9395
9579
|
}
|
|
9396
|
-
finalSuccessText =
|
|
9580
|
+
finalSuccessText = bold2(finalSuccessText);
|
|
9397
9581
|
if (hasAction) {
|
|
9398
9582
|
const durationText = formatDuration(duration);
|
|
9399
9583
|
finalSuccessText = `${finalSuccessText} ${durationText}`;
|
|
@@ -9478,178 +9662,6 @@ async function getGameFromConfig(client) {
|
|
|
9478
9662
|
return { game, config };
|
|
9479
9663
|
}
|
|
9480
9664
|
|
|
9481
|
-
// src/lib/core/logger.ts
|
|
9482
|
-
import {
|
|
9483
|
-
blue,
|
|
9484
|
-
bold as bold2,
|
|
9485
|
-
cyan,
|
|
9486
|
-
dim as dim2,
|
|
9487
|
-
gray,
|
|
9488
|
-
green,
|
|
9489
|
-
greenBright,
|
|
9490
|
-
red,
|
|
9491
|
-
yellow,
|
|
9492
|
-
yellowBright
|
|
9493
|
-
} from "colorette";
|
|
9494
|
-
import { colorize } from "json-colorizer";
|
|
9495
|
-
function customTransform(text2) {
|
|
9496
|
-
const highlightCode = (text3) => text3.replace(/`([^`]+)`/g, (_, code) => greenBright(code));
|
|
9497
|
-
return highlightCode(text2);
|
|
9498
|
-
}
|
|
9499
|
-
var logger = {
|
|
9500
|
-
table: (data) => {
|
|
9501
|
-
console.table(data);
|
|
9502
|
-
},
|
|
9503
|
-
/**
|
|
9504
|
-
* Info message - general information
|
|
9505
|
-
*/
|
|
9506
|
-
info: (message, indent = 0) => {
|
|
9507
|
-
const spaces = " ".repeat(indent);
|
|
9508
|
-
console.log(`${spaces}${blue("\u2139")} ${bold2(customTransform(message))}`);
|
|
9509
|
-
},
|
|
9510
|
-
/**
|
|
9511
|
-
* Admonition - highlighted note/tip/warning box (Docusaurus-style)
|
|
9512
|
-
*/
|
|
9513
|
-
admonition: (type, title, lines, indent = 0) => {
|
|
9514
|
-
const spaces = " ".repeat(indent);
|
|
9515
|
-
const configs = {
|
|
9516
|
-
note: { color: green },
|
|
9517
|
-
tip: { color: cyan },
|
|
9518
|
-
info: { color: blue },
|
|
9519
|
-
warning: { color: yellow }
|
|
9520
|
-
};
|
|
9521
|
-
const { color: color2 } = configs[type];
|
|
9522
|
-
console.log(`${spaces}${color2("\u250C\u2500")} ${bold2(color2(title.toUpperCase()))}`);
|
|
9523
|
-
if (lines && lines.length > 0) {
|
|
9524
|
-
lines.forEach((line2) => {
|
|
9525
|
-
console.log(`${spaces}${color2("\u2502")} ${customTransform(line2)}`);
|
|
9526
|
-
});
|
|
9527
|
-
}
|
|
9528
|
-
console.log(`${spaces}${color2("\u2514\u2500")}`);
|
|
9529
|
-
},
|
|
9530
|
-
/**
|
|
9531
|
-
* Dim message - less important information
|
|
9532
|
-
*/
|
|
9533
|
-
dim: (message, indent = 0) => {
|
|
9534
|
-
const spaces = " ".repeat(indent);
|
|
9535
|
-
console.log(`${spaces}${dim2(customTransform(message))}`);
|
|
9536
|
-
},
|
|
9537
|
-
/**
|
|
9538
|
-
* Success message - operation completed successfully
|
|
9539
|
-
*/
|
|
9540
|
-
success: (message, indent = 0) => {
|
|
9541
|
-
const spaces = " ".repeat(indent);
|
|
9542
|
-
console.log(`${spaces}${green("\u2714")} ${bold2(customTransform(message))}`);
|
|
9543
|
-
},
|
|
9544
|
-
remark: (message, indent = 0) => {
|
|
9545
|
-
const spaces = " ".repeat(indent);
|
|
9546
|
-
console.log(`${spaces}${bold2(yellowBright("\u2726"))} ${bold2(customTransform(message))}`);
|
|
9547
|
-
},
|
|
9548
|
-
/**
|
|
9549
|
-
* Error message - operation failed
|
|
9550
|
-
*/
|
|
9551
|
-
error: (message, indent = 0) => {
|
|
9552
|
-
const spaces = " ".repeat(indent);
|
|
9553
|
-
console.error(`${spaces}${red("\u2716")} ${customTransform(message)}`);
|
|
9554
|
-
},
|
|
9555
|
-
bold: (message, indent = 0) => {
|
|
9556
|
-
const spaces = " ".repeat(indent);
|
|
9557
|
-
console.log(`${spaces}${bold2(customTransform(message))}`);
|
|
9558
|
-
},
|
|
9559
|
-
/**
|
|
9560
|
-
* Warning message - something to be aware of
|
|
9561
|
-
*/
|
|
9562
|
-
warn: (message, indent = 0) => {
|
|
9563
|
-
const spaces = " ".repeat(indent);
|
|
9564
|
-
console.warn(`${spaces}${yellow("\u26A0")} ${bold2(customTransform(message))}`);
|
|
9565
|
-
},
|
|
9566
|
-
/**
|
|
9567
|
-
* Debug message - only shown when DEBUG env var is set
|
|
9568
|
-
*/
|
|
9569
|
-
debug: (message, indent = 0) => {
|
|
9570
|
-
const spaces = " ".repeat(indent);
|
|
9571
|
-
if (process.env.DEBUG) {
|
|
9572
|
-
console.log(gray("[DEBUG]"), `${spaces}${message}`);
|
|
9573
|
-
}
|
|
9574
|
-
},
|
|
9575
|
-
/**
|
|
9576
|
-
* Step message - shows progress through a process
|
|
9577
|
-
*/
|
|
9578
|
-
step: (step, total, message, indent = 0) => {
|
|
9579
|
-
const spaces = " ".repeat(indent);
|
|
9580
|
-
console.log(spaces + cyan(`[${step}/${total}]`), customTransform(message));
|
|
9581
|
-
},
|
|
9582
|
-
/**
|
|
9583
|
-
* Highlighted message - draws attention
|
|
9584
|
-
*/
|
|
9585
|
-
highlight: (message, indent = 0) => {
|
|
9586
|
-
const spaces = " ".repeat(indent);
|
|
9587
|
-
console.log(bold2(`${spaces}${cyan(customTransform(message))}`));
|
|
9588
|
-
},
|
|
9589
|
-
/**
|
|
9590
|
-
* Aside message - for side information
|
|
9591
|
-
*/
|
|
9592
|
-
aside: (message, indent = 0) => {
|
|
9593
|
-
const spaces = " ".repeat(indent);
|
|
9594
|
-
console.log(`${spaces}${bold2(customTransform(message))}`);
|
|
9595
|
-
},
|
|
9596
|
-
/**
|
|
9597
|
-
* Data display - for structured data output
|
|
9598
|
-
*/
|
|
9599
|
-
data: (label, value, indent = 0) => {
|
|
9600
|
-
const spaces = " ".repeat(indent);
|
|
9601
|
-
if (value !== void 0) {
|
|
9602
|
-
console.log(`${spaces}${dim2(label + ":")} ${bold2(value)}`);
|
|
9603
|
-
} else {
|
|
9604
|
-
console.log(`${spaces}${dim2(label)}`);
|
|
9605
|
-
}
|
|
9606
|
-
},
|
|
9607
|
-
/**
|
|
9608
|
-
* JSON output - pretty-printed JSON
|
|
9609
|
-
*/
|
|
9610
|
-
json: (data, indent = 0) => {
|
|
9611
|
-
const spaces = " ".repeat(indent);
|
|
9612
|
-
const jsonString = colorize(JSON.stringify(data, null, 2));
|
|
9613
|
-
jsonString.split("\n").forEach((line2) => {
|
|
9614
|
-
console.log(`${spaces}${line2}`);
|
|
9615
|
-
});
|
|
9616
|
-
},
|
|
9617
|
-
/**
|
|
9618
|
-
* New line
|
|
9619
|
-
*/
|
|
9620
|
-
newLine: () => {
|
|
9621
|
-
console.log();
|
|
9622
|
-
},
|
|
9623
|
-
/**
|
|
9624
|
-
* Raw output - no formatting, useful for ASCII art or pre-formatted text
|
|
9625
|
-
*/
|
|
9626
|
-
raw: (text2, indent = 0) => {
|
|
9627
|
-
const spaces = " ".repeat(indent);
|
|
9628
|
-
console.log(`${spaces}${text2}`);
|
|
9629
|
-
},
|
|
9630
|
-
/**
|
|
9631
|
-
* Display a configuration error with helpful suggestions
|
|
9632
|
-
*/
|
|
9633
|
-
configError: (error, indent = 0) => {
|
|
9634
|
-
const spaces = " ".repeat(indent);
|
|
9635
|
-
const isConfigError = error && typeof error === "object" && "name" in error && error.name === "ConfigError";
|
|
9636
|
-
if (isConfigError && "message" in error && "field" in error && "suggestion" in error) {
|
|
9637
|
-
const configErr = error;
|
|
9638
|
-
console.error(`${spaces}${red("\u2716")} ${bold2(configErr.message)}`);
|
|
9639
|
-
if (configErr.field) {
|
|
9640
|
-
console.error(`${spaces} ${dim2("Field:")} ${configErr.field}`);
|
|
9641
|
-
}
|
|
9642
|
-
if (configErr.suggestion) {
|
|
9643
|
-
console.error(`${spaces} ${dim2("Fix:")} ${configErr.suggestion}`);
|
|
9644
|
-
}
|
|
9645
|
-
} else if (error instanceof Error) {
|
|
9646
|
-
console.error(`${spaces}${red("\u2716")} ${bold2(error.message)}`);
|
|
9647
|
-
} else {
|
|
9648
|
-
console.error(`${spaces}${red("\u2716")} ${bold2(String(error))}`);
|
|
9649
|
-
}
|
|
9650
|
-
}
|
|
9651
|
-
};
|
|
9652
|
-
|
|
9653
9665
|
// src/lib/deploy/backend.ts
|
|
9654
9666
|
import { createHash as createHash2 } from "node:crypto";
|
|
9655
9667
|
import { existsSync as existsSync3 } from "node:fs";
|
|
@@ -11474,7 +11486,8 @@ var loginCommand = new Command4("login").description("Authenticate with Playcade
|
|
|
11474
11486
|
const apiKeyResult = await runStep(
|
|
11475
11487
|
"Creating API key for CLI usage",
|
|
11476
11488
|
async () => {
|
|
11477
|
-
const
|
|
11489
|
+
const pkg = await loadPackageJson({ required: false });
|
|
11490
|
+
const nameVersion = pkg ? getPackageNameVersionFromData(pkg) : `${getCurrentDirectoryName("playcademy-cli")}@0.0.0`;
|
|
11478
11491
|
const result = await client.auth.apiKeys.create({
|
|
11479
11492
|
name: nameVersion,
|
|
11480
11493
|
expiresIn: null,
|
|
@@ -11543,7 +11556,8 @@ async function handleSsoLogin(profileName) {
|
|
|
11543
11556
|
const apiKeyResult = await runStep(
|
|
11544
11557
|
"Creating API key for CLI usage",
|
|
11545
11558
|
async () => {
|
|
11546
|
-
const
|
|
11559
|
+
const pkg = await loadPackageJson({ required: false });
|
|
11560
|
+
const nameVersion = pkg ? getPackageNameVersionFromData(pkg) : `${getCurrentDirectoryName("playcademy-cli")}@0.0.0`;
|
|
11547
11561
|
const response = await client.auth.apiKeys.create({
|
|
11548
11562
|
name: nameVersion,
|
|
11549
11563
|
expiresIn: null,
|
|
@@ -12012,7 +12026,7 @@ async function runDevServer(options) {
|
|
|
12012
12026
|
});
|
|
12013
12027
|
const hotReload = options.reload !== false;
|
|
12014
12028
|
let startMessage = `Game API started: ${blueBright4(underline2(`http://localhost:${port}/api`))}`;
|
|
12015
|
-
if (hotReload) startMessage += hotReload ?
|
|
12029
|
+
if (hotReload) startMessage += hotReload ? dim2(" (hot reload enabled)") : "";
|
|
12016
12030
|
logger.success(startMessage);
|
|
12017
12031
|
logger.newLine();
|
|
12018
12032
|
let customRoutes = await discoverRoutes(join12(getWorkspace(), "api"));
|
package/dist/utils.js
CHANGED
|
@@ -34,6 +34,7 @@ var init_package_json = __esm({
|
|
|
34
34
|
var file_loader_exports = {};
|
|
35
35
|
__export(file_loader_exports, {
|
|
36
36
|
findFile: () => findFile,
|
|
37
|
+
getCurrentDirectoryName: () => getCurrentDirectoryName,
|
|
37
38
|
getFileExtension: () => getFileExtension,
|
|
38
39
|
getPackageField: () => getPackageField,
|
|
39
40
|
getPackageName: () => getPackageName,
|
|
@@ -172,6 +173,11 @@ async function getPackageNameVersion(options) {
|
|
|
172
173
|
}
|
|
173
174
|
return getPackageNameVersionFromData(pkg);
|
|
174
175
|
}
|
|
176
|
+
function getCurrentDirectoryName(fallback = "unknown-directory") {
|
|
177
|
+
const cwd = process.cwd();
|
|
178
|
+
const dirName = cwd.split("/").pop();
|
|
179
|
+
return dirName || fallback;
|
|
180
|
+
}
|
|
175
181
|
function getFileExtension(path) {
|
|
176
182
|
return path.split(".").pop()?.toLowerCase();
|
|
177
183
|
}
|
|
@@ -6474,42 +6480,12 @@ function getWorkspace() {
|
|
|
6474
6480
|
return context.workspace || process.cwd();
|
|
6475
6481
|
}
|
|
6476
6482
|
|
|
6477
|
-
// ../utils/src/ansi.ts
|
|
6478
|
-
var isInteractive = typeof process !== "undefined" && process.stdout?.isTTY && !process.env.CI && process.env.TERM !== "dumb";
|
|
6479
|
-
|
|
6480
|
-
// ../utils/src/spinner.ts
|
|
6481
|
-
var SPINNER_FRAMES = [
|
|
6482
|
-
10251,
|
|
6483
|
-
10265,
|
|
6484
|
-
10297,
|
|
6485
|
-
10296,
|
|
6486
|
-
10300,
|
|
6487
|
-
10292,
|
|
6488
|
-
10278,
|
|
6489
|
-
10279,
|
|
6490
|
-
10247,
|
|
6491
|
-
10255
|
|
6492
|
-
].map((code) => String.fromCodePoint(code));
|
|
6493
|
-
var CHECK_MARK = String.fromCodePoint(10004);
|
|
6494
|
-
var CROSS_MARK = String.fromCodePoint(10006);
|
|
6495
|
-
|
|
6496
|
-
// ../utils/src/pure/index.ts
|
|
6497
|
-
init_package_json();
|
|
6498
|
-
|
|
6499
|
-
// src/lib/config/timeback-derive.ts
|
|
6500
|
-
init_file_loader();
|
|
6501
|
-
|
|
6502
|
-
// src/lib/templates/loader.ts
|
|
6503
|
-
import { dirname as dirname3, resolve as resolve3 } from "path";
|
|
6504
|
-
import { fileURLToPath } from "url";
|
|
6505
|
-
var currentDir = dirname3(fileURLToPath(import.meta.url));
|
|
6506
|
-
|
|
6507
6483
|
// src/lib/core/logger.ts
|
|
6508
6484
|
import {
|
|
6509
6485
|
blue,
|
|
6510
|
-
bold
|
|
6486
|
+
bold,
|
|
6511
6487
|
cyan,
|
|
6512
|
-
dim
|
|
6488
|
+
dim,
|
|
6513
6489
|
gray,
|
|
6514
6490
|
green,
|
|
6515
6491
|
greenBright,
|
|
@@ -6531,7 +6507,7 @@ var logger = {
|
|
|
6531
6507
|
*/
|
|
6532
6508
|
info: (message, indent = 0) => {
|
|
6533
6509
|
const spaces = " ".repeat(indent);
|
|
6534
|
-
console.log(`${spaces}${blue("\u2139")} ${
|
|
6510
|
+
console.log(`${spaces}${blue("\u2139")} ${bold(customTransform(message))}`);
|
|
6535
6511
|
},
|
|
6536
6512
|
/**
|
|
6537
6513
|
* Admonition - highlighted note/tip/warning box (Docusaurus-style)
|
|
@@ -6545,7 +6521,7 @@ var logger = {
|
|
|
6545
6521
|
warning: { color: yellow }
|
|
6546
6522
|
};
|
|
6547
6523
|
const { color } = configs[type];
|
|
6548
|
-
console.log(`${spaces}${color("\u250C\u2500")} ${
|
|
6524
|
+
console.log(`${spaces}${color("\u250C\u2500")} ${bold(color(title.toUpperCase()))}`);
|
|
6549
6525
|
if (lines && lines.length > 0) {
|
|
6550
6526
|
lines.forEach((line2) => {
|
|
6551
6527
|
console.log(`${spaces}${color("\u2502")} ${customTransform(line2)}`);
|
|
@@ -6558,18 +6534,18 @@ var logger = {
|
|
|
6558
6534
|
*/
|
|
6559
6535
|
dim: (message, indent = 0) => {
|
|
6560
6536
|
const spaces = " ".repeat(indent);
|
|
6561
|
-
console.log(`${spaces}${
|
|
6537
|
+
console.log(`${spaces}${dim(customTransform(message))}`);
|
|
6562
6538
|
},
|
|
6563
6539
|
/**
|
|
6564
6540
|
* Success message - operation completed successfully
|
|
6565
6541
|
*/
|
|
6566
6542
|
success: (message, indent = 0) => {
|
|
6567
6543
|
const spaces = " ".repeat(indent);
|
|
6568
|
-
console.log(`${spaces}${green("\u2714")} ${
|
|
6544
|
+
console.log(`${spaces}${green("\u2714")} ${bold(customTransform(message))}`);
|
|
6569
6545
|
},
|
|
6570
6546
|
remark: (message, indent = 0) => {
|
|
6571
6547
|
const spaces = " ".repeat(indent);
|
|
6572
|
-
console.log(`${spaces}${
|
|
6548
|
+
console.log(`${spaces}${bold(yellowBright("\u2726"))} ${bold(customTransform(message))}`);
|
|
6573
6549
|
},
|
|
6574
6550
|
/**
|
|
6575
6551
|
* Error message - operation failed
|
|
@@ -6580,14 +6556,14 @@ var logger = {
|
|
|
6580
6556
|
},
|
|
6581
6557
|
bold: (message, indent = 0) => {
|
|
6582
6558
|
const spaces = " ".repeat(indent);
|
|
6583
|
-
console.log(`${spaces}${
|
|
6559
|
+
console.log(`${spaces}${bold(customTransform(message))}`);
|
|
6584
6560
|
},
|
|
6585
6561
|
/**
|
|
6586
6562
|
* Warning message - something to be aware of
|
|
6587
6563
|
*/
|
|
6588
6564
|
warn: (message, indent = 0) => {
|
|
6589
6565
|
const spaces = " ".repeat(indent);
|
|
6590
|
-
console.warn(`${spaces}${yellow("\u26A0")} ${
|
|
6566
|
+
console.warn(`${spaces}${yellow("\u26A0")} ${bold(customTransform(message))}`);
|
|
6591
6567
|
},
|
|
6592
6568
|
/**
|
|
6593
6569
|
* Debug message - only shown when DEBUG env var is set
|
|
@@ -6610,14 +6586,14 @@ var logger = {
|
|
|
6610
6586
|
*/
|
|
6611
6587
|
highlight: (message, indent = 0) => {
|
|
6612
6588
|
const spaces = " ".repeat(indent);
|
|
6613
|
-
console.log(
|
|
6589
|
+
console.log(bold(`${spaces}${cyan(customTransform(message))}`));
|
|
6614
6590
|
},
|
|
6615
6591
|
/**
|
|
6616
6592
|
* Aside message - for side information
|
|
6617
6593
|
*/
|
|
6618
6594
|
aside: (message, indent = 0) => {
|
|
6619
6595
|
const spaces = " ".repeat(indent);
|
|
6620
|
-
console.log(`${spaces}${
|
|
6596
|
+
console.log(`${spaces}${bold(customTransform(message))}`);
|
|
6621
6597
|
},
|
|
6622
6598
|
/**
|
|
6623
6599
|
* Data display - for structured data output
|
|
@@ -6625,9 +6601,9 @@ var logger = {
|
|
|
6625
6601
|
data: (label, value, indent = 0) => {
|
|
6626
6602
|
const spaces = " ".repeat(indent);
|
|
6627
6603
|
if (value !== void 0) {
|
|
6628
|
-
console.log(`${spaces}${
|
|
6604
|
+
console.log(`${spaces}${dim(label + ":")} ${bold(value)}`);
|
|
6629
6605
|
} else {
|
|
6630
|
-
console.log(`${spaces}${
|
|
6606
|
+
console.log(`${spaces}${dim(label)}`);
|
|
6631
6607
|
}
|
|
6632
6608
|
},
|
|
6633
6609
|
/**
|
|
@@ -6661,21 +6637,51 @@ var logger = {
|
|
|
6661
6637
|
const isConfigError = error && typeof error === "object" && "name" in error && error.name === "ConfigError";
|
|
6662
6638
|
if (isConfigError && "message" in error && "field" in error && "suggestion" in error) {
|
|
6663
6639
|
const configErr = error;
|
|
6664
|
-
console.error(`${spaces}${red("\u2716")} ${
|
|
6640
|
+
console.error(`${spaces}${red("\u2716")} ${bold(configErr.message)}`);
|
|
6665
6641
|
if (configErr.field) {
|
|
6666
|
-
console.error(`${spaces} ${
|
|
6642
|
+
console.error(`${spaces} ${dim("Field:")} ${configErr.field}`);
|
|
6667
6643
|
}
|
|
6668
6644
|
if (configErr.suggestion) {
|
|
6669
|
-
console.error(`${spaces} ${
|
|
6645
|
+
console.error(`${spaces} ${dim("Fix:")} ${configErr.suggestion}`);
|
|
6670
6646
|
}
|
|
6671
6647
|
} else if (error instanceof Error) {
|
|
6672
|
-
console.error(`${spaces}${red("\u2716")} ${
|
|
6648
|
+
console.error(`${spaces}${red("\u2716")} ${bold(error.message)}`);
|
|
6673
6649
|
} else {
|
|
6674
|
-
console.error(`${spaces}${red("\u2716")} ${
|
|
6650
|
+
console.error(`${spaces}${red("\u2716")} ${bold(String(error))}`);
|
|
6675
6651
|
}
|
|
6676
6652
|
}
|
|
6677
6653
|
};
|
|
6678
6654
|
|
|
6655
|
+
// ../utils/src/ansi.ts
|
|
6656
|
+
var isInteractive = typeof process !== "undefined" && process.stdout?.isTTY && !process.env.CI && process.env.TERM !== "dumb";
|
|
6657
|
+
|
|
6658
|
+
// ../utils/src/spinner.ts
|
|
6659
|
+
var SPINNER_FRAMES = [
|
|
6660
|
+
10251,
|
|
6661
|
+
10265,
|
|
6662
|
+
10297,
|
|
6663
|
+
10296,
|
|
6664
|
+
10300,
|
|
6665
|
+
10292,
|
|
6666
|
+
10278,
|
|
6667
|
+
10279,
|
|
6668
|
+
10247,
|
|
6669
|
+
10255
|
|
6670
|
+
].map((code) => String.fromCodePoint(code));
|
|
6671
|
+
var CHECK_MARK = String.fromCodePoint(10004);
|
|
6672
|
+
var CROSS_MARK = String.fromCodePoint(10006);
|
|
6673
|
+
|
|
6674
|
+
// ../utils/src/pure/index.ts
|
|
6675
|
+
init_package_json();
|
|
6676
|
+
|
|
6677
|
+
// src/lib/config/timeback-derive.ts
|
|
6678
|
+
init_file_loader();
|
|
6679
|
+
|
|
6680
|
+
// src/lib/templates/loader.ts
|
|
6681
|
+
import { dirname as dirname3, resolve as resolve3 } from "path";
|
|
6682
|
+
import { fileURLToPath } from "url";
|
|
6683
|
+
var currentDir = dirname3(fileURLToPath(import.meta.url));
|
|
6684
|
+
|
|
6679
6685
|
// src/lib/dev/routes.ts
|
|
6680
6686
|
init_file_loader();
|
|
6681
6687
|
import { mkdir, writeFile } from "fs/promises";
|