playcademy 0.14.13 → 0.14.14

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/utils.js CHANGED
@@ -1708,7 +1708,9 @@ init_file_loader();
1708
1708
  import { dirname as dirname2, resolve as resolve2 } from "path";
1709
1709
 
1710
1710
  // src/constants/api.ts
1711
- var DEFAULT_API_ROUTES_DIRECTORY = "server/api";
1711
+ import { join } from "node:path";
1712
+ var DEFAULT_API_ROUTES_DIRECTORY = join("server", "api");
1713
+ var SERVER_LIB_DIRECTORY = join("server", "lib");
1712
1714
 
1713
1715
  // ../../package.json
1714
1716
  var package_default = {
@@ -1855,18 +1857,42 @@ var CLOUDFLARE_BINDINGS = {
1855
1857
  DB: "DB"
1856
1858
  };
1857
1859
 
1860
+ // src/constants/database.ts
1861
+ import { join as join2 } from "path";
1862
+ var DEFAULT_DATABASE_DIRECTORY = join2("server", "db");
1863
+ var DRIZZLE_CONFIG_FILES = ["drizzle.config.ts", "drizzle.config.js"];
1864
+
1865
+ // src/constants/godot.ts
1866
+ import { join as join3 } from "node:path";
1867
+ var GODOT_BUILD_DIRECTORIES = {
1868
+ /** Root build directory (cleared before each export) */
1869
+ ROOT: "build",
1870
+ /** Web export subdirectory */
1871
+ WEB: join3("build", "web")
1872
+ };
1873
+ var GODOT_BUILD_OUTPUTS = {
1874
+ /** Exported web build entry point */
1875
+ INDEX_HTML: join3("build", "web", "index.html"),
1876
+ /** Packaged zip file (created by Godot export) */
1877
+ ZIP: join3("build", "web_playcademy.zip")
1878
+ };
1879
+
1858
1880
  // src/constants/paths.ts
1859
- import { join } from "path";
1881
+ import { join as join4 } from "path";
1860
1882
  var WORKSPACE_NAME = ".playcademy";
1861
1883
  var CLI_DIRECTORIES = {
1862
1884
  /** Root directory for CLI artifacts in workspace */
1863
1885
  WORKSPACE: WORKSPACE_NAME,
1864
1886
  /** Database directory within workspace */
1865
- DATABASE: join(WORKSPACE_NAME, "db"),
1887
+ DATABASE: join4(WORKSPACE_NAME, "db"),
1866
1888
  /** KV storage directory within workspace */
1867
- KV: join(WORKSPACE_NAME, "kv"),
1889
+ KV: join4(WORKSPACE_NAME, "kv"),
1868
1890
  /** Bucket storage directory within workspace */
1869
- BUCKET: join(WORKSPACE_NAME, "bucket")
1891
+ BUCKET: join4(WORKSPACE_NAME, "bucket")
1892
+ };
1893
+ var CLI_DEFAULT_OUTPUTS = {
1894
+ /** Default worker bundle output for debug command */
1895
+ WORKER_BUNDLE: join4(WORKSPACE_NAME, "worker-bundle.js")
1870
1896
  };
1871
1897
 
1872
1898
  // src/constants/ports.ts
@@ -2988,14 +3014,14 @@ function processConfigVariables(config) {
2988
3014
 
2989
3015
  // src/lib/dev/server.ts
2990
3016
  import { mkdir as mkdir2 } from "fs/promises";
2991
- import { join as join12 } from "path";
3017
+ import { join as join15 } from "path";
2992
3018
  import { Log, LogLevel, Miniflare } from "miniflare";
2993
3019
 
2994
3020
  // ../utils/src/port.ts
2995
3021
  import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2996
3022
  import { createServer } from "node:net";
2997
3023
  import { homedir } from "node:os";
2998
- import { join as join2 } from "node:path";
3024
+ import { join as join5 } from "node:path";
2999
3025
  async function isPortAvailableOnHost(port, host) {
3000
3026
  return new Promise((resolve4) => {
3001
3027
  const server = createServer();
@@ -3034,11 +3060,11 @@ async function findAvailablePort(startPort = 4321) {
3034
3060
  }
3035
3061
  function getRegistryPath() {
3036
3062
  const home = homedir();
3037
- const dir = join2(home, ".playcademy");
3063
+ const dir = join5(home, ".playcademy");
3038
3064
  if (!existsSync2(dir)) {
3039
3065
  mkdirSync(dir, { recursive: true });
3040
3066
  }
3041
- return join2(dir, ".proc");
3067
+ return join5(dir, ".proc");
3042
3068
  }
3043
3069
  function readRegistry() {
3044
3070
  const registryPath = getRegistryPath();
@@ -3084,7 +3110,7 @@ import { PlaycademyClient } from "@playcademy/sdk";
3084
3110
  // ../utils/src/package-manager.ts
3085
3111
  import { execSync } from "child_process";
3086
3112
  import { existsSync as existsSync3 } from "fs";
3087
- import { join as join3 } from "path";
3113
+ import { join as join6 } from "path";
3088
3114
  function isCommandAvailable(command) {
3089
3115
  try {
3090
3116
  execSync(`command -v ${command}`, { stdio: "ignore" });
@@ -3094,16 +3120,16 @@ function isCommandAvailable(command) {
3094
3120
  }
3095
3121
  }
3096
3122
  function detectPackageManager(cwd = process.cwd()) {
3097
- if (existsSync3(join3(cwd, "bun.lock")) || existsSync3(join3(cwd, "bun.lockb"))) {
3123
+ if (existsSync3(join6(cwd, "bun.lock")) || existsSync3(join6(cwd, "bun.lockb"))) {
3098
3124
  return "bun";
3099
3125
  }
3100
- if (existsSync3(join3(cwd, "pnpm-lock.yaml"))) {
3126
+ if (existsSync3(join6(cwd, "pnpm-lock.yaml"))) {
3101
3127
  return "pnpm";
3102
3128
  }
3103
- if (existsSync3(join3(cwd, "yarn.lock"))) {
3129
+ if (existsSync3(join6(cwd, "yarn.lock"))) {
3104
3130
  return "yarn";
3105
3131
  }
3106
- if (existsSync3(join3(cwd, "package-lock.json"))) {
3132
+ if (existsSync3(join6(cwd, "package-lock.json"))) {
3107
3133
  return "npm";
3108
3134
  }
3109
3135
  return detectByCommandAvailability();
@@ -3180,7 +3206,7 @@ init_package_json();
3180
3206
  // src/lib/secrets/env.ts
3181
3207
  init_file_loader();
3182
3208
  import { existsSync as existsSync4, writeFileSync as writeFileSync2 } from "fs";
3183
- import { join as join4 } from "path";
3209
+ import { join as join7 } from "path";
3184
3210
  function parseEnvFile(contents) {
3185
3211
  const secrets = {};
3186
3212
  for (const line of contents.split("\n")) {
@@ -3216,10 +3242,10 @@ async function readEnvFile(workspace) {
3216
3242
  return secrets;
3217
3243
  }
3218
3244
  function getLoadedEnvFiles(workspace) {
3219
- return ENV_FILES.filter((filename) => existsSync4(join4(workspace, filename)));
3245
+ return ENV_FILES.filter((filename) => existsSync4(join7(workspace, filename)));
3220
3246
  }
3221
3247
  function hasEnvFile(workspace) {
3222
- return ENV_FILES.some((filename) => existsSync4(join4(workspace, filename)));
3248
+ return ENV_FILES.some((filename) => existsSync4(join7(workspace, filename)));
3223
3249
  }
3224
3250
 
3225
3251
  // src/lib/templates/loader.ts
@@ -3246,12 +3272,12 @@ function loadTemplateString(filename) {
3246
3272
  // src/lib/core/import.ts
3247
3273
  import { mkdtempSync, rmSync } from "fs";
3248
3274
  import { tmpdir } from "os";
3249
- import { join as join5 } from "path";
3275
+ import { join as join8 } from "path";
3250
3276
  import { pathToFileURL } from "url";
3251
3277
  import * as esbuild from "esbuild";
3252
3278
  async function importTypescriptFile(filePath, bundleOptions) {
3253
- const tempDir = mkdtempSync(join5(tmpdir(), "playcademy-import-"));
3254
- const outFile = join5(tempDir, "bundle.mjs");
3279
+ const tempDir = mkdtempSync(join8(tmpdir(), "playcademy-import-"));
3280
+ const outFile = join8(tempDir, "bundle.mjs");
3255
3281
  try {
3256
3282
  await esbuild.build({
3257
3283
  entryPoints: [filePath],
@@ -3280,7 +3306,7 @@ async function importTypescriptDefault(filePath, bundleOptions) {
3280
3306
 
3281
3307
  // src/lib/deploy/bundle.ts
3282
3308
  import { existsSync as existsSync6 } from "fs";
3283
- import { join as join7 } from "path";
3309
+ import { join as join10 } from "path";
3284
3310
 
3285
3311
  // ../edge-play/src/entry.ts
3286
3312
  var entry_default = "/**\n * Game Backend Entry Point\n *\n * This file is the main entry point for deployed game backends.\n * It creates a Hono app and registers all enabled integration routes.\n *\n * Bundled with esbuild and deployed to Cloudflare Workers (or AWS Lambda).\n * Config is injected at build time via esbuild's `define` option.\n *\n * DO NOT REMOVE any code wrapped by \u26A0\uFE0F BUILD_MARKER: <marker> \u26A0\uFE0F\n */\n\nimport { Hono } from 'hono'\n\nimport {\n registerApiNotFoundHandler,\n registerAssetFallback,\n registerCors,\n registerEnvSetup,\n registerPlaycademyUser,\n registerSdkInit,\n} from './entry/middleware'\nimport { setupProcessGlobal } from './entry/setup'\nimport { registerBuiltinRoutes } from './register-routes'\n\nimport type { RuntimeConfig } from './entry/types'\nimport type { HonoEnv } from './types'\n\n// DO NOT REMOVE THE BELOW COMMENT\n// \u26A0\uFE0F BUILD_MARKER: CUSTOM_ROUTE_IMPORTS \u26A0\uFE0F\n\n/**\n * Config injected at build time by esbuild\n *\n * The `declare const` tells TypeScript \"this exists at runtime, trust me.\"\n * During bundling, esbuild's `define` option does literal text replacement:\n *\n * Example bundling:\n * Source: if (PLAYCADEMY_CONFIG.integrations.timeback) { ... }\n * Define: { 'PLAYCADEMY_CONFIG': JSON.stringify({ integrations: { timeback: {...} } }) }\n * Output: if ({\"integrations\":{\"timeback\":{...}}}.integrations.timeback) { ... }\n *\n * This enables tree-shaking: if timeback is not configured, those code paths are removed.\n * The bundled Worker only includes the routes that are actually enabled.\n */\ndeclare const PLAYCADEMY_CONFIG: RuntimeConfig\n\n// Setup process global polyfill for SDK compatibility\nsetupProcessGlobal()\n\n// Create Hono app\nconst app = new Hono<HonoEnv>()\n\n// Register middleware\nregisterCors(app)\nregisterEnvSetup(app, PLAYCADEMY_CONFIG)\nregisterSdkInit(app, PLAYCADEMY_CONFIG)\nregisterPlaycademyUser(app)\n\n// DO NOT REMOVE THE BELOW COMMENT\n// \u26A0\uFE0F BUILD_MARKER: SESSION_MIDDLEWARE \u26A0\uFE0F\n\n// Register built-in integration routes based on enabled integrations\n// This function conditionally imports and registers routes like:\n// - GET /api (always included)\n// - GET /api/health (always included)\n// - POST /api/integrations/timeback/end-activity (if timeback enabled)\n//\n// Uses dynamic imports for tree-shaking: if an integration is not enabled,\n// its route code is completely removed from the bundle.\nawait registerBuiltinRoutes(app, PLAYCADEMY_CONFIG.integrations)\n\n// DO NOT REMOVE THE BELOW COMMENT\n// \u26A0\uFE0F BUILD_MARKER: CUSTOM_ROUTES \u26A0\uFE0F\n\n// Register API 404 handler\n// Returns JSON error for unmatched /api/* routes\n// Must be registered after all API routes\nregisterApiNotFoundHandler(app)\n\n// Register static asset fallback handler\n// Serves frontend assets from Workers Assets binding\n// MUST be registered last as it uses a wildcard GET route (app.get('*', ...))\n//\n// In production: Serves frontend assets from Workers Assets binding\n// In local dev: Returns 404 (Vite serves the frontend separately)\nregisterAssetFallback(app)\n\nexport default app\n";
@@ -3553,7 +3579,7 @@ function textLoaderPlugin() {
3553
3579
  init_file_loader();
3554
3580
  import { mkdir, writeFile } from "fs/promises";
3555
3581
  import { tmpdir as tmpdir2 } from "os";
3556
- import { join as join6, relative } from "path";
3582
+ import { join as join9, relative } from "path";
3557
3583
 
3558
3584
  // src/lib/deploy/hash.ts
3559
3585
  import { createHash } from "crypto";
@@ -3572,7 +3598,7 @@ async function discoverRoutes(apiDir) {
3572
3598
  const routes = await Promise.all(
3573
3599
  files.map(async (file) => {
3574
3600
  const routePath = filePathToRoutePath(file);
3575
- const absolutePath = join6(apiDir, file);
3601
+ const absolutePath = join9(apiDir, file);
3576
3602
  const relativePath = relative(getWorkspace(), absolutePath);
3577
3603
  const methods = await detectExportedMethods(absolutePath);
3578
3604
  return {
@@ -3633,10 +3659,10 @@ async function transpileRoute(filePath) {
3633
3659
  if (!result.outputFiles?.[0]) {
3634
3660
  throw new Error("Transpilation failed: no output");
3635
3661
  }
3636
- const tempDir = join6(tmpdir2(), "playcademy-dev");
3662
+ const tempDir = join9(tmpdir2(), "playcademy-dev");
3637
3663
  await mkdir(tempDir, { recursive: true });
3638
3664
  const hash = hashContent(filePath).slice(0, 12);
3639
- const jsPath = join6(tempDir, `${hash}.mjs`);
3665
+ const jsPath = join9(tempDir, `${hash}.mjs`);
3640
3666
  await writeFile(jsPath, result.outputFiles[0].text);
3641
3667
  return jsPath;
3642
3668
  }
@@ -3647,7 +3673,7 @@ async function discoverCustomRoutes(config) {
3647
3673
  const workspace = getWorkspace();
3648
3674
  const customRoutesConfig = config.integrations?.customRoutes;
3649
3675
  const customRoutesDir = typeof customRoutesConfig === "object" && customRoutesConfig.directory || DEFAULT_API_ROUTES_DIRECTORY;
3650
- const customRoutes = await discoverRoutes(join7(workspace, customRoutesDir));
3676
+ const customRoutes = await discoverRoutes(join10(workspace, customRoutesDir));
3651
3677
  const customRouteData = customRoutes.map((r) => ({
3652
3678
  path: r.path,
3653
3679
  file: r.file,
@@ -3659,15 +3685,15 @@ async function discoverCustomRoutes(config) {
3659
3685
  function resolveEmbeddedSourcePaths() {
3660
3686
  const workspace = getWorkspace();
3661
3687
  const distDir = new URL(".", import.meta.url).pathname;
3662
- const embeddedEdgeSrc = join7(distDir, "edge-play", "src");
3688
+ const embeddedEdgeSrc = join10(distDir, "edge-play", "src");
3663
3689
  const isBuiltPackage = existsSync6(embeddedEdgeSrc);
3664
3690
  const monorepoRoot = getMonorepoRoot();
3665
- const monorepoEdgeSrc = join7(monorepoRoot, "packages/edge-play/src");
3691
+ const monorepoEdgeSrc = join10(monorepoRoot, "packages/edge-play/src");
3666
3692
  const edgePlaySrc = isBuiltPackage ? embeddedEdgeSrc : monorepoEdgeSrc;
3667
- const cliPackageRoot = isBuiltPackage ? join7(distDir, "../../..") : join7(monorepoRoot, "packages/cli");
3668
- const cliNodeModules = isBuiltPackage ? join7(cliPackageRoot, "node_modules") : monorepoRoot;
3669
- const workspaceNodeModules = join7(workspace, "node_modules");
3670
- const constantsEntry = isBuiltPackage ? join7(embeddedEdgeSrc, "..", "..", "constants", "src", "index.ts") : join7(monorepoRoot, "packages", "constants", "src", "index.ts");
3693
+ const cliPackageRoot = isBuiltPackage ? join10(distDir, "../../..") : join10(monorepoRoot, "packages/cli");
3694
+ const cliNodeModules = isBuiltPackage ? join10(cliPackageRoot, "node_modules") : monorepoRoot;
3695
+ const workspaceNodeModules = join10(workspace, "node_modules");
3696
+ const constantsEntry = isBuiltPackage ? join10(embeddedEdgeSrc, "..", "..", "constants", "src", "index.ts") : join10(monorepoRoot, "packages", "constants", "src", "index.ts");
3671
3697
  return {
3672
3698
  isBuiltPackage,
3673
3699
  edgePlaySrc,
@@ -3732,22 +3758,22 @@ function createEsbuildConfig(entryCode, paths, bundleConfig, customRoutesDir, op
3732
3758
  // │ Example: import * as route from '@game-api/hello.ts' │
3733
3759
  // │ Resolves to: /user-project/server/api/hello.ts │
3734
3760
  // └─────────────────────────────────────────────────────────────────┘
3735
- "@game-api": join7(workspace, customRoutesDir),
3761
+ "@game-api": join10(workspace, customRoutesDir),
3736
3762
  // ┌─ User's server lib directory ───────────────────────────────────┐
3737
3763
  // │ @game-server is a virtual module for server utilities/config │
3738
3764
  // │ Example: import { getAuth } from '@game-server/lib/auth' │
3739
3765
  // │ Resolves to: /user-project/server/lib/auth.ts │
3740
3766
  // └─────────────────────────────────────────────────────────────────┘
3741
- "@game-server": join7(workspace, "server"),
3767
+ "@game-server": join10(workspace, "server"),
3742
3768
  // ┌─ Node.js polyfills for Cloudflare Workers ──────────────────────┐
3743
3769
  // │ Workers don't have fs, path, os, etc. Redirect to polyfills │
3744
3770
  // │ that throw helpful errors if user code tries to use them. │
3745
3771
  // └─────────────────────────────────────────────────────────────────┘
3746
- fs: join7(edgePlaySrc, "polyfills.js"),
3747
- "fs/promises": join7(edgePlaySrc, "polyfills.js"),
3748
- path: join7(edgePlaySrc, "polyfills.js"),
3749
- os: join7(edgePlaySrc, "polyfills.js"),
3750
- process: join7(edgePlaySrc, "polyfills.js")
3772
+ fs: join10(edgePlaySrc, "polyfills.js"),
3773
+ "fs/promises": join10(edgePlaySrc, "polyfills.js"),
3774
+ path: join10(edgePlaySrc, "polyfills.js"),
3775
+ os: join10(edgePlaySrc, "polyfills.js"),
3776
+ process: join10(edgePlaySrc, "polyfills.js")
3751
3777
  },
3752
3778
  // ──── Build Plugins ────
3753
3779
  plugins: [textLoaderPlugin()],
@@ -3832,12 +3858,12 @@ var protectedRouteTemplate = loadTemplateString("api/sample-protected.ts");
3832
3858
 
3833
3859
  // src/lib/init/database.ts
3834
3860
  import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
3835
- import { join as join8 } from "path";
3861
+ import { join as join11 } from "path";
3836
3862
 
3837
3863
  // package.json
3838
3864
  var package_default2 = {
3839
3865
  name: "playcademy",
3840
- version: "0.14.12",
3866
+ version: "0.14.13",
3841
3867
  type: "module",
3842
3868
  exports: {
3843
3869
  ".": {
@@ -3916,8 +3942,7 @@ var version = package_default2.version;
3916
3942
 
3917
3943
  // src/lib/init/database.ts
3918
3944
  var drizzleConfigTemplate = loadTemplateString("database/drizzle-config.ts");
3919
- var dbSchemaUsersTemplate = loadTemplateString("database/db-schema-users.ts");
3920
- var dbSchemaScoresTemplate = loadTemplateString("database/db-schema-scores.ts");
3945
+ var dbSchemaExampleTemplate = loadTemplateString("database/db-schema-example.ts");
3921
3946
  var dbSchemaIndexTemplate = loadTemplateString("database/db-schema-index.ts");
3922
3947
  var dbIndexTemplate = loadTemplateString("database/db-index.ts");
3923
3948
  var dbTypesTemplate = loadTemplateString("database/db-types.ts");
@@ -3925,9 +3950,7 @@ var dbSeedTemplate = loadTemplateString("database/db-seed.ts");
3925
3950
  var packageTemplate = loadTemplateString("database/package.json");
3926
3951
  function hasDatabaseSetup() {
3927
3952
  const workspace = getWorkspace();
3928
- const drizzleConfigPath = join8(workspace, "drizzle.config.ts");
3929
- const drizzleConfigJsPath = join8(workspace, "drizzle.config.js");
3930
- return existsSync7(drizzleConfigPath) || existsSync7(drizzleConfigJsPath);
3953
+ return DRIZZLE_CONFIG_FILES.some((filename) => existsSync7(join11(workspace, filename)));
3931
3954
  }
3932
3955
 
3933
3956
  // src/lib/init/scaffold.ts
@@ -3951,16 +3974,16 @@ function hasBucketSetup(config) {
3951
3974
  init_file_loader();
3952
3975
  import { execSync as execSync2 } from "child_process";
3953
3976
  import { existsSync as existsSync10, writeFileSync as writeFileSync5 } from "fs";
3954
- import { dirname as dirname4, join as join11 } from "path";
3977
+ import { dirname as dirname4, join as join14 } from "path";
3955
3978
  import { fileURLToPath as fileURLToPath2 } from "url";
3956
3979
 
3957
3980
  // src/lib/deploy/backend.ts
3958
3981
  import { existsSync as existsSync8 } from "node:fs";
3959
- import { join as join9 } from "node:path";
3982
+ import { join as join12 } from "node:path";
3960
3983
  function getCustomRoutesDirectory(projectPath, config) {
3961
3984
  const customRoutes = config?.integrations?.customRoutes;
3962
3985
  const customRoutesDir = typeof customRoutes === "object" && customRoutes.directory || DEFAULT_API_ROUTES_DIRECTORY;
3963
- return join9(projectPath, customRoutesDir);
3986
+ return join12(projectPath, customRoutesDir);
3964
3987
  }
3965
3988
  function hasLocalCustomRoutes(projectPath, config) {
3966
3989
  const customRoutesDir = getCustomRoutesDirectory(projectPath, config);
@@ -3970,7 +3993,7 @@ function hasLocalCustomRoutes(projectPath, config) {
3970
3993
  // src/lib/init/tsconfig.ts
3971
3994
  init_file_loader();
3972
3995
  import { existsSync as existsSync9, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "fs";
3973
- import { join as join10 } from "path";
3996
+ import { join as join13 } from "path";
3974
3997
  function hasPlaycademyEnv(config) {
3975
3998
  return config.include?.includes("playcademy-env.d.ts") ?? false;
3976
3999
  }
@@ -4027,7 +4050,7 @@ function addToIncludeArrayPreservingComments(content) {
4027
4050
  }
4028
4051
  async function ensureTsconfigIncludes(workspace) {
4029
4052
  for (const filename of TSCONFIG_FILES) {
4030
- const configPath = join10(workspace, filename);
4053
+ const configPath = join13(workspace, filename);
4031
4054
  if (!existsSync9(configPath)) {
4032
4055
  continue;
4033
4056
  }
@@ -4077,8 +4100,8 @@ function hasAnyBackend(features) {
4077
4100
  return Object.values(features).some(Boolean);
4078
4101
  }
4079
4102
  async function setupPlaycademyDependencies(workspace) {
4080
- const playcademyDir = join11(workspace, CLI_DIRECTORIES.WORKSPACE);
4081
- const playcademyPkgPath = join11(playcademyDir, "package.json");
4103
+ const playcademyDir = join14(workspace, CLI_DIRECTORIES.WORKSPACE);
4104
+ const playcademyPkgPath = join14(playcademyDir, "package.json");
4082
4105
  const __dirname = dirname4(fileURLToPath2(import.meta.url));
4083
4106
  const cliPkg = await loadPackageJson({ cwd: __dirname, searchUp: true, required: true });
4084
4107
  const workersTypesVersion = cliPkg?.devDependencies?.["@cloudflare/workers-types"] || "latest";
@@ -4163,14 +4186,14 @@ async function ensurePlaycademyTypes(options = {}) {
4163
4186
  const bindingsStr = generateBindingsTypeString(features);
4164
4187
  const secretsStr = await generateSecretsTypeString(workspace, verbose);
4165
4188
  const hasAuth = !!config.integrations?.auth;
4166
- const hasAuthFile = existsSync10(join11(workspace, "server/lib/auth.ts"));
4189
+ const hasAuthFile = existsSync10(join14(workspace, "server/lib/auth.ts"));
4167
4190
  const authVariablesString = generateAuthVariablesString(hasAuth, hasAuthFile);
4168
4191
  let envContent = playcademyEnvTemplate.replace("{{BINDINGS}}", bindingsStr);
4169
4192
  envContent = envContent.replace("{{SECRETS}}", secretsStr);
4170
4193
  envContent = envContent.replace("{{AUTH_IMPORT}}", authVariablesString.authImport);
4171
4194
  envContent = envContent.replace("{{VARIABLES}}", authVariablesString.variables);
4172
4195
  envContent = envContent.replace("{{CONTEXT_VARS}}", authVariablesString.contextVars);
4173
- const envPath = join11(workspace, "playcademy-env.d.ts");
4196
+ const envPath = join14(workspace, "playcademy-env.d.ts");
4174
4197
  writeFileSync5(envPath, envContent);
4175
4198
  if (verbose) {
4176
4199
  logger.success(`Generated <playcademy-env.d.ts>`);
@@ -4283,7 +4306,7 @@ async function startDevServer(options) {
4283
4306
  return { server: mf, port };
4284
4307
  }
4285
4308
  async function ensureDatabaseDirectory() {
4286
- const dbDir = join12(getWorkspace(), CLI_DIRECTORIES.DATABASE);
4309
+ const dbDir = join15(getWorkspace(), CLI_DIRECTORIES.DATABASE);
4287
4310
  try {
4288
4311
  await mkdir2(dbDir, { recursive: true });
4289
4312
  } catch (error) {
@@ -4292,7 +4315,7 @@ async function ensureDatabaseDirectory() {
4292
4315
  return dbDir;
4293
4316
  }
4294
4317
  async function ensureKvDirectory() {
4295
- const kvDir = join12(getWorkspace(), CLI_DIRECTORIES.KV);
4318
+ const kvDir = join15(getWorkspace(), CLI_DIRECTORIES.KV);
4296
4319
  try {
4297
4320
  await mkdir2(kvDir, { recursive: true });
4298
4321
  } catch (error) {
@@ -4301,7 +4324,7 @@ async function ensureKvDirectory() {
4301
4324
  return kvDir;
4302
4325
  }
4303
4326
  async function ensureBucketDirectory() {
4304
- const bucketDir = join12(getWorkspace(), CLI_DIRECTORIES.BUCKET);
4327
+ const bucketDir = join15(getWorkspace(), CLI_DIRECTORIES.BUCKET);
4305
4328
  try {
4306
4329
  await mkdir2(bucketDir, { recursive: true });
4307
4330
  } catch (error) {
@@ -4324,7 +4347,7 @@ async function writeBackendServerInfo(port) {
4324
4347
  }
4325
4348
 
4326
4349
  // src/lib/dev/reload.ts
4327
- import { join as join13, relative as relative2 } from "path";
4350
+ import { join as join16, relative as relative2 } from "path";
4328
4351
  import chokidar from "chokidar";
4329
4352
  import { bold as bold5, cyan as cyan3, dim as dim4, green as green2 } from "colorette";
4330
4353
  function formatTime() {
@@ -4341,9 +4364,9 @@ function startHotReload(onReload, options = {}) {
4341
4364
  const customRoutesConfig = options.config?.integrations?.customRoutes;
4342
4365
  const customRoutesDir = typeof customRoutesConfig === "object" && customRoutesConfig.directory || DEFAULT_API_ROUTES_DIRECTORY;
4343
4366
  const watchPaths = [
4344
- join13(workspace, customRoutesDir),
4345
- join13(workspace, "playcademy.config.js"),
4346
- join13(workspace, "playcademy.config.json")
4367
+ join16(workspace, customRoutesDir),
4368
+ join16(workspace, "playcademy.config.js"),
4369
+ join16(workspace, "playcademy.config.json")
4347
4370
  ];
4348
4371
  const watcher = chokidar.watch(watchPaths, {
4349
4372
  persistent: true,
package/dist/version.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "playcademy",
4
- version: "0.14.12",
4
+ version: "0.14.13",
5
5
  type: "module",
6
6
  exports: {
7
7
  ".": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playcademy",
3
- "version": "0.14.13",
3
+ "version": "0.14.14",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,43 +0,0 @@
1
- /**
2
- * Scores Schema
3
- *
4
- * Define game score tables here using Drizzle ORM.
5
- */
6
-
7
- import { relations } from 'drizzle-orm'
8
- import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core'
9
-
10
- import { users } from './users'
11
-
12
- /**
13
- * Scores table
14
- *
15
- * Tracks game scores per user with level information
16
- */
17
- export const scores = sqliteTable('scores', {
18
- /** Unique score ID */
19
- id: integer('id').primaryKey({ autoIncrement: true }),
20
- /** Reference to user who earned this score */
21
- userId: integer('user_id')
22
- .notNull()
23
- .references(() => users.id),
24
- /** Score value (points earned) */
25
- score: integer('score').notNull(),
26
- /** Level where score was earned */
27
- level: integer('level').notNull(),
28
- /** Timestamp when score was created */
29
- createdAt: text('created_at').notNull(),
30
- })
31
-
32
- /**
33
- * Score relations
34
- *
35
- * Defines how scores relate to users (many-to-one)
36
- */
37
- export const scoresRelations = relations(scores, ({ one }) => ({
38
- user: one(users, {
39
- fields: [scores.userId],
40
- references: [users.id],
41
- }),
42
- }))
43
-
@@ -1,23 +0,0 @@
1
- /**
2
- * Users Schema
3
- *
4
- * Define user-related tables here using Drizzle ORM.
5
- */
6
-
7
- import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core'
8
-
9
- /**
10
- * Users table
11
- *
12
- * Stores basic user information
13
- */
14
- export const users = sqliteTable('users', {
15
- /** Unique user ID */
16
- id: integer('id').primaryKey({ autoIncrement: true }),
17
- /** User's display name */
18
- name: text('name').notNull(),
19
- /** Timestamp when user was created */
20
- createdAt: text('created_at').notNull(),
21
- /** Timestamp when user was last updated */
22
- updatedAt: text('updated_at').notNull(),
23
- })