playcademy 0.14.21 → 0.14.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.
@@ -8,14 +8,6 @@ export { GAME_WORKER_DOMAINS, PLAYCADEMY_BASE_URLS, PLAYCADEMY_DOMAINS } from '@
8
8
  * Used when integrations.customRoutes.directory is not specified in config
9
9
  */
10
10
  declare const DEFAULT_API_ROUTES_DIRECTORY: string;
11
- /**
12
- * Server root directory (fixed location)
13
- */
14
- declare const SERVER_ROOT_DIRECTORY = "server";
15
- /**
16
- * Server library/utilities directory (fixed location)
17
- */
18
- declare const SERVER_LIB_DIRECTORY: string;
19
11
  /**
20
12
  * Auth routes subdirectory name within API directory (fixed structure)
21
13
  */
@@ -126,6 +118,14 @@ declare const ENV_FILES: readonly [".env", ".env.development", ".env.local"];
126
118
  * Safe to commit to version control with placeholder values
127
119
  */
128
120
  declare const ENV_EXAMPLE_FILE = ".env.example";
121
+ /**
122
+ * Standard TypeScript config filename
123
+ */
124
+ declare const TSCONFIG_JSON = "tsconfig.json";
125
+ /**
126
+ * Vite/modern tooling TypeScript config filename
127
+ */
128
+ declare const TSCONFIG_APP_JSON = "tsconfig.app.json";
129
129
  /**
130
130
  * TypeScript config files to check (in priority order)
131
131
  *
@@ -134,6 +134,13 @@ declare const ENV_EXAMPLE_FILE = ".env.example";
134
134
  * 2. tsconfig.json ← Standard TypeScript config - fallback
135
135
  */
136
136
  declare const TSCONFIG_FILES: readonly ["tsconfig.app.json", "tsconfig.json"];
137
+ /**
138
+ * Entries that should be in the tsconfig include array for Playcademy projects
139
+ *
140
+ * - playcademy-env.d.ts: Type definitions generated by the CLI
141
+ * - server: Server-side TypeScript code directory
142
+ */
143
+ declare const TSCONFIG_REQUIRED_INCLUDES: readonly ["playcademy-env.d.ts", "server"];
137
144
 
138
145
  /**
139
146
  * Database-related constants
@@ -282,9 +289,28 @@ declare const DEFAULT_PORTS: {
282
289
  readonly BACKEND: 8788;
283
290
  };
284
291
 
292
+ /**
293
+ * Server directory structure constants
294
+ *
295
+ * Centralized path constants for server-related directories.
296
+ * Uses path.join() for cross-platform compatibility.
297
+ */
298
+ /**
299
+ * Server root directory (fixed location)
300
+ */
301
+ declare const SERVER_ROOT_DIRECTORY = "server";
302
+ /**
303
+ * Server library/utilities directory (fixed location)
304
+ */
305
+ declare const SERVER_LIB_DIRECTORY: string;
306
+ /**
307
+ * Public assets directory (fixed location)
308
+ */
309
+ declare const PUBLIC_DIRECTORY = "public";
310
+
285
311
  /**
286
312
  * Config file names to search for
287
313
  */
288
314
  declare const CONFIG_FILE_NAMES: string[];
289
315
 
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 };
316
+ 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, PUBLIC_DIRECTORY, 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_APP_JSON, TSCONFIG_FILES, TSCONFIG_JSON, TSCONFIG_REQUIRED_INCLUDES, WORKSPACE_NAME };
package/dist/constants.js CHANGED
@@ -1,8 +1,14 @@
1
1
  // src/constants/api.ts
2
+ import { join as join2 } from "node:path";
3
+
4
+ // src/constants/server.ts
2
5
  import { join } from "node:path";
3
- var DEFAULT_API_ROUTES_DIRECTORY = join("server", "api");
4
6
  var SERVER_ROOT_DIRECTORY = "server";
5
- var SERVER_LIB_DIRECTORY = join("server", "lib");
7
+ var SERVER_LIB_DIRECTORY = join(SERVER_ROOT_DIRECTORY, "lib");
8
+ var PUBLIC_DIRECTORY = "public";
9
+
10
+ // src/constants/api.ts
11
+ var DEFAULT_API_ROUTES_DIRECTORY = join2(SERVER_ROOT_DIRECTORY, "api");
6
12
  var AUTH_API_SUBDIRECTORY = "auth";
7
13
  var SAMPLE_API_SUBDIRECTORY = "sample";
8
14
  var SAMPLE_CUSTOM_FILENAME = "custom.ts";
@@ -143,12 +149,20 @@ var ENV_FILES = [
143
149
  // Overrides all (highest priority)
144
150
  ];
145
151
  var ENV_EXAMPLE_FILE = ".env.example";
152
+ var TSCONFIG_JSON = "tsconfig.json";
153
+ var TSCONFIG_APP_JSON = "tsconfig.app.json";
146
154
  var TSCONFIG_FILES = [
147
- "tsconfig.app.json",
155
+ TSCONFIG_APP_JSON,
148
156
  // Modern tooling (try first)
149
- "tsconfig.json"
157
+ TSCONFIG_JSON
150
158
  // Standard (fallback)
151
159
  ];
160
+ var TSCONFIG_REQUIRED_INCLUDES = [
161
+ "playcademy-env.d.ts",
162
+ // Generated type definitions
163
+ "server"
164
+ // Server-side code
165
+ ];
152
166
 
153
167
  // src/constants/bucket.ts
154
168
  var BUCKET_ALWAYS_SKIP = [".git", ".DS_Store", ".gitignore", ...ENV_FILES];
@@ -166,8 +180,8 @@ var CLOUDFLARE_BINDINGS = {
166
180
  var MINIFLARE_D1_DIRECTORY = "miniflare-D1DatabaseObject";
167
181
 
168
182
  // src/constants/database.ts
169
- import { join as join2 } from "path";
170
- var DEFAULT_DATABASE_DIRECTORY = join2("server", "db");
183
+ import { join as join3 } from "path";
184
+ var DEFAULT_DATABASE_DIRECTORY = join3("server", "db");
171
185
  var SCHEMA_SUBDIRECTORY = "schema";
172
186
  var DB_FILES = {
173
187
  /** Index file name */
@@ -184,7 +198,7 @@ var DB_FILES = {
184
198
  var DRIZZLE_CONFIG_FILES = ["drizzle.config.ts", "drizzle.config.js"];
185
199
 
186
200
  // src/constants/godot.ts
187
- import { join as join3 } from "node:path";
201
+ import { join as join4 } from "node:path";
188
202
  var GODOT_PROJECT_FILE = "project.godot";
189
203
  var GODOT_EXPORT_PRESETS_FILE = "export_presets.cfg";
190
204
  var GODOT_WEB_PLATFORM = 'platform="Web"';
@@ -192,13 +206,13 @@ var GODOT_BUILD_DIRECTORIES = {
192
206
  /** Root build directory (cleared before each export) */
193
207
  ROOT: "build",
194
208
  /** Web export subdirectory */
195
- WEB: join3("build", "web")
209
+ WEB: join4("build", "web")
196
210
  };
197
211
  var GODOT_BUILD_OUTPUTS = {
198
212
  /** Exported web build entry point */
199
- INDEX_HTML: join3("build", "web", "index.html"),
213
+ INDEX_HTML: join4("build", "web", "index.html"),
200
214
  /** Packaged zip file (created by Godot export) */
201
- ZIP: join3("build", "web_playcademy.zip")
215
+ ZIP: join4("build", "web_playcademy.zip")
202
216
  };
203
217
  var GODOT_EXECUTABLE_PATTERNS = {
204
218
  /** macOS app bundle suffix */
@@ -221,17 +235,17 @@ var CALLBACK_PATH = "/callback";
221
235
  var SSO_AUTH_TIMEOUT_MS = 3e4;
222
236
 
223
237
  // src/constants/paths.ts
224
- import { join as join4 } from "path";
238
+ import { join as join5 } from "path";
225
239
  var WORKSPACE_NAME = ".playcademy";
226
240
  var CLI_DIRECTORIES = {
227
241
  /** Root directory for CLI artifacts in workspace */
228
242
  WORKSPACE: WORKSPACE_NAME,
229
243
  /** Database directory within workspace */
230
- DATABASE: join4(WORKSPACE_NAME, "db"),
244
+ DATABASE: join5(WORKSPACE_NAME, "db"),
231
245
  /** KV storage directory within workspace */
232
- KV: join4(WORKSPACE_NAME, "kv"),
246
+ KV: join5(WORKSPACE_NAME, "kv"),
233
247
  /** Bucket storage directory within workspace */
234
- BUCKET: join4(WORKSPACE_NAME, "bucket")
248
+ BUCKET: join5(WORKSPACE_NAME, "bucket")
235
249
  };
236
250
  var CLI_USER_DIRECTORIES = {
237
251
  /** User config directory for auth, games store, etc. */
@@ -239,7 +253,7 @@ var CLI_USER_DIRECTORIES = {
239
253
  };
240
254
  var CLI_DEFAULT_OUTPUTS = {
241
255
  /** Default worker bundle output for debug command */
242
- WORKER_BUNDLE: join4(WORKSPACE_NAME, "worker-bundle.js")
256
+ WORKER_BUNDLE: join5(WORKSPACE_NAME, "worker-bundle.js")
243
257
  };
244
258
  var CLI_FILES = {
245
259
  /** Auth store file in user config directory */
@@ -348,6 +362,7 @@ export {
348
362
  PLAYCADEMY_AUTH_VERSION,
349
363
  PLAYCADEMY_BASE_URLS,
350
364
  PLAYCADEMY_DOMAINS,
365
+ PUBLIC_DIRECTORY,
351
366
  SAMPLE_API_SUBDIRECTORY,
352
367
  SAMPLE_BUCKET_FILENAME,
353
368
  SAMPLE_CUSTOM_FILENAME,
@@ -357,6 +372,9 @@ export {
357
372
  SERVER_LIB_DIRECTORY,
358
373
  SERVER_ROOT_DIRECTORY,
359
374
  SSO_AUTH_TIMEOUT_MS,
375
+ TSCONFIG_APP_JSON,
360
376
  TSCONFIG_FILES,
377
+ TSCONFIG_JSON,
378
+ TSCONFIG_REQUIRED_INCLUDES,
361
379
  WORKSPACE_NAME
362
380
  };
package/dist/db.js CHANGED
@@ -1430,12 +1430,18 @@ 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 join5 } from "path";
1433
+ import { join as join6 } from "path";
1434
1434
 
1435
1435
  // src/constants/api.ts
1436
+ import { join as join2 } from "node:path";
1437
+
1438
+ // src/constants/server.ts
1436
1439
  import { join } from "node:path";
1437
- var DEFAULT_API_ROUTES_DIRECTORY = join("server", "api");
1438
- var SERVER_LIB_DIRECTORY = join("server", "lib");
1440
+ var SERVER_ROOT_DIRECTORY = "server";
1441
+ var SERVER_LIB_DIRECTORY = join(SERVER_ROOT_DIRECTORY, "lib");
1442
+
1443
+ // src/constants/api.ts
1444
+ var DEFAULT_API_ROUTES_DIRECTORY = join2(SERVER_ROOT_DIRECTORY, "api");
1439
1445
 
1440
1446
  // ../../package.json
1441
1447
  var package_default = {
@@ -1576,40 +1582,40 @@ var CLOUDFLARE_BINDINGS = {
1576
1582
  var MINIFLARE_D1_DIRECTORY = "miniflare-D1DatabaseObject";
1577
1583
 
1578
1584
  // src/constants/database.ts
1579
- import { join as join2 } from "path";
1580
- var DEFAULT_DATABASE_DIRECTORY = join2("server", "db");
1585
+ import { join as join3 } from "path";
1586
+ var DEFAULT_DATABASE_DIRECTORY = join3("server", "db");
1581
1587
 
1582
1588
  // src/constants/godot.ts
1583
- import { join as join3 } from "node:path";
1589
+ import { join as join4 } from "node:path";
1584
1590
  var GODOT_BUILD_DIRECTORIES = {
1585
1591
  /** Root build directory (cleared before each export) */
1586
1592
  ROOT: "build",
1587
1593
  /** Web export subdirectory */
1588
- WEB: join3("build", "web")
1594
+ WEB: join4("build", "web")
1589
1595
  };
1590
1596
  var GODOT_BUILD_OUTPUTS = {
1591
1597
  /** Exported web build entry point */
1592
- INDEX_HTML: join3("build", "web", "index.html"),
1598
+ INDEX_HTML: join4("build", "web", "index.html"),
1593
1599
  /** Packaged zip file (created by Godot export) */
1594
- ZIP: join3("build", "web_playcademy.zip")
1600
+ ZIP: join4("build", "web_playcademy.zip")
1595
1601
  };
1596
1602
 
1597
1603
  // src/constants/paths.ts
1598
- import { join as join4 } from "path";
1604
+ import { join as join5 } from "path";
1599
1605
  var WORKSPACE_NAME = ".playcademy";
1600
1606
  var CLI_DIRECTORIES = {
1601
1607
  /** Root directory for CLI artifacts in workspace */
1602
1608
  WORKSPACE: WORKSPACE_NAME,
1603
1609
  /** Database directory within workspace */
1604
- DATABASE: join4(WORKSPACE_NAME, "db"),
1610
+ DATABASE: join5(WORKSPACE_NAME, "db"),
1605
1611
  /** KV storage directory within workspace */
1606
- KV: join4(WORKSPACE_NAME, "kv"),
1612
+ KV: join5(WORKSPACE_NAME, "kv"),
1607
1613
  /** Bucket storage directory within workspace */
1608
- BUCKET: join4(WORKSPACE_NAME, "bucket")
1614
+ BUCKET: join5(WORKSPACE_NAME, "bucket")
1609
1615
  };
1610
1616
  var CLI_DEFAULT_OUTPUTS = {
1611
1617
  /** Default worker bundle output for debug command */
1612
- WORKER_BUNDLE: join4(WORKSPACE_NAME, "worker-bundle.js")
1618
+ WORKER_BUNDLE: join5(WORKSPACE_NAME, "worker-bundle.js")
1613
1619
  };
1614
1620
  var CLI_FILES = {
1615
1621
  /** Auth store file in user config directory */
@@ -1660,11 +1666,11 @@ var ensureDirectoryExists = (dir) => {
1660
1666
  }
1661
1667
  };
1662
1668
  var findMiniflareDatabase = (dbDir) => {
1663
- const miniflareDir = join5(dbDir, MINIFLARE_D1_DIRECTORY);
1669
+ const miniflareDir = join6(dbDir, MINIFLARE_D1_DIRECTORY);
1664
1670
  if (!existsSync(miniflareDir)) return null;
1665
1671
  const sqliteFiles = readdirSync(miniflareDir).filter((file) => file.endsWith(".sqlite"));
1666
1672
  if (sqliteFiles.length === 0) return null;
1667
- return join5(miniflareDir, sqliteFiles[0]);
1673
+ return join6(miniflareDir, sqliteFiles[0]);
1668
1674
  };
1669
1675
  var migrateInitialDbToTarget = (initialPath, targetPath) => {
1670
1676
  if (!existsSync(initialPath)) return;
@@ -1672,7 +1678,7 @@ var migrateInitialDbToTarget = (initialPath, targetPath) => {
1672
1678
  unlinkSync(initialPath);
1673
1679
  };
1674
1680
  function getDevDbPath() {
1675
- const initialDbPath = join5(DB_DIRECTORY, INITIAL_DB_NAME);
1681
+ const initialDbPath = join6(DB_DIRECTORY, INITIAL_DB_NAME);
1676
1682
  ensureDirectoryExists(DB_DIRECTORY);
1677
1683
  const miniflareDbPath = findMiniflareDatabase(DB_DIRECTORY);
1678
1684
  if (miniflareDbPath) {
@@ -1736,7 +1742,7 @@ async function bundleSeedWorker(seedFilePath, projectPath) {
1736
1742
  // src/lib/db/reset.ts
1737
1743
  import { execSync as execSync2 } from "child_process";
1738
1744
  import { rmSync as rmSync2 } from "fs";
1739
- import { join as join8 } from "path";
1745
+ import { join as join9 } from "path";
1740
1746
 
1741
1747
  // ../utils/src/ansi.ts
1742
1748
  var colors = {
@@ -1965,7 +1971,7 @@ init_package_json();
1965
1971
  // ../utils/src/package-manager.ts
1966
1972
  import { execSync } from "child_process";
1967
1973
  import { existsSync as existsSync2 } from "fs";
1968
- import { join as join6 } from "path";
1974
+ import { join as join7 } from "path";
1969
1975
  function isCommandAvailable(command) {
1970
1976
  try {
1971
1977
  execSync(`command -v ${command}`, { stdio: "ignore" });
@@ -1975,16 +1981,16 @@ function isCommandAvailable(command) {
1975
1981
  }
1976
1982
  }
1977
1983
  function detectPackageManager(cwd = process.cwd()) {
1978
- if (existsSync2(join6(cwd, "bun.lock")) || existsSync2(join6(cwd, "bun.lockb"))) {
1984
+ if (existsSync2(join7(cwd, "bun.lock")) || existsSync2(join7(cwd, "bun.lockb"))) {
1979
1985
  return "bun";
1980
1986
  }
1981
- if (existsSync2(join6(cwd, "pnpm-lock.yaml"))) {
1987
+ if (existsSync2(join7(cwd, "pnpm-lock.yaml"))) {
1982
1988
  return "pnpm";
1983
1989
  }
1984
- if (existsSync2(join6(cwd, "yarn.lock"))) {
1990
+ if (existsSync2(join7(cwd, "yarn.lock"))) {
1985
1991
  return "yarn";
1986
1992
  }
1987
- if (existsSync2(join6(cwd, "package-lock.json"))) {
1993
+ if (existsSync2(join7(cwd, "package-lock.json"))) {
1988
1994
  return "npm";
1989
1995
  }
1990
1996
  return detectByCommandAvailability();
@@ -2960,12 +2966,12 @@ var currentDir = dirname(fileURLToPath(import.meta.url));
2960
2966
  // src/lib/core/import.ts
2961
2967
  import { mkdtempSync, rmSync } from "fs";
2962
2968
  import { tmpdir } from "os";
2963
- import { join as join7 } from "path";
2969
+ import { join as join8 } from "path";
2964
2970
  import { pathToFileURL } from "url";
2965
2971
  import * as esbuild from "esbuild";
2966
2972
  async function importTypescriptFile(filePath, bundleOptions) {
2967
- const tempDir = mkdtempSync(join7(tmpdir(), "playcademy-import-"));
2968
- const outFile = join7(tempDir, "bundle.mjs");
2973
+ const tempDir = mkdtempSync(join8(tmpdir(), "playcademy-import-"));
2974
+ const outFile = join8(tempDir, "bundle.mjs");
2969
2975
  try {
2970
2976
  await esbuild.build({
2971
2977
  entryPoints: [filePath],
@@ -2988,7 +2994,7 @@ async function importTypescriptFile(filePath, bundleOptions) {
2988
2994
  // src/lib/db/reset.ts
2989
2995
  async function resetDatabase(workspace, mf, options = { debug: false }) {
2990
2996
  const { debug } = options;
2991
- const dbDir = join8(workspace, CLI_DIRECTORIES.DATABASE);
2997
+ const dbDir = join9(workspace, CLI_DIRECTORIES.DATABASE);
2992
2998
  await runStep(
2993
2999
  "Resetting database...",
2994
3000
  async () => {