playcademy 0.14.13 → 0.14.14-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ export { GAME_WORKER_DOMAINS, PLAYCADEMY_BASE_URLS, PLAYCADEMY_DOMAINS } from '@
7
7
  * Default directory for custom API routes
8
8
  * Used when integrations.customRoutes.directory is not specified in config
9
9
  */
10
- declare const DEFAULT_API_ROUTES_DIRECTORY = "server/api";
10
+ declare const DEFAULT_API_ROUTES_DIRECTORY: string;
11
11
  /**
12
12
  * Server root directory (fixed location)
13
13
  */
@@ -15,7 +15,7 @@ declare const SERVER_ROOT_DIRECTORY = "server";
15
15
  /**
16
16
  * Server library/utilities directory (fixed location)
17
17
  */
18
- declare const SERVER_LIB_DIRECTORY = "server/lib";
18
+ declare const SERVER_LIB_DIRECTORY: string;
19
19
  /**
20
20
  * Auth routes subdirectory name within API directory (fixed structure)
21
21
  */
@@ -141,19 +141,30 @@ declare const TSCONFIG_FILES: readonly ["tsconfig.app.json", "tsconfig.json"];
141
141
  /**
142
142
  * Default directory for database files (configurable via playcademy.config)
143
143
  */
144
- declare const DEFAULT_DATABASE_DIRECTORY = "db";
144
+ declare const DEFAULT_DATABASE_DIRECTORY: string;
145
145
  /**
146
146
  * Schema subdirectory name within database directory (fixed structure)
147
147
  */
148
148
  declare const SCHEMA_SUBDIRECTORY = "schema";
149
149
  /**
150
- * Schema entry point file name (fixed structure)
151
- */
152
- declare const SCHEMA_INDEX_FILE = "index.ts";
150
+ * Database file names (fixed structure)
151
+ */
152
+ declare const DB_FILES: {
153
+ /** Index file name */
154
+ readonly INDEX: "index.ts";
155
+ /** Seed file name */
156
+ readonly SEED: "seed.ts";
157
+ /** Types file name */
158
+ readonly TYPES: "types.ts";
159
+ /** Schema index file name */
160
+ readonly SCHEMA_INDEX: "index.ts";
161
+ /** Example schema file name */
162
+ readonly EXAMPLE_SCHEMA: "example.ts";
163
+ };
153
164
  /**
154
- * Default seed file name (can be overridden with --file option)
165
+ * Drizzle config file names
155
166
  */
156
- declare const DEFAULT_SEED_FILE_NAME = "seed.ts";
167
+ declare const DRIZZLE_CONFIG_FILES: readonly ["drizzle.config.ts", "drizzle.config.js"];
157
168
 
158
169
  /**
159
170
  * Godot engine integration constants
@@ -179,16 +190,16 @@ declare const GODOT_BUILD_DIRECTORIES: {
179
190
  /** Root build directory (cleared before each export) */
180
191
  readonly ROOT: "build";
181
192
  /** Web export subdirectory */
182
- readonly WEB: "build/web";
193
+ readonly WEB: string;
183
194
  };
184
195
  /**
185
196
  * Build output file paths
186
197
  */
187
198
  declare const GODOT_BUILD_OUTPUTS: {
188
199
  /** Exported web build entry point */
189
- readonly INDEX_HTML: "build/web/index.html";
200
+ readonly INDEX_HTML: string;
190
201
  /** Packaged zip file (created by Godot export) */
191
- readonly ZIP: "build/web_playcademy.zip";
202
+ readonly ZIP: string;
192
203
  };
193
204
  /**
194
205
  * Platform-specific Godot executable discovery patterns
@@ -247,7 +258,7 @@ declare const CLI_USER_DIRECTORIES: {
247
258
  */
248
259
  declare const CLI_DEFAULT_OUTPUTS: {
249
260
  /** Default worker bundle output for debug command */
250
- readonly WORKER_BUNDLE: ".playcademy/worker-bundle.js";
261
+ readonly WORKER_BUNDLE: string;
251
262
  };
252
263
  /**
253
264
  * CLI file names
@@ -276,4 +287,4 @@ declare const DEFAULT_PORTS: {
276
287
  */
277
288
  declare const CONFIG_FILE_NAMES: string[];
278
289
 
279
- 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, CLOUDFLARE_COMPATIBILITY_DATE, CONFIG_FILE_NAMES, DEFAULT_API_ROUTES_DIRECTORY, DEFAULT_DATABASE_DIRECTORY, DEFAULT_PORTS, DEFAULT_SEED_FILE_NAME, ENV_EXAMPLE_FILE, ENV_FILES, GODOT_BUILD_DIRECTORIES, GODOT_BUILD_OUTPUTS, GODOT_EXECUTABLE_PATTERNS, GODOT_EXPORT_PRESETS_FILE, GODOT_PROJECT_FILE, GODOT_WEB_PLATFORM, MINIFLARE_D1_DIRECTORY, OAUTH_CALLBACK_URL_PATTERN, PLACEHOLDER_GAME_URL, PLAYCADEMY_AUTH_VERSION, SAMPLE_API_SUBDIRECTORY, SAMPLE_BUCKET_FILENAME, SAMPLE_CUSTOM_FILENAME, SAMPLE_DATABASE_FILENAME, SAMPLE_KV_FILENAME, SCHEMA_INDEX_FILE, SCHEMA_SUBDIRECTORY, SERVER_LIB_DIRECTORY, SERVER_ROOT_DIRECTORY, SSO_AUTH_TIMEOUT_MS, TSCONFIG_FILES, WORKSPACE_NAME };
290
+ 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, CLOUDFLARE_COMPATIBILITY_DATE, CONFIG_FILE_NAMES, DB_FILES, DEFAULT_API_ROUTES_DIRECTORY, DEFAULT_DATABASE_DIRECTORY, DEFAULT_PORTS, DRIZZLE_CONFIG_FILES, ENV_EXAMPLE_FILE, ENV_FILES, GODOT_BUILD_DIRECTORIES, GODOT_BUILD_OUTPUTS, GODOT_EXECUTABLE_PATTERNS, GODOT_EXPORT_PRESETS_FILE, GODOT_PROJECT_FILE, GODOT_WEB_PLATFORM, MINIFLARE_D1_DIRECTORY, OAUTH_CALLBACK_URL_PATTERN, PLACEHOLDER_GAME_URL, PLAYCADEMY_AUTH_VERSION, SAMPLE_API_SUBDIRECTORY, SAMPLE_BUCKET_FILENAME, SAMPLE_CUSTOM_FILENAME, SAMPLE_DATABASE_FILENAME, SAMPLE_KV_FILENAME, SCHEMA_SUBDIRECTORY, SERVER_LIB_DIRECTORY, SERVER_ROOT_DIRECTORY, SSO_AUTH_TIMEOUT_MS, TSCONFIG_FILES, WORKSPACE_NAME };
package/dist/constants.js CHANGED
@@ -1,7 +1,8 @@
1
1
  // src/constants/api.ts
2
- var DEFAULT_API_ROUTES_DIRECTORY = "server/api";
2
+ import { join } from "node:path";
3
+ var DEFAULT_API_ROUTES_DIRECTORY = join("server", "api");
3
4
  var SERVER_ROOT_DIRECTORY = "server";
4
- var SERVER_LIB_DIRECTORY = "server/lib";
5
+ var SERVER_LIB_DIRECTORY = join("server", "lib");
5
6
  var AUTH_API_SUBDIRECTORY = "auth";
6
7
  var SAMPLE_API_SUBDIRECTORY = "sample";
7
8
  var SAMPLE_CUSTOM_FILENAME = "custom.ts";
@@ -166,12 +167,25 @@ var CLOUDFLARE_BINDINGS = {
166
167
  var MINIFLARE_D1_DIRECTORY = "miniflare-D1DatabaseObject";
167
168
 
168
169
  // src/constants/database.ts
169
- var DEFAULT_DATABASE_DIRECTORY = "db";
170
+ import { join as join2 } from "path";
171
+ var DEFAULT_DATABASE_DIRECTORY = join2("server", "db");
170
172
  var SCHEMA_SUBDIRECTORY = "schema";
171
- var SCHEMA_INDEX_FILE = "index.ts";
172
- var DEFAULT_SEED_FILE_NAME = "seed.ts";
173
+ var DB_FILES = {
174
+ /** Index file name */
175
+ INDEX: "index.ts",
176
+ /** Seed file name */
177
+ SEED: "seed.ts",
178
+ /** Types file name */
179
+ TYPES: "types.ts",
180
+ /** Schema index file name */
181
+ SCHEMA_INDEX: "index.ts",
182
+ /** Example schema file name */
183
+ EXAMPLE_SCHEMA: "example.ts"
184
+ };
185
+ var DRIZZLE_CONFIG_FILES = ["drizzle.config.ts", "drizzle.config.js"];
173
186
 
174
187
  // src/constants/godot.ts
188
+ import { join as join3 } from "node:path";
175
189
  var GODOT_PROJECT_FILE = "project.godot";
176
190
  var GODOT_EXPORT_PRESETS_FILE = "export_presets.cfg";
177
191
  var GODOT_WEB_PLATFORM = 'platform="Web"';
@@ -179,13 +193,13 @@ var GODOT_BUILD_DIRECTORIES = {
179
193
  /** Root build directory (cleared before each export) */
180
194
  ROOT: "build",
181
195
  /** Web export subdirectory */
182
- WEB: "build/web"
196
+ WEB: join3("build", "web")
183
197
  };
184
198
  var GODOT_BUILD_OUTPUTS = {
185
199
  /** Exported web build entry point */
186
- INDEX_HTML: "build/web/index.html",
200
+ INDEX_HTML: join3("build", "web", "index.html"),
187
201
  /** Packaged zip file (created by Godot export) */
188
- ZIP: "build/web_playcademy.zip"
202
+ ZIP: join3("build", "web_playcademy.zip")
189
203
  };
190
204
  var GODOT_EXECUTABLE_PATTERNS = {
191
205
  /** macOS app bundle suffix */
@@ -208,17 +222,17 @@ var CALLBACK_PATH = "/callback";
208
222
  var SSO_AUTH_TIMEOUT_MS = 3e4;
209
223
 
210
224
  // src/constants/paths.ts
211
- import { join } from "path";
225
+ import { join as join4 } from "path";
212
226
  var WORKSPACE_NAME = ".playcademy";
213
227
  var CLI_DIRECTORIES = {
214
228
  /** Root directory for CLI artifacts in workspace */
215
229
  WORKSPACE: WORKSPACE_NAME,
216
230
  /** Database directory within workspace */
217
- DATABASE: join(WORKSPACE_NAME, "db"),
231
+ DATABASE: join4(WORKSPACE_NAME, "db"),
218
232
  /** KV storage directory within workspace */
219
- KV: join(WORKSPACE_NAME, "kv"),
233
+ KV: join4(WORKSPACE_NAME, "kv"),
220
234
  /** Bucket storage directory within workspace */
221
- BUCKET: join(WORKSPACE_NAME, "bucket")
235
+ BUCKET: join4(WORKSPACE_NAME, "bucket")
222
236
  };
223
237
  var CLI_USER_DIRECTORIES = {
224
238
  /** User config directory for auth, games store, etc. */
@@ -226,7 +240,7 @@ var CLI_USER_DIRECTORIES = {
226
240
  };
227
241
  var CLI_DEFAULT_OUTPUTS = {
228
242
  /** Default worker bundle output for debug command */
229
- WORKER_BUNDLE: ".playcademy/worker-bundle.js"
243
+ WORKER_BUNDLE: join4(WORKSPACE_NAME, "worker-bundle.js")
230
244
  };
231
245
  var CLI_FILES = {
232
246
  /** Auth store file in user config directory */
@@ -315,10 +329,11 @@ export {
315
329
  CLOUDFLARE_BINDINGS,
316
330
  CLOUDFLARE_COMPATIBILITY_DATE,
317
331
  CONFIG_FILE_NAMES,
332
+ DB_FILES,
318
333
  DEFAULT_API_ROUTES_DIRECTORY,
319
334
  DEFAULT_DATABASE_DIRECTORY,
320
335
  DEFAULT_PORTS,
321
- DEFAULT_SEED_FILE_NAME,
336
+ DRIZZLE_CONFIG_FILES,
322
337
  ENV_EXAMPLE_FILE,
323
338
  ENV_FILES,
324
339
  GAME_WORKER_DOMAINS,
@@ -339,7 +354,6 @@ export {
339
354
  SAMPLE_CUSTOM_FILENAME,
340
355
  SAMPLE_DATABASE_FILENAME,
341
356
  SAMPLE_KV_FILENAME,
342
- SCHEMA_INDEX_FILE,
343
357
  SCHEMA_SUBDIRECTORY,
344
358
  SERVER_LIB_DIRECTORY,
345
359
  SERVER_ROOT_DIRECTORY,
package/dist/db.js CHANGED
@@ -1430,7 +1430,12 @@ var init_file_loader = __esm({
1430
1430
 
1431
1431
  // src/lib/db/path.ts
1432
1432
  import { copyFileSync, existsSync, mkdirSync, readdirSync, unlinkSync } from "fs";
1433
- import { join as join2 } from "path";
1433
+ import { join as join5 } from "path";
1434
+
1435
+ // src/constants/api.ts
1436
+ import { join } from "node:path";
1437
+ var DEFAULT_API_ROUTES_DIRECTORY = join("server", "api");
1438
+ var SERVER_LIB_DIRECTORY = join("server", "lib");
1434
1439
 
1435
1440
  // ../../package.json
1436
1441
  var package_default = {
@@ -1571,18 +1576,41 @@ var CLOUDFLARE_BINDINGS = {
1571
1576
  };
1572
1577
  var MINIFLARE_D1_DIRECTORY = "miniflare-D1DatabaseObject";
1573
1578
 
1579
+ // src/constants/database.ts
1580
+ import { join as join2 } from "path";
1581
+ var DEFAULT_DATABASE_DIRECTORY = join2("server", "db");
1582
+
1583
+ // src/constants/godot.ts
1584
+ import { join as join3 } from "node:path";
1585
+ var GODOT_BUILD_DIRECTORIES = {
1586
+ /** Root build directory (cleared before each export) */
1587
+ ROOT: "build",
1588
+ /** Web export subdirectory */
1589
+ WEB: join3("build", "web")
1590
+ };
1591
+ var GODOT_BUILD_OUTPUTS = {
1592
+ /** Exported web build entry point */
1593
+ INDEX_HTML: join3("build", "web", "index.html"),
1594
+ /** Packaged zip file (created by Godot export) */
1595
+ ZIP: join3("build", "web_playcademy.zip")
1596
+ };
1597
+
1574
1598
  // src/constants/paths.ts
1575
- import { join } from "path";
1599
+ import { join as join4 } from "path";
1576
1600
  var WORKSPACE_NAME = ".playcademy";
1577
1601
  var CLI_DIRECTORIES = {
1578
1602
  /** Root directory for CLI artifacts in workspace */
1579
1603
  WORKSPACE: WORKSPACE_NAME,
1580
1604
  /** Database directory within workspace */
1581
- DATABASE: join(WORKSPACE_NAME, "db"),
1605
+ DATABASE: join4(WORKSPACE_NAME, "db"),
1582
1606
  /** KV storage directory within workspace */
1583
- KV: join(WORKSPACE_NAME, "kv"),
1607
+ KV: join4(WORKSPACE_NAME, "kv"),
1584
1608
  /** Bucket storage directory within workspace */
1585
- BUCKET: join(WORKSPACE_NAME, "bucket")
1609
+ BUCKET: join4(WORKSPACE_NAME, "bucket")
1610
+ };
1611
+ var CLI_DEFAULT_OUTPUTS = {
1612
+ /** Default worker bundle output for debug command */
1613
+ WORKER_BUNDLE: join4(WORKSPACE_NAME, "worker-bundle.js")
1586
1614
  };
1587
1615
  var CLI_FILES = {
1588
1616
  /** Auth store file in user config directory */
@@ -1633,11 +1661,11 @@ var ensureDirectoryExists = (dir) => {
1633
1661
  }
1634
1662
  };
1635
1663
  var findMiniflareDatabase = (dbDir) => {
1636
- const miniflareDir = join2(dbDir, MINIFLARE_D1_DIRECTORY);
1664
+ const miniflareDir = join5(dbDir, MINIFLARE_D1_DIRECTORY);
1637
1665
  if (!existsSync(miniflareDir)) return null;
1638
1666
  const sqliteFiles = readdirSync(miniflareDir).filter((file) => file.endsWith(".sqlite"));
1639
1667
  if (sqliteFiles.length === 0) return null;
1640
- return join2(miniflareDir, sqliteFiles[0]);
1668
+ return join5(miniflareDir, sqliteFiles[0]);
1641
1669
  };
1642
1670
  var migrateInitialDbToTarget = (initialPath, targetPath) => {
1643
1671
  if (!existsSync(initialPath)) return;
@@ -1645,7 +1673,7 @@ var migrateInitialDbToTarget = (initialPath, targetPath) => {
1645
1673
  unlinkSync(initialPath);
1646
1674
  };
1647
1675
  function getDevDbPath() {
1648
- const initialDbPath = join2(DB_DIRECTORY, INITIAL_DB_NAME);
1676
+ const initialDbPath = join5(DB_DIRECTORY, INITIAL_DB_NAME);
1649
1677
  ensureDirectoryExists(DB_DIRECTORY);
1650
1678
  const miniflareDbPath = findMiniflareDatabase(DB_DIRECTORY);
1651
1679
  if (miniflareDbPath) {
@@ -1709,7 +1737,7 @@ async function bundleSeedWorker(seedFilePath, projectPath) {
1709
1737
  // src/lib/db/reset.ts
1710
1738
  import { execSync as execSync2 } from "child_process";
1711
1739
  import { rmSync as rmSync2 } from "fs";
1712
- import { join as join5 } from "path";
1740
+ import { join as join8 } from "path";
1713
1741
 
1714
1742
  // ../utils/src/ansi.ts
1715
1743
  var colors = {
@@ -1938,7 +1966,7 @@ init_package_json();
1938
1966
  // ../utils/src/package-manager.ts
1939
1967
  import { execSync } from "child_process";
1940
1968
  import { existsSync as existsSync2 } from "fs";
1941
- import { join as join3 } from "path";
1969
+ import { join as join6 } from "path";
1942
1970
  function isCommandAvailable(command) {
1943
1971
  try {
1944
1972
  execSync(`command -v ${command}`, { stdio: "ignore" });
@@ -1948,16 +1976,16 @@ function isCommandAvailable(command) {
1948
1976
  }
1949
1977
  }
1950
1978
  function detectPackageManager(cwd = process.cwd()) {
1951
- if (existsSync2(join3(cwd, "bun.lock")) || existsSync2(join3(cwd, "bun.lockb"))) {
1979
+ if (existsSync2(join6(cwd, "bun.lock")) || existsSync2(join6(cwd, "bun.lockb"))) {
1952
1980
  return "bun";
1953
1981
  }
1954
- if (existsSync2(join3(cwd, "pnpm-lock.yaml"))) {
1982
+ if (existsSync2(join6(cwd, "pnpm-lock.yaml"))) {
1955
1983
  return "pnpm";
1956
1984
  }
1957
- if (existsSync2(join3(cwd, "yarn.lock"))) {
1985
+ if (existsSync2(join6(cwd, "yarn.lock"))) {
1958
1986
  return "yarn";
1959
1987
  }
1960
- if (existsSync2(join3(cwd, "package-lock.json"))) {
1988
+ if (existsSync2(join6(cwd, "package-lock.json"))) {
1961
1989
  return "npm";
1962
1990
  }
1963
1991
  return detectByCommandAvailability();
@@ -2882,12 +2910,12 @@ var currentDir = dirname(fileURLToPath(import.meta.url));
2882
2910
  // src/lib/core/import.ts
2883
2911
  import { mkdtempSync, rmSync } from "fs";
2884
2912
  import { tmpdir } from "os";
2885
- import { join as join4 } from "path";
2913
+ import { join as join7 } from "path";
2886
2914
  import { pathToFileURL } from "url";
2887
2915
  import * as esbuild from "esbuild";
2888
2916
  async function importTypescriptFile(filePath, bundleOptions) {
2889
- const tempDir = mkdtempSync(join4(tmpdir(), "playcademy-import-"));
2890
- const outFile = join4(tempDir, "bundle.mjs");
2917
+ const tempDir = mkdtempSync(join7(tmpdir(), "playcademy-import-"));
2918
+ const outFile = join7(tempDir, "bundle.mjs");
2891
2919
  try {
2892
2920
  await esbuild.build({
2893
2921
  entryPoints: [filePath],
@@ -2910,7 +2938,7 @@ async function importTypescriptFile(filePath, bundleOptions) {
2910
2938
  // src/lib/db/reset.ts
2911
2939
  async function resetDatabase(workspace, mf, options = { debug: false }) {
2912
2940
  const { debug } = options;
2913
- const dbDir = join5(workspace, CLI_DIRECTORIES.DATABASE);
2941
+ const dbDir = join8(workspace, CLI_DIRECTORIES.DATABASE);
2914
2942
  await runStep(
2915
2943
  "Resetting database...",
2916
2944
  async () => {