playcademy 0.28.1-beta.21 → 0.28.1-beta.23
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/bucket.js +23 -26
- package/dist/cli.js +76 -79
- package/dist/constants.d.ts +14 -3
- package/dist/constants.js +21 -22
- package/dist/db.js +53 -56
- package/dist/index.js +242 -223
- package/dist/runtime/dashboard-runtime/manifest.json +4 -4
- package/dist/runtime/game-runtime/index.js +3 -3
- package/dist/runtime/game-runtime/manifest.json +4 -4
- package/dist/utils.js +139 -123
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/dist/bucket.js
CHANGED
|
@@ -21,7 +21,7 @@ var init_file_loader = __esm({
|
|
|
21
21
|
|
|
22
22
|
// src/lib/bucket/dev.ts
|
|
23
23
|
import { existsSync } from "fs";
|
|
24
|
-
import { join as
|
|
24
|
+
import { join as join7 } from "path";
|
|
25
25
|
|
|
26
26
|
// ../edge-play/src/lib/constants.ts
|
|
27
27
|
var ASSET_PREFIX = "_assets/";
|
|
@@ -29,10 +29,7 @@ var MANIFEST_KEY = "_manifest.json";
|
|
|
29
29
|
var ASSET_ROUTE_PREFIX = "/api/assets/";
|
|
30
30
|
|
|
31
31
|
// src/lib/bundle/game-backend.ts
|
|
32
|
-
import { join as
|
|
33
|
-
|
|
34
|
-
// src/constants/api.ts
|
|
35
|
-
import { join as join2 } from "node:path";
|
|
32
|
+
import { join as join5 } from "node:path";
|
|
36
33
|
|
|
37
34
|
// src/constants/server.ts
|
|
38
35
|
import { join } from "node:path";
|
|
@@ -40,12 +37,12 @@ var GAME_SERVER_ROOT_DIRECTORY = "server";
|
|
|
40
37
|
var GAME_SERVER_LIB_DIRECTORY = join(GAME_SERVER_ROOT_DIRECTORY, "lib");
|
|
41
38
|
|
|
42
39
|
// src/constants/api.ts
|
|
43
|
-
var GAME_API_ROUTES_DIRECTORY =
|
|
40
|
+
var GAME_API_ROUTES_DIRECTORY = `${GAME_SERVER_ROOT_DIRECTORY}/api`;
|
|
44
41
|
|
|
45
42
|
// ../better-auth/package.json
|
|
46
43
|
var package_default = {
|
|
47
44
|
name: "@playcademy/better-auth",
|
|
48
|
-
version: "0.0.
|
|
45
|
+
version: "0.0.20",
|
|
49
46
|
type: "module",
|
|
50
47
|
exports: {
|
|
51
48
|
"./server": {
|
|
@@ -102,43 +99,43 @@ var CLOUDFLARE_BINDINGS = {
|
|
|
102
99
|
};
|
|
103
100
|
|
|
104
101
|
// src/constants/database.ts
|
|
105
|
-
import { join as
|
|
106
|
-
var DEFAULT_DATABASE_DIRECTORY =
|
|
102
|
+
import { join as join2 } from "path";
|
|
103
|
+
var DEFAULT_DATABASE_DIRECTORY = join2("server", "db");
|
|
107
104
|
|
|
108
105
|
// src/constants/godot.ts
|
|
109
|
-
import { join as
|
|
106
|
+
import { join as join3 } from "node:path";
|
|
110
107
|
var GODOT_BUILD_DIRECTORIES = {
|
|
111
108
|
/** Root build directory (cleared before each export) */
|
|
112
109
|
ROOT: "build",
|
|
113
110
|
/** Web export subdirectory */
|
|
114
|
-
WEB:
|
|
111
|
+
WEB: join3("build", "web")
|
|
115
112
|
};
|
|
116
113
|
var GODOT_BUILD_OUTPUTS = {
|
|
117
114
|
/** Exported web build entry point */
|
|
118
|
-
INDEX_HTML:
|
|
115
|
+
INDEX_HTML: join3("build", "web", "index.html"),
|
|
119
116
|
/** Packaged zip file (created by Godot export) */
|
|
120
|
-
ZIP:
|
|
117
|
+
ZIP: join3("build", "web_playcademy.zip")
|
|
121
118
|
};
|
|
122
119
|
|
|
123
120
|
// src/constants/paths.ts
|
|
124
121
|
import { homedir } from "node:os";
|
|
125
|
-
import { join as
|
|
122
|
+
import { join as join4 } from "node:path";
|
|
126
123
|
var WORKSPACE_NAME = ".playcademy";
|
|
127
124
|
var CLI_DIRECTORIES = {
|
|
128
125
|
WORKSPACE: WORKSPACE_NAME,
|
|
129
|
-
DATABASE:
|
|
130
|
-
KV:
|
|
131
|
-
BUCKET:
|
|
132
|
-
TIMEBACK:
|
|
126
|
+
DATABASE: join4(WORKSPACE_NAME, "db"),
|
|
127
|
+
KV: join4(WORKSPACE_NAME, "kv"),
|
|
128
|
+
BUCKET: join4(WORKSPACE_NAME, "bucket"),
|
|
129
|
+
TIMEBACK: join4(WORKSPACE_NAME, "timeback")
|
|
133
130
|
};
|
|
134
|
-
var PLAYCADEMY_HOME =
|
|
131
|
+
var PLAYCADEMY_HOME = join4(homedir(), ".playcademy");
|
|
135
132
|
var CLI_USER_DIRECTORIES = {
|
|
136
133
|
CONFIG: PLAYCADEMY_HOME,
|
|
137
|
-
BIN:
|
|
138
|
-
CACHE:
|
|
134
|
+
BIN: join4(PLAYCADEMY_HOME, "bin"),
|
|
135
|
+
CACHE: join4(PLAYCADEMY_HOME, "cache")
|
|
139
136
|
};
|
|
140
137
|
var CLI_DEFAULT_OUTPUTS = {
|
|
141
|
-
WORKER_BUNDLE:
|
|
138
|
+
WORKER_BUNDLE: join4(WORKSPACE_NAME, "worker-bundle.js")
|
|
142
139
|
};
|
|
143
140
|
|
|
144
141
|
// ../constants/src/timeback.ts
|
|
@@ -334,14 +331,14 @@ function resolveGameRoutesDir(config) {
|
|
|
334
331
|
return typeof customRoutes === "object" && customRoutes.directory || GAME_API_ROUTES_DIRECTORY;
|
|
335
332
|
}
|
|
336
333
|
function getGameRoutesDirectory(projectPath, config) {
|
|
337
|
-
return
|
|
334
|
+
return join5(projectPath, resolveGameRoutesDir(config));
|
|
338
335
|
}
|
|
339
336
|
|
|
340
337
|
// src/lib/bucket/local.ts
|
|
341
|
-
import { join as
|
|
338
|
+
import { join as join6 } from "path";
|
|
342
339
|
import { Miniflare } from "miniflare";
|
|
343
340
|
async function openLocalBucket() {
|
|
344
|
-
const bucketDir =
|
|
341
|
+
const bucketDir = join6(getWorkspace(), CLI_DIRECTORIES.BUCKET);
|
|
345
342
|
const mf = new Miniflare({
|
|
346
343
|
modules: [{ type: "ESModule", path: "index.mjs", contents: "" }],
|
|
347
344
|
r2Buckets: [CLOUDFLARE_BINDINGS.BUCKET],
|
|
@@ -358,7 +355,7 @@ async function openLocalBucket() {
|
|
|
358
355
|
var ASSET_DEV_ROUTE_PREFIX = ASSET_ROUTE_PREFIX;
|
|
359
356
|
function hasCustomAssetsRoute(projectRoot, config) {
|
|
360
357
|
const routesDir = getGameRoutesDirectory(projectRoot, config);
|
|
361
|
-
return existsSync(
|
|
358
|
+
return existsSync(join7(routesDir, "assets")) || existsSync(join7(routesDir, "assets.ts"));
|
|
362
359
|
}
|
|
363
360
|
function openLocalAssetBucket() {
|
|
364
361
|
return openLocalBucket();
|
package/dist/cli.js
CHANGED
|
@@ -1190,9 +1190,6 @@ function generateSlug(text) {
|
|
|
1190
1190
|
// src/lib/init/run.ts
|
|
1191
1191
|
init_file_loader();
|
|
1192
1192
|
|
|
1193
|
-
// src/constants/api.ts
|
|
1194
|
-
import { join as join3 } from "node:path";
|
|
1195
|
-
|
|
1196
1193
|
// src/constants/server.ts
|
|
1197
1194
|
import { join as join2 } from "node:path";
|
|
1198
1195
|
var GAME_SERVER_ROOT_DIRECTORY = "server";
|
|
@@ -1200,7 +1197,7 @@ var GAME_SERVER_LIB_DIRECTORY = join2(GAME_SERVER_ROOT_DIRECTORY, "lib");
|
|
|
1200
1197
|
var GAME_HOOKS_FILE = "hooks";
|
|
1201
1198
|
|
|
1202
1199
|
// src/constants/api.ts
|
|
1203
|
-
var GAME_API_ROUTES_DIRECTORY =
|
|
1200
|
+
var GAME_API_ROUTES_DIRECTORY = `${GAME_SERVER_ROOT_DIRECTORY}/api`;
|
|
1204
1201
|
var AUTH_API_SUBDIRECTORY = "auth";
|
|
1205
1202
|
var SAMPLE_API_SUBDIRECTORY = "sample";
|
|
1206
1203
|
var SAMPLE_CUSTOM_FILENAME = "custom.ts";
|
|
@@ -1211,7 +1208,7 @@ var SAMPLE_BUCKET_FILENAME = "bucket.ts";
|
|
|
1211
1208
|
// ../better-auth/package.json
|
|
1212
1209
|
var package_default = {
|
|
1213
1210
|
name: "@playcademy/better-auth",
|
|
1214
|
-
version: "0.0.
|
|
1211
|
+
version: "0.0.20",
|
|
1215
1212
|
type: "module",
|
|
1216
1213
|
exports: {
|
|
1217
1214
|
"./server": {
|
|
@@ -1288,8 +1285,8 @@ var TSCONFIG_REQUIRED_INCLUDES = [
|
|
|
1288
1285
|
];
|
|
1289
1286
|
|
|
1290
1287
|
// src/constants/database.ts
|
|
1291
|
-
import { join as
|
|
1292
|
-
var DEFAULT_DATABASE_DIRECTORY =
|
|
1288
|
+
import { join as join3 } from "path";
|
|
1289
|
+
var DEFAULT_DATABASE_DIRECTORY = join3("server", "db");
|
|
1293
1290
|
var SCHEMA_SUBDIRECTORY = "schema";
|
|
1294
1291
|
var DB_FILES = {
|
|
1295
1292
|
/** Index file name */
|
|
@@ -1319,40 +1316,40 @@ var TEMPLATE_RENAME_FILES = {
|
|
|
1319
1316
|
};
|
|
1320
1317
|
|
|
1321
1318
|
// src/constants/godot.ts
|
|
1322
|
-
import { join as
|
|
1319
|
+
import { join as join4 } from "node:path";
|
|
1323
1320
|
var GODOT_PROJECT_FILE = "project.godot";
|
|
1324
1321
|
var GODOT_BUILD_DIRECTORIES = {
|
|
1325
1322
|
/** Root build directory (cleared before each export) */
|
|
1326
1323
|
ROOT: "build",
|
|
1327
1324
|
/** Web export subdirectory */
|
|
1328
|
-
WEB:
|
|
1325
|
+
WEB: join4("build", "web")
|
|
1329
1326
|
};
|
|
1330
1327
|
var GODOT_BUILD_OUTPUTS = {
|
|
1331
1328
|
/** Exported web build entry point */
|
|
1332
|
-
INDEX_HTML:
|
|
1329
|
+
INDEX_HTML: join4("build", "web", "index.html"),
|
|
1333
1330
|
/** Packaged zip file (created by Godot export) */
|
|
1334
|
-
ZIP:
|
|
1331
|
+
ZIP: join4("build", "web_playcademy.zip")
|
|
1335
1332
|
};
|
|
1336
1333
|
|
|
1337
1334
|
// src/constants/paths.ts
|
|
1338
1335
|
import { homedir } from "node:os";
|
|
1339
|
-
import { join as
|
|
1336
|
+
import { join as join5 } from "node:path";
|
|
1340
1337
|
var WORKSPACE_NAME = ".playcademy";
|
|
1341
1338
|
var CLI_DIRECTORIES = {
|
|
1342
1339
|
WORKSPACE: WORKSPACE_NAME,
|
|
1343
|
-
DATABASE:
|
|
1344
|
-
KV:
|
|
1345
|
-
BUCKET:
|
|
1346
|
-
TIMEBACK:
|
|
1340
|
+
DATABASE: join5(WORKSPACE_NAME, "db"),
|
|
1341
|
+
KV: join5(WORKSPACE_NAME, "kv"),
|
|
1342
|
+
BUCKET: join5(WORKSPACE_NAME, "bucket"),
|
|
1343
|
+
TIMEBACK: join5(WORKSPACE_NAME, "timeback")
|
|
1347
1344
|
};
|
|
1348
|
-
var PLAYCADEMY_HOME =
|
|
1345
|
+
var PLAYCADEMY_HOME = join5(homedir(), ".playcademy");
|
|
1349
1346
|
var CLI_USER_DIRECTORIES = {
|
|
1350
1347
|
CONFIG: PLAYCADEMY_HOME,
|
|
1351
|
-
BIN:
|
|
1352
|
-
CACHE:
|
|
1348
|
+
BIN: join5(PLAYCADEMY_HOME, "bin"),
|
|
1349
|
+
CACHE: join5(PLAYCADEMY_HOME, "cache")
|
|
1353
1350
|
};
|
|
1354
1351
|
var CLI_DEFAULT_OUTPUTS = {
|
|
1355
|
-
WORKER_BUNDLE:
|
|
1352
|
+
WORKER_BUNDLE: join5(WORKSPACE_NAME, "worker-bundle.js")
|
|
1356
1353
|
};
|
|
1357
1354
|
|
|
1358
1355
|
// src/constants/prompts.ts
|
|
@@ -1532,7 +1529,7 @@ import * as esbuild2 from "esbuild";
|
|
|
1532
1529
|
// src/lib/secrets/env.ts
|
|
1533
1530
|
init_file_loader();
|
|
1534
1531
|
import { existsSync as existsSync4, writeFileSync } from "fs";
|
|
1535
|
-
import { join as
|
|
1532
|
+
import { join as join6 } from "path";
|
|
1536
1533
|
function parseEnvFile(contents) {
|
|
1537
1534
|
const secrets = {};
|
|
1538
1535
|
for (const line of contents.split("\n")) {
|
|
@@ -1565,13 +1562,13 @@ async function readEnvFile(workspace) {
|
|
|
1565
1562
|
return secrets;
|
|
1566
1563
|
}
|
|
1567
1564
|
function getLoadedEnvFiles(workspace) {
|
|
1568
|
-
return ENV_FILES.filter((filename) => existsSync4(
|
|
1565
|
+
return ENV_FILES.filter((filename) => existsSync4(join6(workspace, filename)));
|
|
1569
1566
|
}
|
|
1570
1567
|
function hasEnvFile(workspace) {
|
|
1571
|
-
return ENV_FILES.some((filename) => existsSync4(
|
|
1568
|
+
return ENV_FILES.some((filename) => existsSync4(join6(workspace, filename)));
|
|
1572
1569
|
}
|
|
1573
1570
|
async function updateEnvExample(workspace, lines) {
|
|
1574
|
-
const envExamplePath =
|
|
1571
|
+
const envExamplePath = join6(workspace, ENV_EXAMPLE_FILE);
|
|
1575
1572
|
let existing = "";
|
|
1576
1573
|
if (existsSync4(envExamplePath)) {
|
|
1577
1574
|
const loaded = await loadFile(envExamplePath);
|
|
@@ -2383,19 +2380,19 @@ function displaySuccessMessage(context2) {
|
|
|
2383
2380
|
|
|
2384
2381
|
// src/lib/init/engine/fetch.ts
|
|
2385
2382
|
import { readdirSync as readdirSync2, renameSync } from "fs";
|
|
2386
|
-
import { join as
|
|
2383
|
+
import { join as join7 } from "path";
|
|
2387
2384
|
import { downloadTemplate } from "giget";
|
|
2388
2385
|
function renameSpecialFiles(destDir) {
|
|
2389
2386
|
const files = readdirSync2(destDir, { withFileTypes: true });
|
|
2390
2387
|
for (const file of files) {
|
|
2391
2388
|
const newName = TEMPLATE_RENAME_FILES[file.name];
|
|
2392
2389
|
if (newName) {
|
|
2393
|
-
const oldPath =
|
|
2394
|
-
const newPath =
|
|
2390
|
+
const oldPath = join7(destDir, file.name);
|
|
2391
|
+
const newPath = join7(destDir, newName);
|
|
2395
2392
|
renameSync(oldPath, newPath);
|
|
2396
2393
|
}
|
|
2397
2394
|
if (file.isDirectory()) {
|
|
2398
|
-
renameSpecialFiles(
|
|
2395
|
+
renameSpecialFiles(join7(destDir, file.name));
|
|
2399
2396
|
}
|
|
2400
2397
|
}
|
|
2401
2398
|
}
|
|
@@ -2429,11 +2426,11 @@ import { blue as blue2, cyan as cyan2, green as green2, magenta, red as red2, ye
|
|
|
2429
2426
|
// src/lib/godot/addon.ts
|
|
2430
2427
|
import { existsSync as existsSync6, mkdirSync, mkdtempSync, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
2431
2428
|
import { rm } from "fs/promises";
|
|
2432
|
-
import { dirname as dirname4, join as
|
|
2429
|
+
import { dirname as dirname4, join as join8, resolve as resolve5, sep } from "path";
|
|
2433
2430
|
import JSZip from "jszip";
|
|
2434
2431
|
async function downloadAndExtractAddon(projectDir, options) {
|
|
2435
|
-
const addonsDir =
|
|
2436
|
-
const targetDir =
|
|
2432
|
+
const addonsDir = join8(projectDir, "addons");
|
|
2433
|
+
const targetDir = join8(addonsDir, "playcademy");
|
|
2437
2434
|
let zipData;
|
|
2438
2435
|
await runStep(
|
|
2439
2436
|
"Downloading Playcademy addon",
|
|
@@ -2456,9 +2453,9 @@ async function downloadAndExtractAddon(projectDir, options) {
|
|
|
2456
2453
|
if (!existsSync6(addonsDir)) {
|
|
2457
2454
|
mkdirSync(addonsDir, { recursive: true });
|
|
2458
2455
|
}
|
|
2459
|
-
const tempDir = mkdtempSync(
|
|
2456
|
+
const tempDir = mkdtempSync(join8(addonsDir, ".playcademy-sync-"));
|
|
2460
2457
|
const tempBase = resolve5(tempDir) + sep;
|
|
2461
|
-
const backupDir =
|
|
2458
|
+
const backupDir = join8(addonsDir, `.playcademy-backup-${Date.now()}`);
|
|
2462
2459
|
try {
|
|
2463
2460
|
const extractPromises = [];
|
|
2464
2461
|
zip.forEach((relativePath, file) => {
|
|
@@ -2480,7 +2477,7 @@ async function downloadAndExtractAddon(projectDir, options) {
|
|
|
2480
2477
|
);
|
|
2481
2478
|
});
|
|
2482
2479
|
await Promise.all(extractPromises);
|
|
2483
|
-
const extractedRoot =
|
|
2480
|
+
const extractedRoot = join8(tempDir, "playcademy", "addons", "playcademy");
|
|
2484
2481
|
if (!existsSync6(extractedRoot)) {
|
|
2485
2482
|
throw new Error(
|
|
2486
2483
|
"Unexpected addon zip layout: expected playcademy/addons/playcademy"
|
|
@@ -2644,9 +2641,9 @@ async function promptForTemplate(framework) {
|
|
|
2644
2641
|
|
|
2645
2642
|
// src/lib/deploy/game/godot.ts
|
|
2646
2643
|
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync2, rmSync } from "fs";
|
|
2647
|
-
import { join as
|
|
2644
|
+
import { join as join9 } from "path";
|
|
2648
2645
|
function isGodotProject() {
|
|
2649
|
-
return existsSync7(
|
|
2646
|
+
return existsSync7(join9(getWorkspace(), GODOT_PROJECT_FILE));
|
|
2650
2647
|
}
|
|
2651
2648
|
|
|
2652
2649
|
// src/lib/init/vite.ts
|
|
@@ -2781,10 +2778,10 @@ async function applyEngineSelection(selection, destDir, options = {}) {
|
|
|
2781
2778
|
|
|
2782
2779
|
// src/lib/init/gitignore.ts
|
|
2783
2780
|
import { existsSync as existsSync8, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "fs";
|
|
2784
|
-
import { join as
|
|
2781
|
+
import { join as join10 } from "path";
|
|
2785
2782
|
var rootGitignoreTemplate = loadTemplateString("gitignore");
|
|
2786
2783
|
function ensureRootGitignore(workspace = getWorkspace()) {
|
|
2787
|
-
const gitignorePath =
|
|
2784
|
+
const gitignorePath = join10(workspace, ".gitignore");
|
|
2788
2785
|
if (!existsSync8(gitignorePath)) {
|
|
2789
2786
|
writeFileSync4(gitignorePath, rootGitignoreTemplate);
|
|
2790
2787
|
return;
|
|
@@ -2889,11 +2886,11 @@ import { bold as bold4, cyan as cyan4 } from "colorette";
|
|
|
2889
2886
|
|
|
2890
2887
|
// src/lib/init/scaffold.ts
|
|
2891
2888
|
import { existsSync as existsSync12, mkdirSync as mkdirSync6, readFileSync as readFileSync7, writeFileSync as writeFileSync7 } from "fs";
|
|
2892
|
-
import { join as
|
|
2889
|
+
import { join as join13, resolve as resolve7 } from "path";
|
|
2893
2890
|
|
|
2894
2891
|
// src/lib/init/auth.ts
|
|
2895
2892
|
import { existsSync as existsSync10, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync5 } from "fs";
|
|
2896
|
-
import { join as
|
|
2893
|
+
import { join as join11 } from "path";
|
|
2897
2894
|
var authTemplate = loadTemplateString("auth/auth.ts");
|
|
2898
2895
|
var authCatchAllTemplate = loadTemplateString("auth/auth-catch-all.ts");
|
|
2899
2896
|
var authSchemaTemplate = loadTemplateString("auth/auth-schema.ts");
|
|
@@ -2935,28 +2932,28 @@ ${socialProviders.join(",\n")}
|
|
|
2935
2932
|
return authContent;
|
|
2936
2933
|
}
|
|
2937
2934
|
function scaffoldAuthConfig(workspace, authContent) {
|
|
2938
|
-
const libDir =
|
|
2935
|
+
const libDir = join11(workspace, GAME_SERVER_LIB_DIRECTORY);
|
|
2939
2936
|
if (!existsSync10(libDir)) {
|
|
2940
2937
|
mkdirSync4(libDir, { recursive: true });
|
|
2941
2938
|
}
|
|
2942
|
-
writeFileSync5(
|
|
2939
|
+
writeFileSync5(join11(libDir, AUTH_CONFIG_FILE), authContent);
|
|
2943
2940
|
}
|
|
2944
2941
|
function scaffoldAuthRoutes(workspace) {
|
|
2945
|
-
const apiDir =
|
|
2946
|
-
const authApiDir =
|
|
2942
|
+
const apiDir = join11(workspace, GAME_API_ROUTES_DIRECTORY);
|
|
2943
|
+
const authApiDir = join11(apiDir, AUTH_API_SUBDIRECTORY);
|
|
2947
2944
|
if (!existsSync10(authApiDir)) {
|
|
2948
2945
|
mkdirSync4(authApiDir, { recursive: true });
|
|
2949
2946
|
}
|
|
2950
|
-
writeFileSync5(
|
|
2947
|
+
writeFileSync5(join11(authApiDir, "[...all].ts"), authCatchAllTemplate);
|
|
2951
2948
|
}
|
|
2952
2949
|
function scaffoldAuthSchema(workspace) {
|
|
2953
|
-
const dbDir =
|
|
2954
|
-
const schemaDir =
|
|
2950
|
+
const dbDir = join11(workspace, DEFAULT_DATABASE_DIRECTORY);
|
|
2951
|
+
const schemaDir = join11(dbDir, SCHEMA_SUBDIRECTORY);
|
|
2955
2952
|
if (!existsSync10(schemaDir)) {
|
|
2956
2953
|
mkdirSync4(schemaDir, { recursive: true });
|
|
2957
2954
|
}
|
|
2958
|
-
writeFileSync5(
|
|
2959
|
-
const schemaIndexPath =
|
|
2955
|
+
writeFileSync5(join11(schemaDir, "auth.ts"), authSchemaTemplate);
|
|
2956
|
+
const schemaIndexPath = join11(schemaDir, DB_FILES.SCHEMA_INDEX);
|
|
2960
2957
|
if (existsSync10(schemaIndexPath)) {
|
|
2961
2958
|
const existing = readFileSync5(schemaIndexPath, "utf8");
|
|
2962
2959
|
if (!existing.includes("export * from './auth'")) {
|
|
@@ -2969,12 +2966,12 @@ export * from './auth'
|
|
|
2969
2966
|
}
|
|
2970
2967
|
}
|
|
2971
2968
|
function scaffoldProtectedExample(workspace) {
|
|
2972
|
-
const apiDir =
|
|
2973
|
-
const sampleDir =
|
|
2969
|
+
const apiDir = join11(workspace, GAME_API_ROUTES_DIRECTORY);
|
|
2970
|
+
const sampleDir = join11(apiDir, SAMPLE_API_SUBDIRECTORY);
|
|
2974
2971
|
if (!existsSync10(sampleDir)) {
|
|
2975
2972
|
mkdirSync4(sampleDir, { recursive: true });
|
|
2976
2973
|
}
|
|
2977
|
-
writeFileSync5(
|
|
2974
|
+
writeFileSync5(join11(sampleDir, "protected.ts"), protectedRouteTemplate);
|
|
2978
2975
|
}
|
|
2979
2976
|
function updateEnvForAuth(workspace, strategies) {
|
|
2980
2977
|
const envLines = [];
|
|
@@ -3018,7 +3015,7 @@ async function scaffoldAuthSetup(options = {}) {
|
|
|
3018
3015
|
return packagesUpdated;
|
|
3019
3016
|
}
|
|
3020
3017
|
async function setupPackageJson(workspace, stepOptions) {
|
|
3021
|
-
const pkgPath =
|
|
3018
|
+
const pkgPath = join11(workspace, "package.json");
|
|
3022
3019
|
const authDeps = {
|
|
3023
3020
|
"@playcademy/better-auth": PLAYCADEMY_AUTH_VERSION,
|
|
3024
3021
|
"better-auth": BETTER_AUTH_VERSION
|
|
@@ -3042,10 +3039,10 @@ async function setupPackageJson(workspace, stepOptions) {
|
|
|
3042
3039
|
|
|
3043
3040
|
// src/lib/init/database.ts
|
|
3044
3041
|
import { existsSync as existsSync11, mkdirSync as mkdirSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync6 } from "node:fs";
|
|
3045
|
-
import { join as
|
|
3042
|
+
import { join as join12 } from "node:path";
|
|
3046
3043
|
|
|
3047
3044
|
// src/version.ts
|
|
3048
|
-
var cliVersion = false ? "0.0.0-dev" : "0.28.1-beta.
|
|
3045
|
+
var cliVersion = false ? "0.0.0-dev" : "0.28.1-beta.23";
|
|
3049
3046
|
|
|
3050
3047
|
// src/lib/init/database.ts
|
|
3051
3048
|
var drizzleConfigTemplate = loadTemplateString("database/drizzle-config.ts");
|
|
@@ -3062,25 +3059,25 @@ async function scaffoldDatabaseSetup(options) {
|
|
|
3062
3059
|
await runStep(
|
|
3063
3060
|
"Configuring database...",
|
|
3064
3061
|
async () => {
|
|
3065
|
-
const dbDir =
|
|
3066
|
-
const schemaDir =
|
|
3062
|
+
const dbDir = join12(workspace, DEFAULT_DATABASE_DIRECTORY);
|
|
3063
|
+
const schemaDir = join12(dbDir, SCHEMA_SUBDIRECTORY);
|
|
3067
3064
|
if (!existsSync11(dbDir)) {
|
|
3068
3065
|
mkdirSync5(dbDir, { recursive: true });
|
|
3069
3066
|
}
|
|
3070
3067
|
if (!existsSync11(schemaDir)) {
|
|
3071
3068
|
mkdirSync5(schemaDir, { recursive: true });
|
|
3072
3069
|
}
|
|
3073
|
-
const exampleSchemaPath =
|
|
3070
|
+
const exampleSchemaPath = join12(schemaDir, DB_FILES.EXAMPLE_SCHEMA);
|
|
3074
3071
|
writeFileSync6(exampleSchemaPath, dbSchemaExampleTemplate);
|
|
3075
|
-
const schemaIndexPath =
|
|
3072
|
+
const schemaIndexPath = join12(schemaDir, DB_FILES.SCHEMA_INDEX);
|
|
3076
3073
|
writeFileSync6(schemaIndexPath, dbSchemaIndexTemplate);
|
|
3077
|
-
const dbIndexPath =
|
|
3074
|
+
const dbIndexPath = join12(dbDir, DB_FILES.INDEX);
|
|
3078
3075
|
writeFileSync6(dbIndexPath, dbIndexTemplate);
|
|
3079
|
-
const dbTypesPath =
|
|
3076
|
+
const dbTypesPath = join12(dbDir, DB_FILES.TYPES);
|
|
3080
3077
|
writeFileSync6(dbTypesPath, dbTypesTemplate);
|
|
3081
|
-
const dbSeedPath =
|
|
3078
|
+
const dbSeedPath = join12(dbDir, DB_FILES.SEED);
|
|
3082
3079
|
writeFileSync6(dbSeedPath, dbSeedTemplate);
|
|
3083
|
-
const drizzleConfigPath =
|
|
3080
|
+
const drizzleConfigPath = join12(workspace, DRIZZLE_CONFIG_FILES[0]);
|
|
3084
3081
|
writeFileSync6(drizzleConfigPath, drizzleConfigTemplate);
|
|
3085
3082
|
packagesUpdated = await setupPackageJson2(workspace, options.appName, stepOptions);
|
|
3086
3083
|
},
|
|
@@ -3090,7 +3087,7 @@ async function scaffoldDatabaseSetup(options) {
|
|
|
3090
3087
|
return packagesUpdated;
|
|
3091
3088
|
}
|
|
3092
3089
|
async function setupPackageJson2(workspace, appName, stepOptions) {
|
|
3093
|
-
const pkgPath =
|
|
3090
|
+
const pkgPath = join12(workspace, "package.json");
|
|
3094
3091
|
const dbDeps = {
|
|
3095
3092
|
"drizzle-orm": "^0.42.0",
|
|
3096
3093
|
"better-sqlite3": "^12.0.0"
|
|
@@ -3134,7 +3131,7 @@ async function setupPackageJson2(workspace, appName, stepOptions) {
|
|
|
3134
3131
|
}
|
|
3135
3132
|
}
|
|
3136
3133
|
function hasDatabaseSetup(workspace = getWorkspace()) {
|
|
3137
|
-
return DRIZZLE_CONFIG_FILES.some((filename) => existsSync11(
|
|
3134
|
+
return DRIZZLE_CONFIG_FILES.some((filename) => existsSync11(join12(workspace, filename)));
|
|
3138
3135
|
}
|
|
3139
3136
|
|
|
3140
3137
|
// src/lib/init/scaffold.ts
|
|
@@ -3145,7 +3142,7 @@ var sampleBucketRouteTemplate = loadTemplateString("api/sample-bucket.ts");
|
|
|
3145
3142
|
var playcademyGitignoreTemplate = loadTemplateString("playcademy-gitignore");
|
|
3146
3143
|
async function scaffoldApiDirectory(apiDirectory, sampleRoutes) {
|
|
3147
3144
|
const apiPath = resolve7(getWorkspace(), apiDirectory);
|
|
3148
|
-
const samplePath =
|
|
3145
|
+
const samplePath = join13(apiPath, "sample");
|
|
3149
3146
|
if (!existsSync12(apiPath)) {
|
|
3150
3147
|
mkdirSync6(apiPath, { recursive: true });
|
|
3151
3148
|
}
|
|
@@ -3153,7 +3150,7 @@ async function scaffoldApiDirectory(apiDirectory, sampleRoutes) {
|
|
|
3153
3150
|
mkdirSync6(samplePath, { recursive: true });
|
|
3154
3151
|
}
|
|
3155
3152
|
for (const route of sampleRoutes) {
|
|
3156
|
-
writeFileSync7(
|
|
3153
|
+
writeFileSync7(join13(samplePath, route.filename), route.template, "utf8");
|
|
3157
3154
|
}
|
|
3158
3155
|
}
|
|
3159
3156
|
function validateApiDirectoryDoesNotExist(value) {
|
|
@@ -3165,11 +3162,11 @@ function validateApiDirectoryDoesNotExist(value) {
|
|
|
3165
3162
|
}
|
|
3166
3163
|
function ensurePlaycademyGitignore() {
|
|
3167
3164
|
const workspace = getWorkspace();
|
|
3168
|
-
const playcademyDir =
|
|
3165
|
+
const playcademyDir = join13(workspace, CLI_DIRECTORIES.WORKSPACE);
|
|
3169
3166
|
if (!existsSync12(playcademyDir)) {
|
|
3170
3167
|
mkdirSync6(playcademyDir, { recursive: true });
|
|
3171
3168
|
}
|
|
3172
|
-
const gitignorePath =
|
|
3169
|
+
const gitignorePath = join13(playcademyDir, ".gitignore");
|
|
3173
3170
|
writeFileSync7(gitignorePath, playcademyGitignoreTemplate);
|
|
3174
3171
|
}
|
|
3175
3172
|
async function scaffoldIntegrations(appName, options) {
|
|
@@ -3449,7 +3446,7 @@ async function selectConfigFormat(hasPackageJson2) {
|
|
|
3449
3446
|
// src/lib/init/types.ts
|
|
3450
3447
|
import { execSync as execSync4 } from "node:child_process";
|
|
3451
3448
|
import { existsSync as existsSync15, readFileSync as readFileSync9, writeFileSync as writeFileSync9 } from "node:fs";
|
|
3452
|
-
import { dirname as dirname5, join as
|
|
3449
|
+
import { dirname as dirname5, join as join16, resolve as resolve8 } from "node:path";
|
|
3453
3450
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
3454
3451
|
|
|
3455
3452
|
// ../utils/src/error.ts
|
|
@@ -3459,14 +3456,14 @@ function errorMessage(err) {
|
|
|
3459
3456
|
|
|
3460
3457
|
// src/lib/bundle/game-backend.ts
|
|
3461
3458
|
import { existsSync as existsSync13 } from "node:fs";
|
|
3462
|
-
import { join as
|
|
3459
|
+
import { join as join14 } from "node:path";
|
|
3463
3460
|
var HOOKS_EXTENSIONS = [".ts", ".tsx", ".js", ".mjs", ".cjs"];
|
|
3464
3461
|
function resolveGameRoutesDir(config) {
|
|
3465
3462
|
const customRoutes = config?.integrations?.customRoutes;
|
|
3466
3463
|
return typeof customRoutes === "object" && customRoutes.directory || GAME_API_ROUTES_DIRECTORY;
|
|
3467
3464
|
}
|
|
3468
3465
|
function getGameRoutesDirectory(projectPath, config) {
|
|
3469
|
-
return
|
|
3466
|
+
return join14(projectPath, resolveGameRoutesDir(config));
|
|
3470
3467
|
}
|
|
3471
3468
|
function hasGameCustomRoutes(projectPath, config) {
|
|
3472
3469
|
const customRoutesDir = getGameRoutesDirectory(projectPath, config);
|
|
@@ -3474,7 +3471,7 @@ function hasGameCustomRoutes(projectPath, config) {
|
|
|
3474
3471
|
}
|
|
3475
3472
|
function hasGameHooksModule(workspace) {
|
|
3476
3473
|
return HOOKS_EXTENSIONS.some(
|
|
3477
|
-
(ext) => existsSync13(
|
|
3474
|
+
(ext) => existsSync13(join14(workspace, GAME_SERVER_ROOT_DIRECTORY, `${GAME_HOOKS_FILE}${ext}`))
|
|
3478
3475
|
);
|
|
3479
3476
|
}
|
|
3480
3477
|
|
|
@@ -3497,7 +3494,7 @@ function hasKVSetup(config) {
|
|
|
3497
3494
|
// src/lib/init/tsconfig.ts
|
|
3498
3495
|
init_file_loader();
|
|
3499
3496
|
import { existsSync as existsSync14, readFileSync as readFileSync8, writeFileSync as writeFileSync8 } from "fs";
|
|
3500
|
-
import { join as
|
|
3497
|
+
import { join as join15 } from "path";
|
|
3501
3498
|
function hasAllRequiredIncludes(config, required) {
|
|
3502
3499
|
if (!config.include) {
|
|
3503
3500
|
return false;
|
|
@@ -3568,7 +3565,7 @@ function addToIncludeArrayPreservingComments(content, required) {
|
|
|
3568
3565
|
}
|
|
3569
3566
|
async function ensureTsconfigIncludes(workspace, required = TSCONFIG_REQUIRED_INCLUDES) {
|
|
3570
3567
|
for (const filename of TSCONFIG_FILES) {
|
|
3571
|
-
const configPath =
|
|
3568
|
+
const configPath = join15(workspace, filename);
|
|
3572
3569
|
if (existsSync14(configPath)) {
|
|
3573
3570
|
try {
|
|
3574
3571
|
const config = await loadFile(configPath, {
|
|
@@ -3641,8 +3638,8 @@ function getDepVersions() {
|
|
|
3641
3638
|
}
|
|
3642
3639
|
}
|
|
3643
3640
|
async function setupPlaycademyDependencies(workspace) {
|
|
3644
|
-
const playcademyDir =
|
|
3645
|
-
const playcademyPkgPath =
|
|
3641
|
+
const playcademyDir = join16(workspace, CLI_DIRECTORIES.WORKSPACE);
|
|
3642
|
+
const playcademyPkgPath = join16(playcademyDir, "package.json");
|
|
3646
3643
|
const { honoVersion, workersTypesVersion } = getDepVersions();
|
|
3647
3644
|
const playcademyPkg = {
|
|
3648
3645
|
private: true,
|
|
@@ -3738,14 +3735,14 @@ async function ensurePlaycademyTypes(options = {}) {
|
|
|
3738
3735
|
const bindingsStr = generateBindingsTypeString(features, queueBindings);
|
|
3739
3736
|
const secretsStr = await generateSecretsTypeString(workspace, verbose);
|
|
3740
3737
|
const hasAuth = Boolean(config.integrations?.auth);
|
|
3741
|
-
const hasAuthFile = existsSync15(
|
|
3738
|
+
const hasAuthFile = existsSync15(join16(workspace, "server/lib/auth.ts"));
|
|
3742
3739
|
const authVariablesString = generateAuthVariablesString(hasAuth, hasAuthFile);
|
|
3743
3740
|
let envContent = playcademyEnvTemplate.replace("{{BINDINGS}}", bindingsStr);
|
|
3744
3741
|
envContent = envContent.replace("{{SECRETS}}", secretsStr);
|
|
3745
3742
|
envContent = envContent.replace("{{AUTH_IMPORT}}", authVariablesString.authImport);
|
|
3746
3743
|
envContent = envContent.replace("{{VARIABLES}}", authVariablesString.variables);
|
|
3747
3744
|
envContent = envContent.replace("{{CONTEXT_VARS}}", authVariablesString.contextVars);
|
|
3748
|
-
const envPath =
|
|
3745
|
+
const envPath = join16(workspace, "playcademy-env.d.ts");
|
|
3749
3746
|
writeFileSync9(envPath, envContent);
|
|
3750
3747
|
if (verbose) {
|
|
3751
3748
|
logger.success("Generated `playcademy-env.d.ts`");
|
package/dist/constants.d.ts
CHANGED
|
@@ -6,10 +6,21 @@ export { GAME_WORKER_DOMAINS, PLAYCADEMY_BASE_URLS, PLAYCADEMY_DOMAINS } from '@
|
|
|
6
6
|
/**
|
|
7
7
|
* Default directory for custom API routes
|
|
8
8
|
* Used when integrations.customRoutes.directory is not specified in config
|
|
9
|
+
*
|
|
10
|
+
* Forward slashes on purpose: the value reaches tsconfig `include` arrays
|
|
11
|
+
* and display strings, and node's fs APIs accept them on every platform —
|
|
12
|
+
* `path.join` would produce a backslash on Windows and corrupt the tsconfig.
|
|
13
|
+
*/
|
|
14
|
+
declare const GAME_API_ROUTES_DIRECTORY = "server/api";
|
|
15
|
+
/**
|
|
16
|
+
* Preferred route directory inside a dashboard app (relative to the
|
|
17
|
+
* dashboard root). An alias of the game constant so the mirroring of the
|
|
18
|
+
* game backend's layout is structural, not two expressions kept in sync.
|
|
9
19
|
*/
|
|
10
|
-
declare const
|
|
20
|
+
declare const DASHBOARD_SERVER_API_ROUTES_DIRECTORY = "server/api";
|
|
11
21
|
/**
|
|
12
|
-
*
|
|
22
|
+
* Legacy route directory inside a dashboard app (relative to the dashboard
|
|
23
|
+
* root) — the fallback when server/api does not exist
|
|
13
24
|
*/
|
|
14
25
|
declare const DASHBOARD_API_ROUTES_DIRECTORY = "api";
|
|
15
26
|
/**
|
|
@@ -397,4 +408,4 @@ declare const CONFIG_FILE_NAMES: string[];
|
|
|
397
408
|
*/
|
|
398
409
|
declare const DOCS_URL = "https://docs.dev.playcademy.net/platform";
|
|
399
410
|
|
|
400
|
-
export { AUTH_API_SUBDIRECTORY, AUTH_CONFIG_FILE, AUTH_PROVIDER_NAMES, BETTER_AUTH_VERSION, BUCKET_ALWAYS_SKIP, CALLBACK_PATH, CALLBACK_PORT, CLI_DEFAULT_OUTPUTS, CLI_DIRECTORIES, CLI_FILES, CLI_USER_DIRECTORIES, CLOUDFLARE_BINDINGS, CONFIG_FILE_NAMES, DASHBOARD_API_ROUTES_DIRECTORY, DB_FILES, DEFAULT_BUCKET_DIRECTORY, DEFAULT_DATABASE_DIRECTORY, DEFAULT_PORTS, DEFAULT_TEMPLATE_REF, DOCS_URL, DRIZZLE_CONFIG_FILES, ENV_EXAMPLE_FILE, ENV_FILES, GAME_API_ROUTES_DIRECTORY, GAME_HOOKS_FILE, GAME_SERVER_LIB_DIRECTORY, GAME_SERVER_ROOT_DIRECTORY, GODOT_ADDON_URL, GODOT_BUILD_DIRECTORIES, GODOT_BUILD_OUTPUTS, GODOT_EXECUTABLE_PATTERNS, GODOT_EXPORT_PRESETS_FILE, GODOT_PROJECT_FILE, GODOT_WEB_PLATFORM, MINIFLARE_D1_DIRECTORY, NON_INTERACTIVE_HINTS, OAUTH_CALLBACK_URL_PATTERN, PLACEHOLDER_APP_URL, PLAYCADEMY_AUTH_VERSION, PRESIGNED_UPLOAD_THRESHOLD, PUBLIC_DIRECTORY, QUEUE_NAME_PREFIX, SAMPLE_API_SUBDIRECTORY, SAMPLE_BUCKET_FILENAME, SAMPLE_CUSTOM_FILENAME, SAMPLE_DATABASE_FILENAME, SAMPLE_KV_FILENAME, SCHEMA_SUBDIRECTORY, SELF_WORKER_NAME_BINDING, SSO_AUTH_TIMEOUT_MS, TEMPLATE_RENAME_FILES, TEMPLATE_REPOS, TSCONFIG_APP_JSON, TSCONFIG_FILES, TSCONFIG_JSON, TSCONFIG_REQUIRED_INCLUDES, WORKSPACE_NAME, cacheVersionDir, getConfigDir, nativeBinaryPath };
|
|
411
|
+
export { AUTH_API_SUBDIRECTORY, AUTH_CONFIG_FILE, AUTH_PROVIDER_NAMES, BETTER_AUTH_VERSION, BUCKET_ALWAYS_SKIP, CALLBACK_PATH, CALLBACK_PORT, CLI_DEFAULT_OUTPUTS, CLI_DIRECTORIES, CLI_FILES, CLI_USER_DIRECTORIES, CLOUDFLARE_BINDINGS, CONFIG_FILE_NAMES, DASHBOARD_API_ROUTES_DIRECTORY, DASHBOARD_SERVER_API_ROUTES_DIRECTORY, DB_FILES, DEFAULT_BUCKET_DIRECTORY, DEFAULT_DATABASE_DIRECTORY, DEFAULT_PORTS, DEFAULT_TEMPLATE_REF, DOCS_URL, DRIZZLE_CONFIG_FILES, ENV_EXAMPLE_FILE, ENV_FILES, GAME_API_ROUTES_DIRECTORY, GAME_HOOKS_FILE, GAME_SERVER_LIB_DIRECTORY, GAME_SERVER_ROOT_DIRECTORY, GODOT_ADDON_URL, GODOT_BUILD_DIRECTORIES, GODOT_BUILD_OUTPUTS, GODOT_EXECUTABLE_PATTERNS, GODOT_EXPORT_PRESETS_FILE, GODOT_PROJECT_FILE, GODOT_WEB_PLATFORM, MINIFLARE_D1_DIRECTORY, NON_INTERACTIVE_HINTS, OAUTH_CALLBACK_URL_PATTERN, PLACEHOLDER_APP_URL, PLAYCADEMY_AUTH_VERSION, PRESIGNED_UPLOAD_THRESHOLD, PUBLIC_DIRECTORY, QUEUE_NAME_PREFIX, SAMPLE_API_SUBDIRECTORY, SAMPLE_BUCKET_FILENAME, SAMPLE_CUSTOM_FILENAME, SAMPLE_DATABASE_FILENAME, SAMPLE_KV_FILENAME, SCHEMA_SUBDIRECTORY, SELF_WORKER_NAME_BINDING, SSO_AUTH_TIMEOUT_MS, TEMPLATE_RENAME_FILES, TEMPLATE_REPOS, TSCONFIG_APP_JSON, TSCONFIG_FILES, TSCONFIG_JSON, TSCONFIG_REQUIRED_INCLUDES, WORKSPACE_NAME, cacheVersionDir, getConfigDir, nativeBinaryPath };
|