playcademy 0.14.7-alpha.1 → 0.14.7
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 +226 -416
- package/dist/utils.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5194,7 +5194,7 @@ async function hasBackendChanged(previousHash, currentHash) {
|
|
|
5194
5194
|
}
|
|
5195
5195
|
async function getDirectorySize(dirPath) {
|
|
5196
5196
|
const { stat: stat2, readdir } = await import("node:fs/promises");
|
|
5197
|
-
const { join:
|
|
5197
|
+
const { join: join45 } = await import("node:path");
|
|
5198
5198
|
if (!existsSync8(dirPath)) {
|
|
5199
5199
|
return null;
|
|
5200
5200
|
}
|
|
@@ -5203,7 +5203,7 @@ async function getDirectorySize(dirPath) {
|
|
|
5203
5203
|
async function calculateSize(dir) {
|
|
5204
5204
|
const entries = await readdir(dir, { withFileTypes: true });
|
|
5205
5205
|
for (const entry of entries) {
|
|
5206
|
-
const fullPath =
|
|
5206
|
+
const fullPath = join45(dir, entry.name);
|
|
5207
5207
|
if (entry.isDirectory()) {
|
|
5208
5208
|
await calculateSize(fullPath);
|
|
5209
5209
|
} else if (entry.isFile()) {
|
|
@@ -5255,10 +5255,10 @@ init_src();
|
|
|
5255
5255
|
init_file_loader();
|
|
5256
5256
|
init_package_manager();
|
|
5257
5257
|
init_constants2();
|
|
5258
|
-
import { execSync as
|
|
5259
|
-
import { readFileSync as
|
|
5258
|
+
import { execSync as execSync6 } from "child_process";
|
|
5259
|
+
import { readFileSync as readFileSync11, writeFileSync as writeFileSync12 } from "fs";
|
|
5260
5260
|
import { resolve as resolve10 } from "path";
|
|
5261
|
-
import { confirm as
|
|
5261
|
+
import { confirm as confirm4 } from "@inquirer/prompts";
|
|
5262
5262
|
import { Command as Command2 } from "commander";
|
|
5263
5263
|
|
|
5264
5264
|
// src/lib/auth/index.ts
|
|
@@ -6777,207 +6777,25 @@ function displayDeploymentDiff(options) {
|
|
|
6777
6777
|
}
|
|
6778
6778
|
}
|
|
6779
6779
|
|
|
6780
|
-
// src/lib/deploy/godot.ts
|
|
6781
|
-
init_src();
|
|
6782
|
-
init_core();
|
|
6783
|
-
import { execSync as execSync4 } from "child_process";
|
|
6784
|
-
import { existsSync as existsSync10, mkdirSync as mkdirSync2, readFileSync as readFileSync5 } from "fs";
|
|
6785
|
-
import { join as join13 } from "path";
|
|
6786
|
-
import { confirm, select } from "@inquirer/prompts";
|
|
6787
|
-
function isGodotProject() {
|
|
6788
|
-
return existsSync10(join13(getWorkspace(), "project.godot"));
|
|
6789
|
-
}
|
|
6790
|
-
function hasWebExportPreset() {
|
|
6791
|
-
const presetsPath = join13(getWorkspace(), "export_presets.cfg");
|
|
6792
|
-
if (!existsSync10(presetsPath)) {
|
|
6793
|
-
return { configured: false };
|
|
6794
|
-
}
|
|
6795
|
-
try {
|
|
6796
|
-
const content = readFileSync5(presetsPath, "utf-8");
|
|
6797
|
-
const lines = content.split("\n");
|
|
6798
|
-
const webPlatformIndex = lines.findIndex((line) => line.trim() === 'platform="Web"');
|
|
6799
|
-
if (webPlatformIndex === -1) {
|
|
6800
|
-
return { configured: false };
|
|
6801
|
-
}
|
|
6802
|
-
for (let i = webPlatformIndex - 1; i >= 0; i--) {
|
|
6803
|
-
const line = lines[i]?.trim();
|
|
6804
|
-
if (!line) continue;
|
|
6805
|
-
if (line.startsWith("name=")) {
|
|
6806
|
-
const match = line.match(/name="(.+?)"/);
|
|
6807
|
-
if (match?.[1]) {
|
|
6808
|
-
return { configured: true, presetName: match[1] };
|
|
6809
|
-
}
|
|
6810
|
-
}
|
|
6811
|
-
if (line.startsWith("[preset.")) break;
|
|
6812
|
-
}
|
|
6813
|
-
return { configured: false };
|
|
6814
|
-
} catch {
|
|
6815
|
-
return { configured: false };
|
|
6816
|
-
}
|
|
6817
|
-
}
|
|
6818
|
-
async function findGodotExecutable() {
|
|
6819
|
-
const platform = process.platform;
|
|
6820
|
-
const foundExecutables = [];
|
|
6821
|
-
const seenAppBundles = /* @__PURE__ */ new Set();
|
|
6822
|
-
try {
|
|
6823
|
-
const whichCmd = platform === "win32" ? "where godot 2>nul" : "which godot 2>/dev/null";
|
|
6824
|
-
const result = execSync4(whichCmd, { stdio: "pipe", encoding: "utf-8" });
|
|
6825
|
-
const paths = result.trim().split("\n").filter(Boolean);
|
|
6826
|
-
for (const path4 of paths) {
|
|
6827
|
-
if (platform === "darwin" && path4.includes(".app/")) {
|
|
6828
|
-
const appPath = path4.split(".app/")[0] + ".app";
|
|
6829
|
-
const appName = appPath.split("/").pop() || "Godot";
|
|
6830
|
-
foundExecutables.push({ path: path4, label: appName });
|
|
6831
|
-
seenAppBundles.add(appPath);
|
|
6832
|
-
} else {
|
|
6833
|
-
foundExecutables.push({ path: path4, label: path4 });
|
|
6834
|
-
}
|
|
6835
|
-
}
|
|
6836
|
-
} catch {
|
|
6837
|
-
}
|
|
6838
|
-
if (platform === "darwin") {
|
|
6839
|
-
try {
|
|
6840
|
-
const result = execSync4(
|
|
6841
|
-
'mdfind "kMDItemKind == Application && kMDItemDisplayName == Godot*"',
|
|
6842
|
-
{ stdio: "pipe", encoding: "utf-8" }
|
|
6843
|
-
);
|
|
6844
|
-
const apps = result.split("\n").filter(Boolean);
|
|
6845
|
-
for (const appPath of apps) {
|
|
6846
|
-
if (seenAppBundles.has(appPath)) continue;
|
|
6847
|
-
const executable = join13(appPath, "Contents/MacOS/Godot");
|
|
6848
|
-
const appName = appPath.split("/").pop() || "Godot";
|
|
6849
|
-
foundExecutables.push({ path: executable, label: appName });
|
|
6850
|
-
}
|
|
6851
|
-
} catch {
|
|
6852
|
-
}
|
|
6853
|
-
}
|
|
6854
|
-
if (platform === "linux") {
|
|
6855
|
-
try {
|
|
6856
|
-
execSync4("flatpak list 2>/dev/null | grep org.godotengine.Godot", { stdio: "pipe" });
|
|
6857
|
-
foundExecutables.push({
|
|
6858
|
-
path: "flatpak run org.godotengine.Godot",
|
|
6859
|
-
label: "Godot (flatpak)"
|
|
6860
|
-
});
|
|
6861
|
-
} catch {
|
|
6862
|
-
}
|
|
6863
|
-
try {
|
|
6864
|
-
execSync4("snap list 2>/dev/null | grep godot", { stdio: "pipe" });
|
|
6865
|
-
foundExecutables.push({ path: "snap run godot", label: "Godot (snap)" });
|
|
6866
|
-
} catch {
|
|
6867
|
-
}
|
|
6868
|
-
}
|
|
6869
|
-
if (platform === "win32") {
|
|
6870
|
-
const programFiles = [process.env["ProgramFiles"], process.env["ProgramFiles(x86)"]].filter(
|
|
6871
|
-
Boolean
|
|
6872
|
-
);
|
|
6873
|
-
for (const baseDir of programFiles) {
|
|
6874
|
-
try {
|
|
6875
|
-
const result = execSync4(`dir /s /b "${baseDir}\\*godot*.exe" 2>nul`, {
|
|
6876
|
-
stdio: "pipe",
|
|
6877
|
-
encoding: "utf-8",
|
|
6878
|
-
timeout: 5e3
|
|
6879
|
-
});
|
|
6880
|
-
const exes = result.split("\r\n").filter(Boolean);
|
|
6881
|
-
for (const exePath of exes) {
|
|
6882
|
-
const fileName = exePath.split("\\").pop() || "godot.exe";
|
|
6883
|
-
foundExecutables.push({ path: exePath, label: fileName });
|
|
6884
|
-
}
|
|
6885
|
-
} catch {
|
|
6886
|
-
}
|
|
6887
|
-
}
|
|
6888
|
-
}
|
|
6889
|
-
if (foundExecutables.length === 0) return null;
|
|
6890
|
-
if (foundExecutables.length === 1) return foundExecutables[0].path;
|
|
6891
|
-
return await select({
|
|
6892
|
-
message: "Preferred Godot installation?",
|
|
6893
|
-
choices: foundExecutables.map((exe) => ({
|
|
6894
|
-
value: exe.path,
|
|
6895
|
-
name: exe.label
|
|
6896
|
-
}))
|
|
6897
|
-
});
|
|
6898
|
-
}
|
|
6899
|
-
async function runGodotExport(godotPath, presetName, outputPath) {
|
|
6900
|
-
const root = getWorkspace();
|
|
6901
|
-
try {
|
|
6902
|
-
mkdirSync2(join13(root, "build", "web"), { recursive: true });
|
|
6903
|
-
await runStep(
|
|
6904
|
-
`Exporting project using "${presetName}" preset`,
|
|
6905
|
-
async () => {
|
|
6906
|
-
execSync4(
|
|
6907
|
-
`cd "${root}" && "${godotPath}" --headless --export-release "${presetName}" "${outputPath}"`,
|
|
6908
|
-
{ stdio: "ignore" }
|
|
6909
|
-
);
|
|
6910
|
-
},
|
|
6911
|
-
"Godot export complete"
|
|
6912
|
-
);
|
|
6913
|
-
return true;
|
|
6914
|
-
} catch {
|
|
6915
|
-
logger.error("Godot export failed");
|
|
6916
|
-
logger.newLine();
|
|
6917
|
-
logger.admonition("tip", "Common Issues", [
|
|
6918
|
-
"Export templates not installed for your Godot version",
|
|
6919
|
-
"Web export preset not properly configured",
|
|
6920
|
-
"Godot version mismatch with project"
|
|
6921
|
-
]);
|
|
6922
|
-
logger.newLine();
|
|
6923
|
-
return false;
|
|
6924
|
-
}
|
|
6925
|
-
}
|
|
6926
|
-
async function handleGodotBuildPrompt() {
|
|
6927
|
-
if (!isGodotProject()) return null;
|
|
6928
|
-
const shouldExport = await confirm({ message: "Export Godot project?" });
|
|
6929
|
-
if (!shouldExport) return null;
|
|
6930
|
-
const godotPath = await findGodotExecutable();
|
|
6931
|
-
if (!godotPath) {
|
|
6932
|
-
logger.error("Godot executable not found");
|
|
6933
|
-
return null;
|
|
6934
|
-
}
|
|
6935
|
-
const webExport = hasWebExportPreset();
|
|
6936
|
-
if (!webExport.configured) {
|
|
6937
|
-
logger.error("Web export preset not configured");
|
|
6938
|
-
logger.newLine();
|
|
6939
|
-
logger.admonition("tip", "Configure Web Export", [
|
|
6940
|
-
"1. Open project in Godot Editor",
|
|
6941
|
-
"2. Go to Project \u2192 Export...",
|
|
6942
|
-
"3. Add Web preset"
|
|
6943
|
-
]);
|
|
6944
|
-
logger.newLine();
|
|
6945
|
-
return null;
|
|
6946
|
-
}
|
|
6947
|
-
const success = await runGodotExport(godotPath, webExport.presetName, "build/web/index.html");
|
|
6948
|
-
if (!success) {
|
|
6949
|
-
logger.error("Export failed. Please export manually or provide zip file.");
|
|
6950
|
-
logger.newLine();
|
|
6951
|
-
return null;
|
|
6952
|
-
}
|
|
6953
|
-
const zipPath = "build/web_playcademy.zip";
|
|
6954
|
-
if (existsSync10(join13(getWorkspace(), zipPath))) {
|
|
6955
|
-
return zipPath;
|
|
6956
|
-
}
|
|
6957
|
-
logger.warn("Expected zip file not found, using build directory");
|
|
6958
|
-
logger.newLine();
|
|
6959
|
-
return "build/web";
|
|
6960
|
-
}
|
|
6961
|
-
|
|
6962
6780
|
// src/lib/deploy/interaction.ts
|
|
6963
6781
|
init_storage();
|
|
6964
6782
|
init_context();
|
|
6965
6783
|
init_logger();
|
|
6966
|
-
import { confirm as
|
|
6784
|
+
import { confirm as confirm2, input as input2, select as select2 } from "@inquirer/prompts";
|
|
6967
6785
|
|
|
6968
6786
|
// src/lib/init/prompts.ts
|
|
6969
6787
|
init_constants3();
|
|
6970
6788
|
init_constants2();
|
|
6971
6789
|
init_core();
|
|
6972
|
-
import { checkbox, confirm
|
|
6790
|
+
import { checkbox, confirm, input, select } from "@inquirer/prompts";
|
|
6973
6791
|
import { bold as bold4, cyan as cyan2 } from "colorette";
|
|
6974
6792
|
|
|
6975
6793
|
// src/lib/init/scaffold.ts
|
|
6976
6794
|
init_constants2();
|
|
6977
6795
|
init_core();
|
|
6978
6796
|
init_loader2();
|
|
6979
|
-
import { existsSync as
|
|
6980
|
-
import { join as
|
|
6797
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "fs";
|
|
6798
|
+
import { join as join15, resolve as resolve6 } from "path";
|
|
6981
6799
|
|
|
6982
6800
|
// src/lib/init/auth.ts
|
|
6983
6801
|
init_log();
|
|
@@ -6986,8 +6804,8 @@ init_constants2();
|
|
|
6986
6804
|
init_core();
|
|
6987
6805
|
init_env();
|
|
6988
6806
|
init_loader2();
|
|
6989
|
-
import { existsSync as
|
|
6990
|
-
import { join as
|
|
6807
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync2, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
6808
|
+
import { join as join13 } from "path";
|
|
6991
6809
|
var authTemplate = loadTemplateString("auth/auth.ts");
|
|
6992
6810
|
var authCatchAllTemplate = loadTemplateString("auth/auth-catch-all.ts");
|
|
6993
6811
|
var authSchemaTemplate = loadTemplateString("auth/auth-schema.ts");
|
|
@@ -7029,30 +6847,30 @@ function generateAuthConfig(strategies, gameName) {
|
|
|
7029
6847
|
return authContent;
|
|
7030
6848
|
}
|
|
7031
6849
|
function scaffoldAuthConfig(workspace, authContent) {
|
|
7032
|
-
const libDir =
|
|
7033
|
-
if (!
|
|
7034
|
-
|
|
6850
|
+
const libDir = join13(workspace, SERVER_LIB_DIRECTORY);
|
|
6851
|
+
if (!existsSync10(libDir)) {
|
|
6852
|
+
mkdirSync2(libDir, { recursive: true });
|
|
7035
6853
|
}
|
|
7036
|
-
writeFileSync3(
|
|
6854
|
+
writeFileSync3(join13(libDir, AUTH_CONFIG_FILE), authContent);
|
|
7037
6855
|
}
|
|
7038
6856
|
function scaffoldAuthRoutes(workspace) {
|
|
7039
|
-
const apiDir =
|
|
7040
|
-
const authApiDir =
|
|
7041
|
-
if (!
|
|
7042
|
-
|
|
6857
|
+
const apiDir = join13(workspace, DEFAULT_API_ROUTES_DIRECTORY);
|
|
6858
|
+
const authApiDir = join13(apiDir, AUTH_API_SUBDIRECTORY);
|
|
6859
|
+
if (!existsSync10(authApiDir)) {
|
|
6860
|
+
mkdirSync2(authApiDir, { recursive: true });
|
|
7043
6861
|
}
|
|
7044
|
-
writeFileSync3(
|
|
6862
|
+
writeFileSync3(join13(authApiDir, "[...all].ts"), authCatchAllTemplate);
|
|
7045
6863
|
}
|
|
7046
6864
|
function scaffoldAuthSchema(workspace) {
|
|
7047
|
-
const dbDir =
|
|
7048
|
-
const schemaDir =
|
|
7049
|
-
if (!
|
|
7050
|
-
|
|
7051
|
-
}
|
|
7052
|
-
writeFileSync3(
|
|
7053
|
-
const schemaIndexPath =
|
|
7054
|
-
if (
|
|
7055
|
-
const existing =
|
|
6865
|
+
const dbDir = join13(workspace, DEFAULT_DATABASE_DIRECTORY);
|
|
6866
|
+
const schemaDir = join13(dbDir, SCHEMA_SUBDIRECTORY);
|
|
6867
|
+
if (!existsSync10(schemaDir)) {
|
|
6868
|
+
mkdirSync2(schemaDir, { recursive: true });
|
|
6869
|
+
}
|
|
6870
|
+
writeFileSync3(join13(schemaDir, "auth.ts"), authSchemaTemplate);
|
|
6871
|
+
const schemaIndexPath = join13(schemaDir, SCHEMA_INDEX_FILE);
|
|
6872
|
+
if (existsSync10(schemaIndexPath)) {
|
|
6873
|
+
const existing = readFileSync5(schemaIndexPath, "utf-8");
|
|
7056
6874
|
if (!existing.includes("export * from './auth'")) {
|
|
7057
6875
|
writeFileSync3(schemaIndexPath, existing + "\nexport * from './auth'\n");
|
|
7058
6876
|
}
|
|
@@ -7061,12 +6879,12 @@ function scaffoldAuthSchema(workspace) {
|
|
|
7061
6879
|
}
|
|
7062
6880
|
}
|
|
7063
6881
|
function scaffoldProtectedExample(workspace) {
|
|
7064
|
-
const apiDir =
|
|
7065
|
-
const sampleDir =
|
|
7066
|
-
if (!
|
|
7067
|
-
|
|
6882
|
+
const apiDir = join13(workspace, DEFAULT_API_ROUTES_DIRECTORY);
|
|
6883
|
+
const sampleDir = join13(apiDir, SAMPLE_API_SUBDIRECTORY);
|
|
6884
|
+
if (!existsSync10(sampleDir)) {
|
|
6885
|
+
mkdirSync2(sampleDir, { recursive: true });
|
|
7068
6886
|
}
|
|
7069
|
-
writeFileSync3(
|
|
6887
|
+
writeFileSync3(join13(sampleDir, "protected.ts"), protectedRouteTemplate);
|
|
7070
6888
|
}
|
|
7071
6889
|
function updateEnvForAuth(workspace, strategies) {
|
|
7072
6890
|
if (strategies.length === 0) return;
|
|
@@ -7107,16 +6925,16 @@ async function scaffoldAuthSetup(options = {}) {
|
|
|
7107
6925
|
return packagesUpdated;
|
|
7108
6926
|
}
|
|
7109
6927
|
async function setupPackageJson(workspace) {
|
|
7110
|
-
const pkgPath =
|
|
6928
|
+
const pkgPath = join13(workspace, "package.json");
|
|
7111
6929
|
const authDeps = {
|
|
7112
6930
|
"@playcademy/better-auth": PLAYCADEMY_AUTH_VERSION,
|
|
7113
6931
|
"better-auth": BETTER_AUTH_VERSION
|
|
7114
6932
|
};
|
|
7115
|
-
if (
|
|
6933
|
+
if (existsSync10(pkgPath)) {
|
|
7116
6934
|
await runStep(
|
|
7117
6935
|
"Updating package.json deps",
|
|
7118
6936
|
async () => {
|
|
7119
|
-
const existing = JSON.parse(
|
|
6937
|
+
const existing = JSON.parse(readFileSync5(pkgPath, "utf-8"));
|
|
7120
6938
|
existing.dependencies = { ...existing.dependencies, ...authDeps };
|
|
7121
6939
|
writeFileSync3(pkgPath, JSON.stringify(existing, null, 2) + "\n");
|
|
7122
6940
|
},
|
|
@@ -7128,20 +6946,20 @@ async function setupPackageJson(workspace) {
|
|
|
7128
6946
|
}
|
|
7129
6947
|
function hasAuthSetup() {
|
|
7130
6948
|
const workspace = getWorkspace();
|
|
7131
|
-
const authPath =
|
|
7132
|
-
return
|
|
6949
|
+
const authPath = join13(workspace, SERVER_LIB_DIRECTORY, AUTH_CONFIG_FILE);
|
|
6950
|
+
return existsSync10(authPath);
|
|
7133
6951
|
}
|
|
7134
6952
|
|
|
7135
6953
|
// src/lib/init/database.ts
|
|
7136
6954
|
init_log();
|
|
7137
6955
|
init_slug();
|
|
7138
|
-
import { existsSync as
|
|
7139
|
-
import { join as
|
|
6956
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
|
|
6957
|
+
import { join as join14 } from "path";
|
|
7140
6958
|
|
|
7141
6959
|
// package.json
|
|
7142
6960
|
var package_default2 = {
|
|
7143
6961
|
name: "playcademy",
|
|
7144
|
-
version: "0.14.
|
|
6962
|
+
version: "0.14.6",
|
|
7145
6963
|
type: "module",
|
|
7146
6964
|
exports: {
|
|
7147
6965
|
".": {
|
|
@@ -7236,27 +7054,27 @@ async function scaffoldDatabaseSetup(options) {
|
|
|
7236
7054
|
await runStep(
|
|
7237
7055
|
"Configuring database...",
|
|
7238
7056
|
async () => {
|
|
7239
|
-
const dbDir =
|
|
7240
|
-
const schemaDir =
|
|
7241
|
-
if (!
|
|
7242
|
-
|
|
7057
|
+
const dbDir = join14(workspace, "db");
|
|
7058
|
+
const schemaDir = join14(dbDir, "schema");
|
|
7059
|
+
if (!existsSync11(dbDir)) {
|
|
7060
|
+
mkdirSync3(dbDir, { recursive: true });
|
|
7243
7061
|
}
|
|
7244
|
-
if (!
|
|
7245
|
-
|
|
7062
|
+
if (!existsSync11(schemaDir)) {
|
|
7063
|
+
mkdirSync3(schemaDir, { recursive: true });
|
|
7246
7064
|
}
|
|
7247
|
-
const usersSchemaPath =
|
|
7065
|
+
const usersSchemaPath = join14(schemaDir, "users.ts");
|
|
7248
7066
|
writeFileSync4(usersSchemaPath, dbSchemaUsersTemplate);
|
|
7249
|
-
const scoresSchemaPath =
|
|
7067
|
+
const scoresSchemaPath = join14(schemaDir, "scores.ts");
|
|
7250
7068
|
writeFileSync4(scoresSchemaPath, dbSchemaScoresTemplate);
|
|
7251
|
-
const schemaIndexPath =
|
|
7069
|
+
const schemaIndexPath = join14(schemaDir, "index.ts");
|
|
7252
7070
|
writeFileSync4(schemaIndexPath, dbSchemaIndexTemplate);
|
|
7253
|
-
const dbIndexPath =
|
|
7071
|
+
const dbIndexPath = join14(dbDir, "index.ts");
|
|
7254
7072
|
writeFileSync4(dbIndexPath, dbIndexTemplate);
|
|
7255
|
-
const dbTypesPath =
|
|
7073
|
+
const dbTypesPath = join14(dbDir, "types.ts");
|
|
7256
7074
|
writeFileSync4(dbTypesPath, dbTypesTemplate);
|
|
7257
|
-
const dbSeedPath =
|
|
7075
|
+
const dbSeedPath = join14(dbDir, "seed.ts");
|
|
7258
7076
|
writeFileSync4(dbSeedPath, dbSeedTemplate);
|
|
7259
|
-
const drizzleConfigPath =
|
|
7077
|
+
const drizzleConfigPath = join14(workspace, "drizzle.config.ts");
|
|
7260
7078
|
writeFileSync4(drizzleConfigPath, drizzleConfigTemplate);
|
|
7261
7079
|
packagesUpdated = await setupPackageJson2(workspace, options.gameName);
|
|
7262
7080
|
},
|
|
@@ -7265,7 +7083,7 @@ async function scaffoldDatabaseSetup(options) {
|
|
|
7265
7083
|
return packagesUpdated;
|
|
7266
7084
|
}
|
|
7267
7085
|
async function setupPackageJson2(workspace, gameName) {
|
|
7268
|
-
const pkgPath =
|
|
7086
|
+
const pkgPath = join14(workspace, "package.json");
|
|
7269
7087
|
const dbDeps = {
|
|
7270
7088
|
"drizzle-orm": "^0.42.0",
|
|
7271
7089
|
"better-sqlite3": "^12.0.0"
|
|
@@ -7284,11 +7102,11 @@ async function setupPackageJson2(workspace, gameName) {
|
|
|
7284
7102
|
"db:seed": "playcademy db seed",
|
|
7285
7103
|
"db:reset": "playcademy db reset"
|
|
7286
7104
|
};
|
|
7287
|
-
if (
|
|
7105
|
+
if (existsSync11(pkgPath)) {
|
|
7288
7106
|
await runStep(
|
|
7289
7107
|
"Updating package.json deps",
|
|
7290
7108
|
async () => {
|
|
7291
|
-
const existing = JSON.parse(
|
|
7109
|
+
const existing = JSON.parse(readFileSync6(pkgPath, "utf-8"));
|
|
7292
7110
|
existing.dependencies = { ...existing.dependencies, ...dbDeps };
|
|
7293
7111
|
existing.devDependencies = { ...existing.devDependencies, ...dbDevDeps };
|
|
7294
7112
|
existing.scripts = { ...existing.scripts, ...dbScripts };
|
|
@@ -7307,9 +7125,9 @@ async function setupPackageJson2(workspace, gameName) {
|
|
|
7307
7125
|
}
|
|
7308
7126
|
function hasDatabaseSetup() {
|
|
7309
7127
|
const workspace = getWorkspace();
|
|
7310
|
-
const drizzleConfigPath =
|
|
7311
|
-
const drizzleConfigJsPath =
|
|
7312
|
-
return
|
|
7128
|
+
const drizzleConfigPath = join14(workspace, "drizzle.config.ts");
|
|
7129
|
+
const drizzleConfigJsPath = join14(workspace, "drizzle.config.js");
|
|
7130
|
+
return existsSync11(drizzleConfigPath) || existsSync11(drizzleConfigJsPath);
|
|
7313
7131
|
}
|
|
7314
7132
|
|
|
7315
7133
|
// src/lib/init/scaffold.ts
|
|
@@ -7320,15 +7138,15 @@ var sampleBucketRouteTemplate = loadTemplateString("api/sample-bucket.ts");
|
|
|
7320
7138
|
var playcademyGitignoreTemplate = loadTemplateString("playcademy-gitignore");
|
|
7321
7139
|
async function scaffoldApiDirectory(apiDirectory, sampleRoutes) {
|
|
7322
7140
|
const apiPath = resolve6(getWorkspace(), apiDirectory);
|
|
7323
|
-
const samplePath =
|
|
7324
|
-
if (!
|
|
7325
|
-
|
|
7141
|
+
const samplePath = join15(apiPath, "sample");
|
|
7142
|
+
if (!existsSync12(apiPath)) {
|
|
7143
|
+
mkdirSync4(apiPath, { recursive: true });
|
|
7326
7144
|
}
|
|
7327
|
-
if (!
|
|
7328
|
-
|
|
7145
|
+
if (!existsSync12(samplePath)) {
|
|
7146
|
+
mkdirSync4(samplePath, { recursive: true });
|
|
7329
7147
|
}
|
|
7330
7148
|
for (const route of sampleRoutes) {
|
|
7331
|
-
writeFileSync5(
|
|
7149
|
+
writeFileSync5(join15(samplePath, route.filename), route.template, "utf-8");
|
|
7332
7150
|
}
|
|
7333
7151
|
}
|
|
7334
7152
|
async function scaffoldSampleFileIfMissing(config, sampleFilename, template) {
|
|
@@ -7339,29 +7157,29 @@ async function scaffoldSampleFileIfMissing(config, sampleFilename, template) {
|
|
|
7339
7157
|
SAMPLE_API_SUBDIRECTORY,
|
|
7340
7158
|
sampleFilename
|
|
7341
7159
|
);
|
|
7342
|
-
if (
|
|
7160
|
+
if (existsSync12(sampleFilePath)) {
|
|
7343
7161
|
return false;
|
|
7344
7162
|
}
|
|
7345
7163
|
await scaffoldApiDirectory(customRoutesDir, [{ filename: sampleFilename, template }]);
|
|
7346
7164
|
logger.success(
|
|
7347
|
-
`Created sample route: <${
|
|
7165
|
+
`Created sample route: <${join15(customRoutesDir, SAMPLE_API_SUBDIRECTORY, sampleFilename)}>`
|
|
7348
7166
|
);
|
|
7349
7167
|
return true;
|
|
7350
7168
|
}
|
|
7351
7169
|
function validateApiDirectoryDoesNotExist(value) {
|
|
7352
7170
|
const dirPath = resolve6(getWorkspace(), value.trim());
|
|
7353
|
-
if (
|
|
7171
|
+
if (existsSync12(dirPath)) {
|
|
7354
7172
|
return `Directory "${value.trim()}" already exists. Please choose a different name or remove the existing directory.`;
|
|
7355
7173
|
}
|
|
7356
7174
|
return true;
|
|
7357
7175
|
}
|
|
7358
7176
|
function ensurePlaycademyGitignore() {
|
|
7359
7177
|
const workspace = getWorkspace();
|
|
7360
|
-
const playcademyDir =
|
|
7361
|
-
if (!
|
|
7362
|
-
|
|
7178
|
+
const playcademyDir = join15(workspace, CLI_DIRECTORIES.WORKSPACE);
|
|
7179
|
+
if (!existsSync12(playcademyDir)) {
|
|
7180
|
+
mkdirSync4(playcademyDir, { recursive: true });
|
|
7363
7181
|
}
|
|
7364
|
-
const gitignorePath =
|
|
7182
|
+
const gitignorePath = join15(playcademyDir, ".gitignore");
|
|
7365
7183
|
writeFileSync5(gitignorePath, playcademyGitignoreTemplate);
|
|
7366
7184
|
}
|
|
7367
7185
|
async function scaffoldIntegrations(gameName, options) {
|
|
@@ -7424,7 +7242,7 @@ async function promptForGameInfo() {
|
|
|
7424
7242
|
}
|
|
7425
7243
|
async function promptForTimeBackIntegration(options) {
|
|
7426
7244
|
if (!options?.skipConfirm) {
|
|
7427
|
-
const wantsTimeback = await
|
|
7245
|
+
const wantsTimeback = await confirm({
|
|
7428
7246
|
message: "TimeBack?",
|
|
7429
7247
|
default: false
|
|
7430
7248
|
});
|
|
@@ -7448,7 +7266,7 @@ async function promptForTimeBackIntegration(options) {
|
|
|
7448
7266
|
});
|
|
7449
7267
|
let defaultSubject;
|
|
7450
7268
|
if (subjects.length > 1) {
|
|
7451
|
-
defaultSubject = await
|
|
7269
|
+
defaultSubject = await select({
|
|
7452
7270
|
message: "Default subject:",
|
|
7453
7271
|
choices: subjects.map((subject) => ({
|
|
7454
7272
|
value: subject,
|
|
@@ -7477,7 +7295,7 @@ async function promptForTimeBackIntegration(options) {
|
|
|
7477
7295
|
};
|
|
7478
7296
|
}
|
|
7479
7297
|
async function promptForDatabase() {
|
|
7480
|
-
const wantsDatabase = await
|
|
7298
|
+
const wantsDatabase = await confirm({
|
|
7481
7299
|
message: "Database?",
|
|
7482
7300
|
default: false
|
|
7483
7301
|
});
|
|
@@ -7516,7 +7334,7 @@ async function promptForAuthStrategies() {
|
|
|
7516
7334
|
return strategies.filter((s) => s !== "platform");
|
|
7517
7335
|
}
|
|
7518
7336
|
async function promptForAuth() {
|
|
7519
|
-
const wantsAuth = await
|
|
7337
|
+
const wantsAuth = await confirm({
|
|
7520
7338
|
message: "Authentication?",
|
|
7521
7339
|
default: false
|
|
7522
7340
|
});
|
|
@@ -7527,14 +7345,14 @@ async function promptForAuth() {
|
|
|
7527
7345
|
return { strategies };
|
|
7528
7346
|
}
|
|
7529
7347
|
async function promptForKV() {
|
|
7530
|
-
const wantsKV = await
|
|
7348
|
+
const wantsKV = await confirm({
|
|
7531
7349
|
message: "KV storage?",
|
|
7532
7350
|
default: false
|
|
7533
7351
|
});
|
|
7534
7352
|
return wantsKV;
|
|
7535
7353
|
}
|
|
7536
7354
|
async function promptForBucket() {
|
|
7537
|
-
const wantsBucket = await
|
|
7355
|
+
const wantsBucket = await confirm({
|
|
7538
7356
|
message: "Bucket storage?",
|
|
7539
7357
|
default: false
|
|
7540
7358
|
});
|
|
@@ -7543,7 +7361,7 @@ async function promptForBucket() {
|
|
|
7543
7361
|
async function promptForCustomRoutes(requiresRoutes = false) {
|
|
7544
7362
|
let wantsCustomRoutes = requiresRoutes;
|
|
7545
7363
|
if (!requiresRoutes) {
|
|
7546
|
-
wantsCustomRoutes = await
|
|
7364
|
+
wantsCustomRoutes = await confirm({
|
|
7547
7365
|
message: "Custom API routes?",
|
|
7548
7366
|
default: false
|
|
7549
7367
|
});
|
|
@@ -7588,7 +7406,7 @@ async function selectConfigFormat(hasPackageJson2) {
|
|
|
7588
7406
|
if (hasPackageJson2) {
|
|
7589
7407
|
return "js";
|
|
7590
7408
|
}
|
|
7591
|
-
const formatChoice = await
|
|
7409
|
+
const formatChoice = await select({
|
|
7592
7410
|
message: "Which config format would you like to use?",
|
|
7593
7411
|
choices: [
|
|
7594
7412
|
{ value: "json", name: "JSON (playcademy.config.json)" },
|
|
@@ -7675,9 +7493,9 @@ init_constants2();
|
|
|
7675
7493
|
init_loader();
|
|
7676
7494
|
init_core();
|
|
7677
7495
|
init_backend();
|
|
7678
|
-
import { execSync as
|
|
7679
|
-
import { existsSync as
|
|
7680
|
-
import { dirname as dirname4, join as
|
|
7496
|
+
import { execSync as execSync4 } from "child_process";
|
|
7497
|
+
import { existsSync as existsSync14, writeFileSync as writeFileSync7 } from "fs";
|
|
7498
|
+
import { dirname as dirname4, join as join17 } from "path";
|
|
7681
7499
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
7682
7500
|
|
|
7683
7501
|
// src/lib/secrets/index.ts
|
|
@@ -7689,8 +7507,8 @@ init_loader2();
|
|
|
7689
7507
|
// src/lib/init/tsconfig.ts
|
|
7690
7508
|
init_file_loader();
|
|
7691
7509
|
init_constants2();
|
|
7692
|
-
import { existsSync as
|
|
7693
|
-
import { join as
|
|
7510
|
+
import { existsSync as existsSync13, readFileSync as readFileSync7, writeFileSync as writeFileSync6 } from "fs";
|
|
7511
|
+
import { join as join16 } from "path";
|
|
7694
7512
|
function hasPlaycademyEnv(config) {
|
|
7695
7513
|
return config.include?.includes("playcademy-env.d.ts") ?? false;
|
|
7696
7514
|
}
|
|
@@ -7747,8 +7565,8 @@ function addToIncludeArrayPreservingComments(content) {
|
|
|
7747
7565
|
}
|
|
7748
7566
|
async function ensureTsconfigIncludes(workspace) {
|
|
7749
7567
|
for (const filename of TSCONFIG_FILES) {
|
|
7750
|
-
const configPath =
|
|
7751
|
-
if (!
|
|
7568
|
+
const configPath = join16(workspace, filename);
|
|
7569
|
+
if (!existsSync13(configPath)) {
|
|
7752
7570
|
continue;
|
|
7753
7571
|
}
|
|
7754
7572
|
try {
|
|
@@ -7764,7 +7582,7 @@ async function ensureTsconfigIncludes(workspace) {
|
|
|
7764
7582
|
return filename;
|
|
7765
7583
|
}
|
|
7766
7584
|
try {
|
|
7767
|
-
const rawContent =
|
|
7585
|
+
const rawContent = readFileSync7(configPath, "utf-8");
|
|
7768
7586
|
const updatedContent = addToIncludeArrayPreservingComments(rawContent);
|
|
7769
7587
|
if (updatedContent && updatedContent !== rawContent) {
|
|
7770
7588
|
writeFileSync6(configPath, updatedContent);
|
|
@@ -7797,8 +7615,8 @@ function hasAnyBackend(features) {
|
|
|
7797
7615
|
return Object.values(features).some(Boolean);
|
|
7798
7616
|
}
|
|
7799
7617
|
async function setupPlaycademyDependencies(workspace) {
|
|
7800
|
-
const playcademyDir =
|
|
7801
|
-
const playcademyPkgPath =
|
|
7618
|
+
const playcademyDir = join17(workspace, CLI_DIRECTORIES.WORKSPACE);
|
|
7619
|
+
const playcademyPkgPath = join17(playcademyDir, "package.json");
|
|
7802
7620
|
const __dirname2 = dirname4(fileURLToPath2(import.meta.url));
|
|
7803
7621
|
const cliPkg = await loadPackageJson({ cwd: __dirname2, searchUp: true, required: true });
|
|
7804
7622
|
const workersTypesVersion = cliPkg?.devDependencies?.["@cloudflare/workers-types"] || "latest";
|
|
@@ -7811,7 +7629,7 @@ async function setupPlaycademyDependencies(workspace) {
|
|
|
7811
7629
|
writeFileSync7(playcademyPkgPath, JSON.stringify(playcademyPkg, null, 4) + "\n");
|
|
7812
7630
|
const pm = detectPackageManager(workspace);
|
|
7813
7631
|
const installCmd = getInstallCommand(pm);
|
|
7814
|
-
|
|
7632
|
+
execSync4(installCmd, {
|
|
7815
7633
|
cwd: playcademyDir,
|
|
7816
7634
|
stdio: ["ignore", "ignore", "ignore"]
|
|
7817
7635
|
});
|
|
@@ -7883,14 +7701,14 @@ async function ensurePlaycademyTypes(options = {}) {
|
|
|
7883
7701
|
const bindingsStr = generateBindingsTypeString(features);
|
|
7884
7702
|
const secretsStr = await generateSecretsTypeString(workspace, verbose);
|
|
7885
7703
|
const hasAuth = !!config.integrations?.auth;
|
|
7886
|
-
const hasAuthFile =
|
|
7704
|
+
const hasAuthFile = existsSync14(join17(workspace, "server/lib/auth.ts"));
|
|
7887
7705
|
const authVariablesString = generateAuthVariablesString(hasAuth, hasAuthFile);
|
|
7888
7706
|
let envContent = playcademyEnvTemplate.replace("{{BINDINGS}}", bindingsStr);
|
|
7889
7707
|
envContent = envContent.replace("{{SECRETS}}", secretsStr);
|
|
7890
7708
|
envContent = envContent.replace("{{AUTH_IMPORT}}", authVariablesString.authImport);
|
|
7891
7709
|
envContent = envContent.replace("{{VARIABLES}}", authVariablesString.variables);
|
|
7892
7710
|
envContent = envContent.replace("{{CONTEXT_VARS}}", authVariablesString.contextVars);
|
|
7893
|
-
const envPath =
|
|
7711
|
+
const envPath = join17(workspace, "playcademy-env.d.ts");
|
|
7894
7712
|
writeFileSync7(envPath, envContent);
|
|
7895
7713
|
if (verbose) {
|
|
7896
7714
|
logger.success(`Generated <playcademy-env.d.ts>`);
|
|
@@ -7909,16 +7727,16 @@ async function ensurePlaycademyTypes(options = {}) {
|
|
|
7909
7727
|
// src/lib/init/gitignore.ts
|
|
7910
7728
|
init_core();
|
|
7911
7729
|
init_loader2();
|
|
7912
|
-
import { existsSync as
|
|
7913
|
-
import { join as
|
|
7730
|
+
import { existsSync as existsSync15, readFileSync as readFileSync8, writeFileSync as writeFileSync8 } from "fs";
|
|
7731
|
+
import { join as join18 } from "path";
|
|
7914
7732
|
var rootGitignoreTemplate = loadTemplateString("gitignore");
|
|
7915
7733
|
function ensureRootGitignore(workspace = getWorkspace()) {
|
|
7916
|
-
const gitignorePath =
|
|
7917
|
-
if (!
|
|
7734
|
+
const gitignorePath = join18(workspace, ".gitignore");
|
|
7735
|
+
if (!existsSync15(gitignorePath)) {
|
|
7918
7736
|
writeFileSync8(gitignorePath, rootGitignoreTemplate);
|
|
7919
7737
|
return;
|
|
7920
7738
|
}
|
|
7921
|
-
const existingContent =
|
|
7739
|
+
const existingContent = readFileSync8(gitignorePath, "utf-8");
|
|
7922
7740
|
const existingNormalized = new Set(
|
|
7923
7741
|
existingContent.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).map(normalizeGitignoreEntry)
|
|
7924
7742
|
);
|
|
@@ -7945,8 +7763,8 @@ init_package_manager();
|
|
|
7945
7763
|
init_writer();
|
|
7946
7764
|
init_core();
|
|
7947
7765
|
init_loader2();
|
|
7948
|
-
import { execSync as
|
|
7949
|
-
import { readFileSync as
|
|
7766
|
+
import { execSync as execSync5 } from "child_process";
|
|
7767
|
+
import { readFileSync as readFileSync9, writeFileSync as writeFileSync9 } from "node:fs";
|
|
7950
7768
|
import path2 from "node:path";
|
|
7951
7769
|
var viteConfigTemplate = loadTemplateString("config/vite-config.ts");
|
|
7952
7770
|
async function findViteConfig() {
|
|
@@ -7962,7 +7780,7 @@ async function isVitePluginInstalled() {
|
|
|
7962
7780
|
return hasDependency("@playcademy/vite-plugin", { cwd: workspace });
|
|
7963
7781
|
}
|
|
7964
7782
|
function isPluginConfigured(configPath) {
|
|
7965
|
-
const content =
|
|
7783
|
+
const content = readFileSync9(configPath, "utf-8");
|
|
7966
7784
|
return content.includes("@playcademy/vite-plugin") || content.includes("playcademy(");
|
|
7967
7785
|
}
|
|
7968
7786
|
async function installVitePlugin() {
|
|
@@ -7973,7 +7791,7 @@ async function installVitePlugin() {
|
|
|
7973
7791
|
await runStep(
|
|
7974
7792
|
"Installing @playcademy/vite-plugin...",
|
|
7975
7793
|
async () => {
|
|
7976
|
-
|
|
7794
|
+
execSync5(command, {
|
|
7977
7795
|
cwd: workspace,
|
|
7978
7796
|
stdio: ["ignore", "ignore", "ignore"]
|
|
7979
7797
|
});
|
|
@@ -7990,7 +7808,7 @@ function createViteConfig() {
|
|
|
7990
7808
|
writeFileSync9(configPath, viteConfigTemplate);
|
|
7991
7809
|
}
|
|
7992
7810
|
async function updateViteConfig(configPath) {
|
|
7993
|
-
let content =
|
|
7811
|
+
let content = readFileSync9(configPath, "utf-8");
|
|
7994
7812
|
if (!content.includes("@playcademy/vite-plugin")) {
|
|
7995
7813
|
const importMatch = content.match(/import .+ from ['"]vite['"]/);
|
|
7996
7814
|
if (importMatch) {
|
|
@@ -8028,10 +7846,10 @@ init_backend();
|
|
|
8028
7846
|
init_file_loader();
|
|
8029
7847
|
init_constants2();
|
|
8030
7848
|
init_core();
|
|
8031
|
-
import { join as
|
|
7849
|
+
import { join as join19, relative as relative3 } from "path";
|
|
8032
7850
|
function findSingleBuildZip() {
|
|
8033
7851
|
const workspace = getWorkspace();
|
|
8034
|
-
const playcademyDir =
|
|
7852
|
+
const playcademyDir = join19(workspace, CLI_DIRECTORIES.WORKSPACE);
|
|
8035
7853
|
const zipFiles = findFilesByExtension(playcademyDir, "zip");
|
|
8036
7854
|
if (zipFiles.length === 1) {
|
|
8037
7855
|
return zipFiles[0] ? relative3(workspace, zipFiles[0]) : null;
|
|
@@ -8043,9 +7861,9 @@ function findSingleBuildZip() {
|
|
|
8043
7861
|
init_constants2();
|
|
8044
7862
|
init_config3();
|
|
8045
7863
|
init_core();
|
|
8046
|
-
import { existsSync as
|
|
7864
|
+
import { existsSync as existsSync16 } from "fs";
|
|
8047
7865
|
import { createRequire } from "module";
|
|
8048
|
-
import { join as
|
|
7866
|
+
import { join as join20 } from "path";
|
|
8049
7867
|
async function getDatabaseDirectory() {
|
|
8050
7868
|
try {
|
|
8051
7869
|
const config = await loadConfig();
|
|
@@ -8073,8 +7891,8 @@ async function getSchemaInfo(previousSchemaSnapshot) {
|
|
|
8073
7891
|
return null;
|
|
8074
7892
|
}
|
|
8075
7893
|
const dbDirectory = await getDatabaseDirectory();
|
|
8076
|
-
const schemaPath =
|
|
8077
|
-
if (!
|
|
7894
|
+
const schemaPath = join20(workspace, dbDirectory, SCHEMA_SUBDIRECTORY, SCHEMA_INDEX_FILE);
|
|
7895
|
+
if (!existsSync16(schemaPath)) {
|
|
8078
7896
|
return null;
|
|
8079
7897
|
}
|
|
8080
7898
|
try {
|
|
@@ -8110,14 +7928,14 @@ async function getSchemaStatementCount(previousSchemaSnapshot) {
|
|
|
8110
7928
|
|
|
8111
7929
|
// src/lib/deploy/validate.ts
|
|
8112
7930
|
init_logger();
|
|
8113
|
-
import { existsSync as
|
|
7931
|
+
import { existsSync as existsSync17 } from "fs";
|
|
8114
7932
|
import { resolve as resolve7 } from "path";
|
|
8115
7933
|
function validateBuildPath(path4) {
|
|
8116
7934
|
if (!path4.trim()) {
|
|
8117
7935
|
return "Build path is required";
|
|
8118
7936
|
}
|
|
8119
7937
|
const resolvedPath = resolve7(path4.trim());
|
|
8120
|
-
if (!
|
|
7938
|
+
if (!existsSync17(resolvedPath)) {
|
|
8121
7939
|
return `Build path not found: ${path4.trim()}`;
|
|
8122
7940
|
}
|
|
8123
7941
|
return true;
|
|
@@ -8160,7 +7978,7 @@ async function selectEnvironment(options) {
|
|
|
8160
7978
|
logger.remark(`Deploying to ${environment}`, 1);
|
|
8161
7979
|
} else if (authenticatedEnvs.length === 2 && !options.dryRun) {
|
|
8162
7980
|
logger.newLine();
|
|
8163
|
-
environment = await
|
|
7981
|
+
environment = await select2({
|
|
8164
7982
|
message: "Select deployment environment:",
|
|
8165
7983
|
choices: [
|
|
8166
7984
|
{ value: "staging", name: "Staging (hub.dev.playcademy.net)" },
|
|
@@ -8187,11 +8005,6 @@ async function promptForMissingConfig(context2) {
|
|
|
8187
8005
|
});
|
|
8188
8006
|
}
|
|
8189
8007
|
if (needsBuildPath) {
|
|
8190
|
-
const godotBuildPath = await handleGodotBuildPrompt();
|
|
8191
|
-
if (godotBuildPath) {
|
|
8192
|
-
config.buildPath = godotBuildPath;
|
|
8193
|
-
return true;
|
|
8194
|
-
}
|
|
8195
8008
|
const savedBuildPath = context2.deployedGameInfo?.buildPath;
|
|
8196
8009
|
const discoveredBuildZip = findSingleBuildZip();
|
|
8197
8010
|
const defaultBuildPath = discoveredBuildZip || savedBuildPath;
|
|
@@ -8206,7 +8019,7 @@ async function promptForMissingConfig(context2) {
|
|
|
8206
8019
|
async function confirmDeploymentPlan(plan, context2) {
|
|
8207
8020
|
const { config } = context2;
|
|
8208
8021
|
if (plan.action === "deploy-new") {
|
|
8209
|
-
const shouldDeploy = await
|
|
8022
|
+
const shouldDeploy = await confirm2({
|
|
8210
8023
|
message: "Deploy this game?",
|
|
8211
8024
|
default: true
|
|
8212
8025
|
});
|
|
@@ -8274,7 +8087,7 @@ async function confirmDeploymentPlan(plan, context2) {
|
|
|
8274
8087
|
currentKeys: context2.currentSecretKeys
|
|
8275
8088
|
}
|
|
8276
8089
|
});
|
|
8277
|
-
const shouldDeploy = await
|
|
8090
|
+
const shouldDeploy = await confirm2({
|
|
8278
8091
|
message: `Update ${config.displayName}?`,
|
|
8279
8092
|
default: true
|
|
8280
8093
|
});
|
|
@@ -8456,7 +8269,7 @@ function reportCancellation() {
|
|
|
8456
8269
|
|
|
8457
8270
|
// src/lib/deploy/preparation.ts
|
|
8458
8271
|
import { stat } from "node:fs/promises";
|
|
8459
|
-
import { join as
|
|
8272
|
+
import { join as join22 } from "node:path";
|
|
8460
8273
|
|
|
8461
8274
|
// ../data/src/domains/game/helpers.ts
|
|
8462
8275
|
var isHostedGame = (game) => {
|
|
@@ -8907,22 +8720,22 @@ init_context();
|
|
|
8907
8720
|
|
|
8908
8721
|
// src/lib/games/storage.ts
|
|
8909
8722
|
init_constants2();
|
|
8910
|
-
import { existsSync as
|
|
8723
|
+
import { existsSync as existsSync18 } from "node:fs";
|
|
8911
8724
|
import { mkdir as mkdir3, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
|
|
8912
8725
|
import { homedir as homedir2 } from "node:os";
|
|
8913
|
-
import { join as
|
|
8726
|
+
import { join as join21 } from "node:path";
|
|
8914
8727
|
function getGamesStorePath() {
|
|
8915
|
-
return
|
|
8728
|
+
return join21(homedir2(), CLI_USER_DIRECTORIES.CONFIG, CLI_FILES.GAMES_STORE);
|
|
8916
8729
|
}
|
|
8917
8730
|
async function ensureConfigDir() {
|
|
8918
|
-
const configDir =
|
|
8731
|
+
const configDir = join21(homedir2(), CLI_USER_DIRECTORIES.CONFIG);
|
|
8919
8732
|
await mkdir3(configDir, { recursive: true });
|
|
8920
8733
|
}
|
|
8921
8734
|
async function loadGameStore() {
|
|
8922
8735
|
try {
|
|
8923
8736
|
await ensureConfigDir();
|
|
8924
8737
|
const storePath = getGamesStorePath();
|
|
8925
|
-
if (
|
|
8738
|
+
if (existsSync18(storePath)) {
|
|
8926
8739
|
const content = await readFile3(storePath, "utf-8");
|
|
8927
8740
|
return JSON.parse(content);
|
|
8928
8741
|
}
|
|
@@ -9216,8 +9029,8 @@ async function analyzeChanges(context2) {
|
|
|
9216
9029
|
const bundle = await bundleBackend(context2.fullConfig);
|
|
9217
9030
|
const bundleHash = hashContent(bundle.code);
|
|
9218
9031
|
const [serverSize, dbSize] = await Promise.all([
|
|
9219
|
-
getDirectorySize(
|
|
9220
|
-
getDirectorySize(
|
|
9032
|
+
getDirectorySize(join22(projectPath, "server")),
|
|
9033
|
+
getDirectorySize(join22(projectPath, "db"))
|
|
9221
9034
|
]);
|
|
9222
9035
|
context2.currentBackendBundleHash = bundleHash;
|
|
9223
9036
|
context2.currentBackendSize = bundle.code.length;
|
|
@@ -9340,9 +9153,9 @@ function hasOptionalFieldsMissing(missing) {
|
|
|
9340
9153
|
// src/lib/deploy/steps.ts
|
|
9341
9154
|
init_src();
|
|
9342
9155
|
init_logger();
|
|
9343
|
-
import { existsSync as
|
|
9156
|
+
import { existsSync as existsSync19 } from "fs";
|
|
9344
9157
|
import { readFile as readFile4 } from "fs/promises";
|
|
9345
|
-
import { basename as basename2, join as
|
|
9158
|
+
import { basename as basename2, join as join23, resolve as resolve8 } from "path";
|
|
9346
9159
|
|
|
9347
9160
|
// src/lib/deploy/utils.ts
|
|
9348
9161
|
init_src2();
|
|
@@ -9365,7 +9178,7 @@ function prepareGameMetadata(config) {
|
|
|
9365
9178
|
}
|
|
9366
9179
|
async function prepareBuildFile(buildPath) {
|
|
9367
9180
|
const resolvedPath = resolve8(buildPath);
|
|
9368
|
-
if (resolvedPath.endsWith(".zip") &&
|
|
9181
|
+
if (resolvedPath.endsWith(".zip") && existsSync19(resolvedPath)) {
|
|
9369
9182
|
const buffer = await readFile4(resolvedPath);
|
|
9370
9183
|
const uint8Array = new Uint8Array(buffer);
|
|
9371
9184
|
const blob = new Blob([uint8Array], { type: "application/zip" });
|
|
@@ -9532,8 +9345,8 @@ async function deployGame(context2, shouldUploadBuild, shouldDeployBackend) {
|
|
|
9532
9345
|
};
|
|
9533
9346
|
const { getDirectorySize: getDirectorySize2 } = await Promise.resolve().then(() => (init_backend(), backend_exports));
|
|
9534
9347
|
const [serverSize, dbSize] = await Promise.all([
|
|
9535
|
-
getDirectorySize2(
|
|
9536
|
-
getDirectorySize2(
|
|
9348
|
+
getDirectorySize2(join23(context2.projectPath, "server")),
|
|
9349
|
+
getDirectorySize2(join23(context2.projectPath, "db"))
|
|
9537
9350
|
]);
|
|
9538
9351
|
backendMetadata = {
|
|
9539
9352
|
backendBundleHash: hashContent(bundle.code),
|
|
@@ -9585,13 +9398,13 @@ async function deployGame(context2, shouldUploadBuild, shouldDeployBackend) {
|
|
|
9585
9398
|
// src/lib/dev/backend.ts
|
|
9586
9399
|
init_constants2();
|
|
9587
9400
|
init_core();
|
|
9588
|
-
import { existsSync as
|
|
9589
|
-
import { join as
|
|
9401
|
+
import { existsSync as existsSync20 } from "fs";
|
|
9402
|
+
import { join as join24 } from "path";
|
|
9590
9403
|
function hasCustomRoutes(config) {
|
|
9591
9404
|
const workspace = getWorkspace();
|
|
9592
9405
|
const customRoutesConfig = config?.integrations?.customRoutes;
|
|
9593
9406
|
const customRoutesDir = typeof customRoutesConfig === "object" && customRoutesConfig.directory || DEFAULT_API_ROUTES_DIRECTORY;
|
|
9594
|
-
return
|
|
9407
|
+
return existsSync20(join24(workspace, customRoutesDir));
|
|
9595
9408
|
}
|
|
9596
9409
|
function needsBackend(config) {
|
|
9597
9410
|
return !!config?.integrations || hasCustomRoutes(config);
|
|
@@ -9689,7 +9502,7 @@ function displayRegisteredRoutes(integrations, customRoutes = []) {
|
|
|
9689
9502
|
// src/lib/dev/reload.ts
|
|
9690
9503
|
init_constants2();
|
|
9691
9504
|
init_core();
|
|
9692
|
-
import { join as
|
|
9505
|
+
import { join as join25, relative as relative4 } from "path";
|
|
9693
9506
|
import chokidar from "chokidar";
|
|
9694
9507
|
import { bold as bold5, cyan as cyan3, dim as dim7, green as green3 } from "colorette";
|
|
9695
9508
|
function formatTime() {
|
|
@@ -9706,9 +9519,9 @@ function startHotReload(onReload, options = {}) {
|
|
|
9706
9519
|
const customRoutesConfig = options.config?.integrations?.customRoutes;
|
|
9707
9520
|
const customRoutesDir = typeof customRoutesConfig === "object" && customRoutesConfig.directory || DEFAULT_API_ROUTES_DIRECTORY;
|
|
9708
9521
|
const watchPaths = [
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9522
|
+
join25(workspace, customRoutesDir),
|
|
9523
|
+
join25(workspace, "playcademy.config.js"),
|
|
9524
|
+
join25(workspace, "playcademy.config.json")
|
|
9712
9525
|
];
|
|
9713
9526
|
const watcher = chokidar.watch(watchPaths, {
|
|
9714
9527
|
persistent: true,
|
|
@@ -9750,14 +9563,14 @@ function startHotReload(onReload, options = {}) {
|
|
|
9750
9563
|
// src/lib/dev/server.ts
|
|
9751
9564
|
init_src2();
|
|
9752
9565
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
9753
|
-
import { join as
|
|
9566
|
+
import { join as join27 } from "path";
|
|
9754
9567
|
import { Log, LogLevel, Miniflare } from "miniflare";
|
|
9755
9568
|
|
|
9756
9569
|
// ../utils/src/port.ts
|
|
9757
|
-
import { existsSync as
|
|
9570
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync5, readFileSync as readFileSync10, writeFileSync as writeFileSync10 } from "node:fs";
|
|
9758
9571
|
import { createServer as createServer2 } from "node:net";
|
|
9759
9572
|
import { homedir as homedir3 } from "node:os";
|
|
9760
|
-
import { join as
|
|
9573
|
+
import { join as join26 } from "node:path";
|
|
9761
9574
|
async function isPortAvailableOnHost(port, host) {
|
|
9762
9575
|
return new Promise((resolve11) => {
|
|
9763
9576
|
const server = createServer2();
|
|
@@ -9796,19 +9609,19 @@ async function findAvailablePort(startPort = 4321) {
|
|
|
9796
9609
|
}
|
|
9797
9610
|
function getRegistryPath() {
|
|
9798
9611
|
const home = homedir3();
|
|
9799
|
-
const dir =
|
|
9800
|
-
if (!
|
|
9801
|
-
|
|
9612
|
+
const dir = join26(home, ".playcademy");
|
|
9613
|
+
if (!existsSync21(dir)) {
|
|
9614
|
+
mkdirSync5(dir, { recursive: true });
|
|
9802
9615
|
}
|
|
9803
|
-
return
|
|
9616
|
+
return join26(dir, ".proc");
|
|
9804
9617
|
}
|
|
9805
9618
|
function readRegistry() {
|
|
9806
9619
|
const registryPath = getRegistryPath();
|
|
9807
|
-
if (!
|
|
9620
|
+
if (!existsSync21(registryPath)) {
|
|
9808
9621
|
return {};
|
|
9809
9622
|
}
|
|
9810
9623
|
try {
|
|
9811
|
-
const content =
|
|
9624
|
+
const content = readFileSync10(registryPath, "utf-8");
|
|
9812
9625
|
return JSON.parse(content);
|
|
9813
9626
|
} catch {
|
|
9814
9627
|
return {};
|
|
@@ -9983,7 +9796,7 @@ async function startDevServer(options) {
|
|
|
9983
9796
|
return { server: mf, port };
|
|
9984
9797
|
}
|
|
9985
9798
|
async function ensureDatabaseDirectory() {
|
|
9986
|
-
const dbDir =
|
|
9799
|
+
const dbDir = join27(getWorkspace(), CLI_DIRECTORIES.DATABASE);
|
|
9987
9800
|
try {
|
|
9988
9801
|
await mkdir4(dbDir, { recursive: true });
|
|
9989
9802
|
} catch (error) {
|
|
@@ -9992,7 +9805,7 @@ async function ensureDatabaseDirectory() {
|
|
|
9992
9805
|
return dbDir;
|
|
9993
9806
|
}
|
|
9994
9807
|
async function ensureKvDirectory() {
|
|
9995
|
-
const kvDir =
|
|
9808
|
+
const kvDir = join27(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
9996
9809
|
try {
|
|
9997
9810
|
await mkdir4(kvDir, { recursive: true });
|
|
9998
9811
|
} catch (error) {
|
|
@@ -10001,7 +9814,7 @@ async function ensureKvDirectory() {
|
|
|
10001
9814
|
return kvDir;
|
|
10002
9815
|
}
|
|
10003
9816
|
async function ensureBucketDirectory() {
|
|
10004
|
-
const bucketDir =
|
|
9817
|
+
const bucketDir = join27(getWorkspace(), CLI_DIRECTORIES.BUCKET);
|
|
10005
9818
|
try {
|
|
10006
9819
|
await mkdir4(bucketDir, { recursive: true });
|
|
10007
9820
|
} catch (error) {
|
|
@@ -10294,7 +10107,7 @@ init_file_loader();
|
|
|
10294
10107
|
init_constants2();
|
|
10295
10108
|
import { writeFileSync as writeFileSync11 } from "fs";
|
|
10296
10109
|
import { resolve as resolve9 } from "path";
|
|
10297
|
-
import { confirm as
|
|
10110
|
+
import { confirm as confirm3 } from "@inquirer/prompts";
|
|
10298
10111
|
import { Command } from "commander";
|
|
10299
10112
|
var configCommand = new Command("config").description("Create playcademy.config file").option("-f, --force", "Overwrite existing config file if it exists").action(async (options) => {
|
|
10300
10113
|
try {
|
|
@@ -10309,7 +10122,7 @@ var configCommand = new Command("config").description("Create playcademy.config
|
|
|
10309
10122
|
`Configuration file already exists: ${relativePath}`
|
|
10310
10123
|
]);
|
|
10311
10124
|
logger.newLine();
|
|
10312
|
-
const shouldOverwrite = await
|
|
10125
|
+
const shouldOverwrite = await confirm3({
|
|
10313
10126
|
message: "Do you want to overwrite it?",
|
|
10314
10127
|
default: false
|
|
10315
10128
|
});
|
|
@@ -10383,7 +10196,7 @@ var initCommand = new Command2("init").description("Initialize a playcademy.conf
|
|
|
10383
10196
|
`Configuration file already exists: ${relativePath}`
|
|
10384
10197
|
]);
|
|
10385
10198
|
logger.newLine();
|
|
10386
|
-
const shouldOverwrite = await
|
|
10199
|
+
const shouldOverwrite = await confirm4({
|
|
10387
10200
|
message: "Do you want to overwrite it?",
|
|
10388
10201
|
default: false
|
|
10389
10202
|
});
|
|
@@ -10435,7 +10248,7 @@ var initCommand = new Command2("init").description("Initialize a playcademy.conf
|
|
|
10435
10248
|
if (depsAdded) {
|
|
10436
10249
|
const pm = detectPackageManager(getWorkspace());
|
|
10437
10250
|
const installCmd = getInstallCommand(pm);
|
|
10438
|
-
|
|
10251
|
+
execSync6(installCmd, {
|
|
10439
10252
|
cwd: getWorkspace(),
|
|
10440
10253
|
stdio: ["ignore", "ignore", "ignore"]
|
|
10441
10254
|
});
|
|
@@ -10485,7 +10298,7 @@ var initCommand = new Command2("init").description("Initialize a playcademy.conf
|
|
|
10485
10298
|
});
|
|
10486
10299
|
async function addPlaycademySdk() {
|
|
10487
10300
|
const pkgPath = resolve10(getWorkspace(), "package.json");
|
|
10488
|
-
const pkg = JSON.parse(
|
|
10301
|
+
const pkg = JSON.parse(readFileSync11(pkgPath, "utf-8"));
|
|
10489
10302
|
const hasSdk = pkg.dependencies?.["@playcademy/sdk"] || pkg.devDependencies?.["@playcademy/sdk"];
|
|
10490
10303
|
if (hasSdk) {
|
|
10491
10304
|
return false;
|
|
@@ -10501,7 +10314,7 @@ initCommand.addCommand(configCommand);
|
|
|
10501
10314
|
init_src();
|
|
10502
10315
|
init_file_loader();
|
|
10503
10316
|
init_constants2();
|
|
10504
|
-
import { input as input3, password, select as
|
|
10317
|
+
import { input as input3, password, select as select3 } from "@inquirer/prompts";
|
|
10505
10318
|
import { bold as bold6, dim as dim8, whiteBright } from "colorette";
|
|
10506
10319
|
import { Command as Command3 } from "commander";
|
|
10507
10320
|
import open from "open";
|
|
@@ -10528,7 +10341,7 @@ var loginCommand = new Command3("login").description("Authenticate with Playcade
|
|
|
10528
10341
|
}
|
|
10529
10342
|
const hasEmailPassword = email || password2;
|
|
10530
10343
|
const explicitMethod = sso ? "sso" : hasEmailPassword ? "email" : null;
|
|
10531
|
-
const authMethod = explicitMethod || await
|
|
10344
|
+
const authMethod = explicitMethod || await select3({
|
|
10532
10345
|
message: "Choose authentication method:",
|
|
10533
10346
|
choices: [
|
|
10534
10347
|
{ value: "email", name: "Email/Password" },
|
|
@@ -10840,7 +10653,7 @@ import { Command as Command9 } from "commander";
|
|
|
10840
10653
|
// src/commands/games/delete.ts
|
|
10841
10654
|
init_src();
|
|
10842
10655
|
init_string();
|
|
10843
|
-
import { confirm as
|
|
10656
|
+
import { confirm as confirm5, input as input4, select as select4 } from "@inquirer/prompts";
|
|
10844
10657
|
import { Command as Command7 } from "commander";
|
|
10845
10658
|
var deleteCommand = new Command7("delete").alias("rm").alias("remove").description("Delete a game").argument("[slug]", "Game slug to delete").option("-f, --force", "Skip confirmation prompt").option("--env <environment>", "Environment to delete game from (staging or production)").action(async (slug, options) => {
|
|
10846
10659
|
const { env } = options;
|
|
@@ -10862,7 +10675,7 @@ var deleteCommand = new Command7("delete").alias("rm").alias("remove").descripti
|
|
|
10862
10675
|
logger.newLine();
|
|
10863
10676
|
let game;
|
|
10864
10677
|
if (!slug) {
|
|
10865
|
-
const selectedSlug = await
|
|
10678
|
+
const selectedSlug = await select4({
|
|
10866
10679
|
message: "Select a game to delete:",
|
|
10867
10680
|
choices: games2.map((g) => ({
|
|
10868
10681
|
value: g.slug,
|
|
@@ -10877,7 +10690,7 @@ var deleteCommand = new Command7("delete").alias("rm").alias("remove").descripti
|
|
|
10877
10690
|
}
|
|
10878
10691
|
}
|
|
10879
10692
|
if (!options.force) {
|
|
10880
|
-
const confirmed = await
|
|
10693
|
+
const confirmed = await confirm5({
|
|
10881
10694
|
message: "Are you sure you want to delete this game? This cannot be undone.",
|
|
10882
10695
|
default: false
|
|
10883
10696
|
});
|
|
@@ -11263,7 +11076,7 @@ import { Command as Command16 } from "commander";
|
|
|
11263
11076
|
init_file_loader();
|
|
11264
11077
|
init_constants2();
|
|
11265
11078
|
import { writeFileSync as writeFileSync13 } from "fs";
|
|
11266
|
-
import { join as
|
|
11079
|
+
import { join as join28 } from "path";
|
|
11267
11080
|
import { bold as bold7 } from "colorette";
|
|
11268
11081
|
import { Command as Command14 } from "commander";
|
|
11269
11082
|
var addAuthCommand = new Command14("add").description("Add an authentication provider to your project").argument("<provider>", "Provider to add: email | github | google").addHelpText(
|
|
@@ -11301,7 +11114,7 @@ Examples:
|
|
|
11301
11114
|
logger.highlight(`Add ${providerDisplayName} Authentication`);
|
|
11302
11115
|
logger.newLine();
|
|
11303
11116
|
const workspace = getWorkspace();
|
|
11304
|
-
const authPath =
|
|
11117
|
+
const authPath = join28(workspace, SERVER_LIB_DIRECTORY, AUTH_CONFIG_FILE);
|
|
11305
11118
|
let authContent = await loadFile(authPath);
|
|
11306
11119
|
if (!authContent) {
|
|
11307
11120
|
logger.error("Authentication configuration not found");
|
|
@@ -11356,7 +11169,7 @@ Examples:
|
|
|
11356
11169
|
|
|
11357
11170
|
// src/commands/auth/init.ts
|
|
11358
11171
|
init_constants2();
|
|
11359
|
-
import { confirm as
|
|
11172
|
+
import { confirm as confirm6 } from "@inquirer/prompts";
|
|
11360
11173
|
import { Command as Command15 } from "commander";
|
|
11361
11174
|
init_writer();
|
|
11362
11175
|
init_backend();
|
|
@@ -11380,7 +11193,7 @@ var initAuthCommand = new Command15("init").description("Add authentication to y
|
|
|
11380
11193
|
"Authentication requires a database to store user sessions."
|
|
11381
11194
|
]);
|
|
11382
11195
|
logger.newLine();
|
|
11383
|
-
const shouldCreateDb = await
|
|
11196
|
+
const shouldCreateDb = await confirm6({
|
|
11384
11197
|
message: "Create database?",
|
|
11385
11198
|
default: true
|
|
11386
11199
|
});
|
|
@@ -11587,9 +11400,9 @@ async function runDbInit() {
|
|
|
11587
11400
|
|
|
11588
11401
|
// src/commands/db/reset.ts
|
|
11589
11402
|
init_src();
|
|
11590
|
-
import { existsSync as
|
|
11591
|
-
import { join as
|
|
11592
|
-
import { confirm as
|
|
11403
|
+
import { existsSync as existsSync22 } from "fs";
|
|
11404
|
+
import { join as join29 } from "path";
|
|
11405
|
+
import { confirm as confirm7, input as input7 } from "@inquirer/prompts";
|
|
11593
11406
|
import { bold as bold8, redBright as redBright2, underline as underline3 } from "colorette";
|
|
11594
11407
|
import { Miniflare as Miniflare2 } from "miniflare";
|
|
11595
11408
|
init_constants2();
|
|
@@ -11614,7 +11427,7 @@ async function runDbResetRemote(options) {
|
|
|
11614
11427
|
`This action is irreversible and ${underline3(bold8("cannot be undone"))}.`
|
|
11615
11428
|
]);
|
|
11616
11429
|
logger.newLine();
|
|
11617
|
-
const confirmed = await
|
|
11430
|
+
const confirmed = await confirm7({
|
|
11618
11431
|
message: "Are you sure you want to reset this database? This cannot be undone.",
|
|
11619
11432
|
default: false
|
|
11620
11433
|
});
|
|
@@ -11668,8 +11481,8 @@ async function runDbResetRemote(options) {
|
|
|
11668
11481
|
}
|
|
11669
11482
|
async function runDbResetLocal(options) {
|
|
11670
11483
|
const workspace = getWorkspace();
|
|
11671
|
-
const dbDir =
|
|
11672
|
-
if (!
|
|
11484
|
+
const dbDir = join29(workspace, CLI_DIRECTORIES.DATABASE);
|
|
11485
|
+
if (!existsSync22(dbDir)) {
|
|
11673
11486
|
logger.warn("No database found to reset");
|
|
11674
11487
|
logger.newLine();
|
|
11675
11488
|
logger.remark("Nothing to do");
|
|
@@ -11686,7 +11499,7 @@ async function runDbResetLocal(options) {
|
|
|
11686
11499
|
}
|
|
11687
11500
|
if (!options.force) {
|
|
11688
11501
|
logger.newLine();
|
|
11689
|
-
const shouldReset = await
|
|
11502
|
+
const shouldReset = await confirm7({
|
|
11690
11503
|
message: "This will delete all local database data. Continue?",
|
|
11691
11504
|
default: false
|
|
11692
11505
|
});
|
|
@@ -11731,9 +11544,9 @@ async function runDbReset(options = {}) {
|
|
|
11731
11544
|
// src/commands/db/seed.ts
|
|
11732
11545
|
init_src();
|
|
11733
11546
|
init_constants2();
|
|
11734
|
-
import { existsSync as
|
|
11735
|
-
import { join as
|
|
11736
|
-
import { confirm as
|
|
11547
|
+
import { existsSync as existsSync23 } from "fs";
|
|
11548
|
+
import { join as join30 } from "path";
|
|
11549
|
+
import { confirm as confirm8, input as input8 } from "@inquirer/prompts";
|
|
11737
11550
|
import { bold as bold9, redBright as redBright3, underline as underline4 } from "colorette";
|
|
11738
11551
|
import { Miniflare as Miniflare3 } from "miniflare";
|
|
11739
11552
|
async function runDbResetRemote2(gameSlug, environment) {
|
|
@@ -11791,7 +11604,7 @@ async function runDbSeedRemote(seedFile, options) {
|
|
|
11791
11604
|
}
|
|
11792
11605
|
logger.newLine();
|
|
11793
11606
|
if (willReset) {
|
|
11794
|
-
const confirmed = await
|
|
11607
|
+
const confirmed = await confirm8({
|
|
11795
11608
|
message: "Are you sure you want to reset and seed this database? This cannot be undone.",
|
|
11796
11609
|
default: false
|
|
11797
11610
|
});
|
|
@@ -11818,7 +11631,7 @@ async function runDbSeedRemote(seedFile, options) {
|
|
|
11818
11631
|
return;
|
|
11819
11632
|
}
|
|
11820
11633
|
} else {
|
|
11821
|
-
const shouldSeed = await
|
|
11634
|
+
const shouldSeed = await confirm8({
|
|
11822
11635
|
message: `Seed ${environment} database for ${game.slug}?`,
|
|
11823
11636
|
default: false
|
|
11824
11637
|
});
|
|
@@ -11852,7 +11665,7 @@ async function runDbSeedRemote(seedFile, options) {
|
|
|
11852
11665
|
}
|
|
11853
11666
|
async function runDbSeedLocal(seedFile, options) {
|
|
11854
11667
|
const workspace = getWorkspace();
|
|
11855
|
-
const dbDir =
|
|
11668
|
+
const dbDir = join30(workspace, CLI_DIRECTORIES.DATABASE);
|
|
11856
11669
|
const mf = new Miniflare3({
|
|
11857
11670
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
11858
11671
|
d1Databases: [CLOUDFLARE_BINDINGS.DB],
|
|
@@ -11872,8 +11685,8 @@ async function runDbSeedLocal(seedFile, options) {
|
|
|
11872
11685
|
async function runDbSeed(options = {}) {
|
|
11873
11686
|
const workspace = getWorkspace();
|
|
11874
11687
|
try {
|
|
11875
|
-
const seedFile = options.file ?
|
|
11876
|
-
if (!
|
|
11688
|
+
const seedFile = options.file ? join30(workspace, options.file) : join30(workspace, DEFAULT_DATABASE_DIRECTORY, DEFAULT_SEED_FILE_NAME);
|
|
11689
|
+
if (!existsSync23(seedFile)) {
|
|
11877
11690
|
logger.newLine();
|
|
11878
11691
|
logger.error(`Seed file not found: ${seedFile}`);
|
|
11879
11692
|
logger.newLine();
|
|
@@ -11927,8 +11740,8 @@ import { Command as Command18 } from "commander";
|
|
|
11927
11740
|
// src/commands/kv/clear.ts
|
|
11928
11741
|
init_string();
|
|
11929
11742
|
init_constants2();
|
|
11930
|
-
import { join as
|
|
11931
|
-
import { confirm as
|
|
11743
|
+
import { join as join31 } from "path";
|
|
11744
|
+
import { confirm as confirm9 } from "@inquirer/prompts";
|
|
11932
11745
|
import { Miniflare as Miniflare4 } from "miniflare";
|
|
11933
11746
|
async function runKVClear(options = {}) {
|
|
11934
11747
|
try {
|
|
@@ -11960,7 +11773,7 @@ async function runKVClear(options = {}) {
|
|
|
11960
11773
|
}
|
|
11961
11774
|
process.exit(1);
|
|
11962
11775
|
}
|
|
11963
|
-
const kvDir =
|
|
11776
|
+
const kvDir = join31(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
11964
11777
|
const mf = new Miniflare4({
|
|
11965
11778
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
11966
11779
|
kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
|
|
@@ -11990,7 +11803,7 @@ async function runKVClear(options = {}) {
|
|
|
11990
11803
|
if (!options.force && !options.raw && !options.json) {
|
|
11991
11804
|
logger.warn(`This will delete ${keyCount} ${pluralize(keyCount, "key")}`);
|
|
11992
11805
|
logger.newLine();
|
|
11993
|
-
const confirmed = await
|
|
11806
|
+
const confirmed = await confirm9({
|
|
11994
11807
|
message: "Are you sure you want to clear all keys?",
|
|
11995
11808
|
default: false
|
|
11996
11809
|
});
|
|
@@ -12032,7 +11845,7 @@ async function runKVClear(options = {}) {
|
|
|
12032
11845
|
|
|
12033
11846
|
// src/commands/kv/delete.ts
|
|
12034
11847
|
init_constants2();
|
|
12035
|
-
import { join as
|
|
11848
|
+
import { join as join32 } from "path";
|
|
12036
11849
|
import { Miniflare as Miniflare5 } from "miniflare";
|
|
12037
11850
|
async function runKVDelete(key, options = {}) {
|
|
12038
11851
|
try {
|
|
@@ -12073,7 +11886,7 @@ async function runKVDelete(key, options = {}) {
|
|
|
12073
11886
|
}
|
|
12074
11887
|
process.exit(1);
|
|
12075
11888
|
}
|
|
12076
|
-
const kvDir =
|
|
11889
|
+
const kvDir = join32(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
12077
11890
|
const mf = new Miniflare5({
|
|
12078
11891
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
12079
11892
|
kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
|
|
@@ -12110,7 +11923,7 @@ async function runKVDelete(key, options = {}) {
|
|
|
12110
11923
|
|
|
12111
11924
|
// src/commands/kv/get.ts
|
|
12112
11925
|
init_constants2();
|
|
12113
|
-
import { join as
|
|
11926
|
+
import { join as join33 } from "path";
|
|
12114
11927
|
import { Miniflare as Miniflare6 } from "miniflare";
|
|
12115
11928
|
async function runKVGet(key, options = {}) {
|
|
12116
11929
|
try {
|
|
@@ -12151,7 +11964,7 @@ async function runKVGet(key, options = {}) {
|
|
|
12151
11964
|
}
|
|
12152
11965
|
process.exit(1);
|
|
12153
11966
|
}
|
|
12154
|
-
const kvDir =
|
|
11967
|
+
const kvDir = join33(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
12155
11968
|
const mf = new Miniflare6({
|
|
12156
11969
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
12157
11970
|
kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
|
|
@@ -12285,7 +12098,7 @@ async function runKVInit() {
|
|
|
12285
12098
|
|
|
12286
12099
|
// src/commands/kv/inspect.ts
|
|
12287
12100
|
init_constants2();
|
|
12288
|
-
import { join as
|
|
12101
|
+
import { join as join34 } from "path";
|
|
12289
12102
|
import { Miniflare as Miniflare7 } from "miniflare";
|
|
12290
12103
|
async function runKVInspect(key, options = {}) {
|
|
12291
12104
|
try {
|
|
@@ -12326,7 +12139,7 @@ async function runKVInspect(key, options = {}) {
|
|
|
12326
12139
|
}
|
|
12327
12140
|
process.exit(1);
|
|
12328
12141
|
}
|
|
12329
|
-
const kvDir =
|
|
12142
|
+
const kvDir = join34(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
12330
12143
|
const mf = new Miniflare7({
|
|
12331
12144
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
12332
12145
|
kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
|
|
@@ -12414,7 +12227,7 @@ async function runKVInspect(key, options = {}) {
|
|
|
12414
12227
|
// src/commands/kv/list.ts
|
|
12415
12228
|
init_string();
|
|
12416
12229
|
init_constants2();
|
|
12417
|
-
import { join as
|
|
12230
|
+
import { join as join35 } from "path";
|
|
12418
12231
|
import { Miniflare as Miniflare8 } from "miniflare";
|
|
12419
12232
|
async function runKVList(options = {}) {
|
|
12420
12233
|
try {
|
|
@@ -12446,7 +12259,7 @@ async function runKVList(options = {}) {
|
|
|
12446
12259
|
}
|
|
12447
12260
|
process.exit(1);
|
|
12448
12261
|
}
|
|
12449
|
-
const kvDir =
|
|
12262
|
+
const kvDir = join35(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
12450
12263
|
const mf = new Miniflare8({
|
|
12451
12264
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
12452
12265
|
kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
|
|
@@ -12495,8 +12308,8 @@ async function runKVList(options = {}) {
|
|
|
12495
12308
|
init_file_loader();
|
|
12496
12309
|
init_string();
|
|
12497
12310
|
init_constants2();
|
|
12498
|
-
import { join as
|
|
12499
|
-
import { confirm as
|
|
12311
|
+
import { join as join36 } from "path";
|
|
12312
|
+
import { confirm as confirm10 } from "@inquirer/prompts";
|
|
12500
12313
|
import { Miniflare as Miniflare9 } from "miniflare";
|
|
12501
12314
|
async function runKVSeed(seedFile, options = {}) {
|
|
12502
12315
|
try {
|
|
@@ -12561,7 +12374,7 @@ async function runKVSeed(seedFile, options = {}) {
|
|
|
12561
12374
|
}
|
|
12562
12375
|
process.exit(1);
|
|
12563
12376
|
}
|
|
12564
|
-
const kvDir =
|
|
12377
|
+
const kvDir = join36(workspace, CLI_DIRECTORIES.KV);
|
|
12565
12378
|
const mf = new Miniflare9({
|
|
12566
12379
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
12567
12380
|
kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
|
|
@@ -12584,7 +12397,7 @@ async function runKVSeed(seedFile, options = {}) {
|
|
|
12584
12397
|
`${existingKeys.length} ${pluralize(existingKeys.length, "key")} will be overwritten`
|
|
12585
12398
|
);
|
|
12586
12399
|
logger.newLine();
|
|
12587
|
-
const confirmed = await
|
|
12400
|
+
const confirmed = await confirm10({
|
|
12588
12401
|
message: "Continue seeding?",
|
|
12589
12402
|
default: false
|
|
12590
12403
|
});
|
|
@@ -12642,7 +12455,7 @@ async function runKVSeed(seedFile, options = {}) {
|
|
|
12642
12455
|
// src/commands/kv/set.ts
|
|
12643
12456
|
init_file_loader();
|
|
12644
12457
|
init_constants2();
|
|
12645
|
-
import { join as
|
|
12458
|
+
import { join as join37 } from "path";
|
|
12646
12459
|
import { Miniflare as Miniflare10 } from "miniflare";
|
|
12647
12460
|
async function runKVSet(key, value, options = {}) {
|
|
12648
12461
|
try {
|
|
@@ -12712,7 +12525,7 @@ async function runKVSet(key, value, options = {}) {
|
|
|
12712
12525
|
}
|
|
12713
12526
|
process.exit(1);
|
|
12714
12527
|
}
|
|
12715
|
-
const kvDir =
|
|
12528
|
+
const kvDir = join37(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
12716
12529
|
const mf = new Miniflare10({
|
|
12717
12530
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
12718
12531
|
kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
|
|
@@ -12750,7 +12563,7 @@ async function runKVSet(key, value, options = {}) {
|
|
|
12750
12563
|
// src/commands/kv/stats.ts
|
|
12751
12564
|
init_string();
|
|
12752
12565
|
init_constants2();
|
|
12753
|
-
import { join as
|
|
12566
|
+
import { join as join38 } from "path";
|
|
12754
12567
|
import { Miniflare as Miniflare11 } from "miniflare";
|
|
12755
12568
|
async function runKVStats(options = {}) {
|
|
12756
12569
|
try {
|
|
@@ -12782,7 +12595,7 @@ async function runKVStats(options = {}) {
|
|
|
12782
12595
|
}
|
|
12783
12596
|
process.exit(1);
|
|
12784
12597
|
}
|
|
12785
|
-
const kvDir =
|
|
12598
|
+
const kvDir = join38(getWorkspace(), CLI_DIRECTORIES.KV);
|
|
12786
12599
|
const mf = new Miniflare11({
|
|
12787
12600
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
12788
12601
|
kvNamespaces: [CLOUDFLARE_BINDINGS.KV],
|
|
@@ -12899,8 +12712,8 @@ import { Command as Command19 } from "commander";
|
|
|
12899
12712
|
|
|
12900
12713
|
// src/commands/bucket/bulk.ts
|
|
12901
12714
|
init_constants2();
|
|
12902
|
-
import { existsSync as
|
|
12903
|
-
import { join as
|
|
12715
|
+
import { existsSync as existsSync24, statSync as statSync3 } from "fs";
|
|
12716
|
+
import { join as join39 } from "path";
|
|
12904
12717
|
import { Miniflare as Miniflare12 } from "miniflare";
|
|
12905
12718
|
async function runBucketBulkRemote(directory, options) {
|
|
12906
12719
|
const environment = ensureEnvironment(options.env);
|
|
@@ -12962,7 +12775,7 @@ async function runBucketBulkLocal(directory, options) {
|
|
|
12962
12775
|
outputDryRunResults(files, totalSize, options.prefix, options.json, options.raw);
|
|
12963
12776
|
return;
|
|
12964
12777
|
}
|
|
12965
|
-
const bucketDir =
|
|
12778
|
+
const bucketDir = join39(getWorkspace(), CLI_DIRECTORIES.BUCKET);
|
|
12966
12779
|
const mf = new Miniflare12({
|
|
12967
12780
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
12968
12781
|
r2Buckets: [CLOUDFLARE_BINDINGS.BUCKET],
|
|
@@ -12999,7 +12812,7 @@ async function runBucketBulk(directory, options = {}) {
|
|
|
12999
12812
|
if (!options.raw && !options.json) {
|
|
13000
12813
|
logger.newLine();
|
|
13001
12814
|
}
|
|
13002
|
-
if (!
|
|
12815
|
+
if (!existsSync24(directory)) {
|
|
13003
12816
|
if (!options.raw && !options.json) {
|
|
13004
12817
|
logger.error(`Directory not found: ${directory}`);
|
|
13005
12818
|
logger.newLine();
|
|
@@ -13032,7 +12845,7 @@ async function runBucketBulk(directory, options = {}) {
|
|
|
13032
12845
|
|
|
13033
12846
|
// src/commands/bucket/delete.ts
|
|
13034
12847
|
init_constants2();
|
|
13035
|
-
import { join as
|
|
12848
|
+
import { join as join40 } from "path";
|
|
13036
12849
|
import { Miniflare as Miniflare13 } from "miniflare";
|
|
13037
12850
|
async function runBucketDeleteRemote(key, options) {
|
|
13038
12851
|
const environment = ensureEnvironment(options.env);
|
|
@@ -13088,7 +12901,7 @@ async function runBucketDeleteLocal(key, options) {
|
|
|
13088
12901
|
}
|
|
13089
12902
|
process.exit(1);
|
|
13090
12903
|
}
|
|
13091
|
-
const bucketDir =
|
|
12904
|
+
const bucketDir = join40(getWorkspace(), CLI_DIRECTORIES.BUCKET);
|
|
13092
12905
|
const mf = new Miniflare13({
|
|
13093
12906
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
13094
12907
|
r2Buckets: [CLOUDFLARE_BINDINGS.BUCKET],
|
|
@@ -13152,7 +12965,7 @@ async function runBucketDelete(key, options = {}) {
|
|
|
13152
12965
|
// src/commands/bucket/get.ts
|
|
13153
12966
|
init_constants2();
|
|
13154
12967
|
import { writeFileSync as writeFileSync14 } from "fs";
|
|
13155
|
-
import { join as
|
|
12968
|
+
import { join as join41 } from "path";
|
|
13156
12969
|
import { Miniflare as Miniflare14 } from "miniflare";
|
|
13157
12970
|
async function runBucketGetRemote(key, options) {
|
|
13158
12971
|
const environment = ensureEnvironment(options.env);
|
|
@@ -13245,7 +13058,7 @@ async function runBucketGetLocal(key, options) {
|
|
|
13245
13058
|
}
|
|
13246
13059
|
process.exit(1);
|
|
13247
13060
|
}
|
|
13248
|
-
const bucketDir =
|
|
13061
|
+
const bucketDir = join41(getWorkspace(), CLI_DIRECTORIES.BUCKET);
|
|
13249
13062
|
const mf = new Miniflare14({
|
|
13250
13063
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
13251
13064
|
r2Buckets: [CLOUDFLARE_BINDINGS.BUCKET],
|
|
@@ -13405,7 +13218,7 @@ async function runBucketInit() {
|
|
|
13405
13218
|
|
|
13406
13219
|
// src/commands/bucket/list.ts
|
|
13407
13220
|
init_constants2();
|
|
13408
|
-
import { join as
|
|
13221
|
+
import { join as join42 } from "path";
|
|
13409
13222
|
import { Miniflare as Miniflare15 } from "miniflare";
|
|
13410
13223
|
async function runBucketListRemote(options) {
|
|
13411
13224
|
const environment = ensureEnvironment(options.env);
|
|
@@ -13472,7 +13285,7 @@ async function runBucketListLocal(options) {
|
|
|
13472
13285
|
}
|
|
13473
13286
|
process.exit(1);
|
|
13474
13287
|
}
|
|
13475
|
-
const bucketDir =
|
|
13288
|
+
const bucketDir = join42(getWorkspace(), CLI_DIRECTORIES.BUCKET);
|
|
13476
13289
|
const mf = new Miniflare15({
|
|
13477
13290
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
13478
13291
|
r2Buckets: [CLOUDFLARE_BINDINGS.BUCKET],
|
|
@@ -13557,8 +13370,8 @@ function formatBytes2(bytes) {
|
|
|
13557
13370
|
|
|
13558
13371
|
// src/commands/bucket/put.ts
|
|
13559
13372
|
init_constants2();
|
|
13560
|
-
import { readFileSync as
|
|
13561
|
-
import { join as
|
|
13373
|
+
import { readFileSync as readFileSync12, statSync as statSync4 } from "fs";
|
|
13374
|
+
import { join as join43 } from "path";
|
|
13562
13375
|
import { Miniflare as Miniflare16 } from "miniflare";
|
|
13563
13376
|
async function runBucketPutRemote(key, filePath, options) {
|
|
13564
13377
|
const environment = ensureEnvironment(options.env);
|
|
@@ -13577,7 +13390,7 @@ async function runBucketPutRemote(key, filePath, options) {
|
|
|
13577
13390
|
let fileBuffer;
|
|
13578
13391
|
let fileSize;
|
|
13579
13392
|
try {
|
|
13580
|
-
fileBuffer =
|
|
13393
|
+
fileBuffer = readFileSync12(filePath);
|
|
13581
13394
|
fileSize = statSync4(filePath).size;
|
|
13582
13395
|
} catch {
|
|
13583
13396
|
if (!options.raw && !options.json) {
|
|
@@ -13634,7 +13447,7 @@ async function runBucketPutLocal(key, filePath, options) {
|
|
|
13634
13447
|
let fileBuffer;
|
|
13635
13448
|
let fileSize;
|
|
13636
13449
|
try {
|
|
13637
|
-
fileBuffer =
|
|
13450
|
+
fileBuffer = readFileSync12(filePath);
|
|
13638
13451
|
fileSize = statSync4(filePath).size;
|
|
13639
13452
|
} catch {
|
|
13640
13453
|
if (!options.raw && !options.json) {
|
|
@@ -13643,7 +13456,7 @@ async function runBucketPutLocal(key, filePath, options) {
|
|
|
13643
13456
|
}
|
|
13644
13457
|
process.exit(1);
|
|
13645
13458
|
}
|
|
13646
|
-
const bucketDir =
|
|
13459
|
+
const bucketDir = join43(getWorkspace(), CLI_DIRECTORIES.BUCKET);
|
|
13647
13460
|
const mf = new Miniflare16({
|
|
13648
13461
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
13649
13462
|
r2Buckets: [CLOUDFLARE_BINDINGS.BUCKET],
|
|
@@ -13785,7 +13598,7 @@ async function runDomainAdd(hostname, options) {
|
|
|
13785
13598
|
}
|
|
13786
13599
|
|
|
13787
13600
|
// src/commands/domain/delete.ts
|
|
13788
|
-
import { confirm as
|
|
13601
|
+
import { confirm as confirm11 } from "@inquirer/prompts";
|
|
13789
13602
|
async function runDomainDelete(hostname, options) {
|
|
13790
13603
|
try {
|
|
13791
13604
|
logger.newLine();
|
|
@@ -13794,7 +13607,7 @@ async function runDomainDelete(hostname, options) {
|
|
|
13794
13607
|
const config = await loadConfig();
|
|
13795
13608
|
const slug = getSlugFromConfig(config);
|
|
13796
13609
|
if (!options.force) {
|
|
13797
|
-
const shouldDelete = await
|
|
13610
|
+
const shouldDelete = await confirm11({
|
|
13798
13611
|
message: `Delete custom domain ${hostname}?`,
|
|
13799
13612
|
default: false
|
|
13800
13613
|
});
|
|
@@ -13938,7 +13751,7 @@ import { Command as Command24 } from "commander";
|
|
|
13938
13751
|
|
|
13939
13752
|
// src/commands/secret/delete.ts
|
|
13940
13753
|
init_src();
|
|
13941
|
-
import { confirm as
|
|
13754
|
+
import { confirm as confirm12 } from "@inquirer/prompts";
|
|
13942
13755
|
import { Command as Command21 } from "commander";
|
|
13943
13756
|
var deleteCommand2 = new Command21("delete").description("Delete a game secret").argument("<key>", "Secret key to delete").option("--env <environment>", "Environment (staging or production)").option("-f, --force", "Skip confirmation").action(async (key, options) => {
|
|
13944
13757
|
const { env } = options;
|
|
@@ -13958,7 +13771,7 @@ var deleteCommand2 = new Command21("delete").description("Delete a game secret")
|
|
|
13958
13771
|
}
|
|
13959
13772
|
const game = await client.games.fetch(deployedGame.gameId);
|
|
13960
13773
|
if (!options.force) {
|
|
13961
|
-
const confirmed = await
|
|
13774
|
+
const confirmed = await confirm12({
|
|
13962
13775
|
message: `Delete secret "${key}" from "${game.slug}" in ${environment}?`,
|
|
13963
13776
|
default: false
|
|
13964
13777
|
});
|
|
@@ -14152,7 +13965,7 @@ var removeCommand = new Command27("remove").alias("rm").description('Remove an a
|
|
|
14152
13965
|
|
|
14153
13966
|
// src/commands/profiles/reset.ts
|
|
14154
13967
|
init_string();
|
|
14155
|
-
import { confirm as
|
|
13968
|
+
import { confirm as confirm13 } from "@inquirer/prompts";
|
|
14156
13969
|
import { Command as Command28 } from "commander";
|
|
14157
13970
|
var resetCommand = new Command28("reset").description(
|
|
14158
13971
|
"Remove all authentication profiles across all environments (requires confirmation)"
|
|
@@ -14190,7 +14003,7 @@ var resetCommand = new Command28("reset").description(
|
|
|
14190
14003
|
logger.newLine();
|
|
14191
14004
|
}
|
|
14192
14005
|
}
|
|
14193
|
-
const confirmed = await
|
|
14006
|
+
const confirmed = await confirm13({
|
|
14194
14007
|
message: "Are you sure you want to remove all profiles?",
|
|
14195
14008
|
default: false
|
|
14196
14009
|
});
|
|
@@ -14240,7 +14053,7 @@ import { Command as Command35 } from "commander";
|
|
|
14240
14053
|
|
|
14241
14054
|
// src/commands/timeback/cleanup.ts
|
|
14242
14055
|
init_src();
|
|
14243
|
-
import { confirm as
|
|
14056
|
+
import { confirm as confirm14 } from "@inquirer/prompts";
|
|
14244
14057
|
import { Command as Command30 } from "commander";
|
|
14245
14058
|
var cleanupCommand = new Command30("cleanup").description("Remove TimeBack integration for your game").option(
|
|
14246
14059
|
"--env <environment>",
|
|
@@ -14264,7 +14077,7 @@ var cleanupCommand = new Command30("cleanup").description("Remove TimeBack integ
|
|
|
14264
14077
|
return;
|
|
14265
14078
|
}
|
|
14266
14079
|
displayCleanupWarning(integration, game.displayName, logger);
|
|
14267
|
-
const confirmed = await
|
|
14080
|
+
const confirmed = await confirm14({
|
|
14268
14081
|
message: "Are you sure you want to remove TimeBack integration?",
|
|
14269
14082
|
default: false
|
|
14270
14083
|
});
|
|
@@ -14435,7 +14248,7 @@ var setupCommand = new Command32("setup").description("Set up TimeBack integrati
|
|
|
14435
14248
|
// src/commands/timeback/update.ts
|
|
14436
14249
|
init_src();
|
|
14437
14250
|
init_string();
|
|
14438
|
-
import { confirm as
|
|
14251
|
+
import { confirm as confirm15 } from "@inquirer/prompts";
|
|
14439
14252
|
import { green as green4, red as red4 } from "colorette";
|
|
14440
14253
|
import { Command as Command33 } from "commander";
|
|
14441
14254
|
var updateCommand = new Command33("update").description("Update TimeBack integration configuration for your game").option("--verbose, -v", "Output detailed information").option(
|
|
@@ -14516,7 +14329,7 @@ var updateCommand = new Command33("update").description("Update TimeBack integra
|
|
|
14516
14329
|
logger.data(change.label, `${red4(change.current)} \u2192 ${green4(change.next)}`, 1);
|
|
14517
14330
|
}
|
|
14518
14331
|
logger.newLine();
|
|
14519
|
-
const confirmed = await
|
|
14332
|
+
const confirmed = await confirm15({
|
|
14520
14333
|
message: `Update ${changeDetails.length} ${pluralize(changeDetails.length, "field")} in TimeBack?`,
|
|
14521
14334
|
default: false
|
|
14522
14335
|
});
|
|
@@ -14623,7 +14436,7 @@ import { Command as Command37 } from "commander";
|
|
|
14623
14436
|
init_src();
|
|
14624
14437
|
init_constants2();
|
|
14625
14438
|
import { writeFileSync as writeFileSync15 } from "fs";
|
|
14626
|
-
import { join as
|
|
14439
|
+
import { join as join44 } from "path";
|
|
14627
14440
|
import { Command as Command36 } from "commander";
|
|
14628
14441
|
var bundleCommand = new Command36("bundle").description("Bundle and inspect the game backend worker code (for debugging)").option("-o, --output <path>", "Output file path", CLI_DEFAULT_OUTPUTS.WORKER_BUNDLE).option("--minify", "Minify the output").option("--sourcemap", "Include source maps").action(async (options) => {
|
|
14629
14442
|
try {
|
|
@@ -14653,7 +14466,7 @@ var bundleCommand = new Command36("bundle").description("Bundle and inspect the
|
|
|
14653
14466
|
}),
|
|
14654
14467
|
(result) => `Bundled ${formatSize(result.code.length)}`
|
|
14655
14468
|
);
|
|
14656
|
-
const outputPath =
|
|
14469
|
+
const outputPath = join44(workspace, options.output);
|
|
14657
14470
|
writeFileSync15(outputPath, bundle.code, "utf-8");
|
|
14658
14471
|
logger.success(`Bundle saved to ${options.output}`);
|
|
14659
14472
|
logger.newLine();
|
|
@@ -14702,7 +14515,7 @@ import { Command as Command38 } from "commander";
|
|
|
14702
14515
|
// src/commands/vite/init.ts
|
|
14703
14516
|
init_package_manager();
|
|
14704
14517
|
import path3 from "node:path";
|
|
14705
|
-
import { confirm as
|
|
14518
|
+
import { confirm as confirm16 } from "@inquirer/prompts";
|
|
14706
14519
|
import { dim as dim9, underline as underline7 } from "colorette";
|
|
14707
14520
|
async function runViteInit() {
|
|
14708
14521
|
try {
|
|
@@ -14712,7 +14525,7 @@ async function runViteInit() {
|
|
|
14712
14525
|
if (!existingViteConfig) {
|
|
14713
14526
|
logger.warn("No vite config file found in your project");
|
|
14714
14527
|
logger.newLine();
|
|
14715
|
-
const shouldCreate = await
|
|
14528
|
+
const shouldCreate = await confirm16({
|
|
14716
14529
|
message: "Would you like to create a new vite.config.ts?",
|
|
14717
14530
|
default: true
|
|
14718
14531
|
});
|
|
@@ -14874,7 +14687,6 @@ export {
|
|
|
14874
14687
|
getWebBaseUrl,
|
|
14875
14688
|
getWorkspace,
|
|
14876
14689
|
handleDomainNotFound,
|
|
14877
|
-
handleGodotBuildPrompt,
|
|
14878
14690
|
handleIntegrationConfigChanges,
|
|
14879
14691
|
hasAuthSetup,
|
|
14880
14692
|
hasBackendChanged,
|
|
@@ -14887,7 +14699,6 @@ export {
|
|
|
14887
14699
|
hasOptionalFieldsMissing,
|
|
14888
14700
|
hasPackageJson,
|
|
14889
14701
|
hasSchemaChanged,
|
|
14890
|
-
hasWebExportPreset,
|
|
14891
14702
|
hashContent,
|
|
14892
14703
|
hashDirectory,
|
|
14893
14704
|
hashFile,
|
|
@@ -14896,7 +14707,6 @@ export {
|
|
|
14896
14707
|
importTypescriptFile,
|
|
14897
14708
|
installVitePlugin,
|
|
14898
14709
|
integrationChangeDetectors,
|
|
14899
|
-
isGodotProject,
|
|
14900
14710
|
isIgnoredByGitignore,
|
|
14901
14711
|
isNotFoundError,
|
|
14902
14712
|
isPluginConfigured,
|