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