playcademy 0.13.13 → 0.13.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5442,75 +5442,8 @@ import { bold as bold3, cyan as cyan2 } from "colorette";
5442
5442
  init_constants2();
5443
5443
  init_core();
5444
5444
  init_loader2();
5445
- import { existsSync as existsSync8, mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
5446
- import { join as join10, resolve as resolve6 } from "path";
5447
-
5448
- // src/lib/init/types.ts
5449
- init_file_loader();
5450
- init_package_manager();
5451
- init_constants2();
5452
- init_loader();
5453
- init_core();
5454
- init_loader2();
5455
- import { execSync as execSync3 } from "child_process";
5456
- import { writeFileSync as writeFileSync3 } from "fs";
5457
- import { dirname as dirname4, join as join9 } from "path";
5458
- import { fileURLToPath as fileURLToPath2 } from "url";
5459
- var playcademyEnvTemplate = loadTemplateString("playcademy-env.d.ts");
5460
- async function ensurePlaycademyTypes(configPath) {
5461
- try {
5462
- const workspace = getWorkspace();
5463
- const config = await loadConfig(configPath);
5464
- const hasDB = hasDatabaseSetup();
5465
- const hasKV = hasKVSetup(config);
5466
- const hasBucket = hasBucketSetup(config);
5467
- if (!hasDB && !hasKV && !hasBucket) {
5468
- return;
5469
- }
5470
- const playcademyDir = join9(workspace, CLI_DIRECTORIES.WORKSPACE);
5471
- const playcademyPkgPath = join9(playcademyDir, "package.json");
5472
- const __dirname2 = dirname4(fileURLToPath2(import.meta.url));
5473
- const cliPkg = await loadPackageJson({ cwd: __dirname2, searchUp: true, required: true });
5474
- const workersTypesVersion = cliPkg?.devDependencies?.["@cloudflare/workers-types"] || "latest";
5475
- const honoVersion = cliPkg?.dependencies?.hono || "latest";
5476
- const playcademyPkg = {
5477
- private: true,
5478
- dependencies: {
5479
- hono: honoVersion
5480
- },
5481
- devDependencies: {
5482
- "@cloudflare/workers-types": workersTypesVersion
5483
- }
5484
- };
5485
- writeFileSync3(playcademyPkgPath, JSON.stringify(playcademyPkg, null, 4) + "\n");
5486
- const pm = detectPackageManager(workspace);
5487
- const installCmd = getInstallCommand(pm);
5488
- execSync3(installCmd, {
5489
- cwd: playcademyDir,
5490
- stdio: ["ignore", "ignore", "ignore"]
5491
- });
5492
- const bindings = [];
5493
- if (hasKV) {
5494
- bindings.push(" KV: KVNamespace");
5495
- }
5496
- if (hasDB) {
5497
- bindings.push(" DB: D1Database");
5498
- }
5499
- if (hasBucket) {
5500
- bindings.push(" BUCKET: R2Bucket");
5501
- }
5502
- const bindingsStr = bindings.length > 0 ? "\n" + bindings.join("\n") : "";
5503
- const envContent = playcademyEnvTemplate.replace("{{BINDINGS}}", bindingsStr);
5504
- const envPath = join9(workspace, "playcademy-env.d.ts");
5505
- writeFileSync3(envPath, envContent);
5506
- } catch (error) {
5507
- logger.warn(
5508
- `Failed to generate TypeScript types: ${error instanceof Error ? error.message : String(error)}`
5509
- );
5510
- }
5511
- }
5512
-
5513
- // src/lib/init/scaffold.ts
5445
+ import { existsSync as existsSync8, mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
5446
+ import { join as join9, resolve as resolve6 } from "path";
5514
5447
  var sampleCustomRouteTemplate = loadTemplateString("api/sample-custom.ts");
5515
5448
  var sampleDatabaseRouteTemplate = loadTemplateString("api/sample-database.ts");
5516
5449
  var sampleKvRouteTemplate = loadTemplateString("api/sample-kv.ts");
@@ -5518,7 +5451,7 @@ var sampleBucketRouteTemplate = loadTemplateString("api/sample-bucket.ts");
5518
5451
  var playcademyGitignoreTemplate = loadTemplateString("playcademy-gitignore");
5519
5452
  async function scaffoldApiDirectory(apiDirectory, sampleRoutes) {
5520
5453
  const apiPath = resolve6(getWorkspace(), apiDirectory);
5521
- const samplePath = join10(apiPath, "sample");
5454
+ const samplePath = join9(apiPath, "sample");
5522
5455
  if (!existsSync8(apiPath)) {
5523
5456
  mkdirSync3(apiPath, { recursive: true });
5524
5457
  }
@@ -5526,7 +5459,7 @@ async function scaffoldApiDirectory(apiDirectory, sampleRoutes) {
5526
5459
  mkdirSync3(samplePath, { recursive: true });
5527
5460
  }
5528
5461
  for (const route of sampleRoutes) {
5529
- writeFileSync4(join10(samplePath, route.filename), route.template, "utf-8");
5462
+ writeFileSync3(join9(samplePath, route.filename), route.template, "utf-8");
5530
5463
  }
5531
5464
  }
5532
5465
  function validateApiDirectoryDoesNotExist(value) {
@@ -5538,12 +5471,12 @@ function validateApiDirectoryDoesNotExist(value) {
5538
5471
  }
5539
5472
  function ensurePlaycademyGitignore() {
5540
5473
  const workspace = getWorkspace();
5541
- const playcademyDir = join10(workspace, CLI_DIRECTORIES.WORKSPACE);
5474
+ const playcademyDir = join9(workspace, CLI_DIRECTORIES.WORKSPACE);
5542
5475
  if (!existsSync8(playcademyDir)) {
5543
5476
  mkdirSync3(playcademyDir, { recursive: true });
5544
5477
  }
5545
- const gitignorePath = join10(playcademyDir, ".gitignore");
5546
- writeFileSync4(gitignorePath, playcademyGitignoreTemplate);
5478
+ const gitignorePath = join9(playcademyDir, ".gitignore");
5479
+ writeFileSync3(gitignorePath, playcademyGitignoreTemplate);
5547
5480
  }
5548
5481
  async function scaffoldIntegrations(gameName, options) {
5549
5482
  const { customRoutes, database, kv, bucket } = options;
@@ -5565,12 +5498,7 @@ async function scaffoldIntegrations(gameName, options) {
5565
5498
  await scaffoldApiDirectory(customRoutes.directory, sampleRoutes);
5566
5499
  }
5567
5500
  if (database) {
5568
- const depsAdded = await scaffoldDatabaseSetup({ gameName });
5569
- await ensurePlaycademyTypes();
5570
- return depsAdded;
5571
- }
5572
- if (kv || bucket) {
5573
- await ensurePlaycademyTypes();
5501
+ return await scaffoldDatabaseSetup({ gameName });
5574
5502
  }
5575
5503
  return false;
5576
5504
  }
@@ -5795,6 +5723,71 @@ function displaySuccessMessage(context2) {
5795
5723
  logger.newLine();
5796
5724
  }
5797
5725
 
5726
+ // src/lib/init/types.ts
5727
+ init_file_loader();
5728
+ init_package_manager();
5729
+ init_constants2();
5730
+ init_loader();
5731
+ init_core();
5732
+ init_loader2();
5733
+ import { execSync as execSync3 } from "child_process";
5734
+ import { writeFileSync as writeFileSync4 } from "fs";
5735
+ import { dirname as dirname4, join as join10 } from "path";
5736
+ import { fileURLToPath as fileURLToPath2 } from "url";
5737
+ var playcademyEnvTemplate = loadTemplateString("playcademy-env.d.ts");
5738
+ async function ensurePlaycademyTypes(configPath) {
5739
+ try {
5740
+ const workspace = getWorkspace();
5741
+ const config = await loadConfig(configPath);
5742
+ const hasDB = hasDatabaseSetup();
5743
+ const hasKV = hasKVSetup(config);
5744
+ const hasBucket = hasBucketSetup(config);
5745
+ if (!hasDB && !hasKV && !hasBucket) {
5746
+ return;
5747
+ }
5748
+ const playcademyDir = join10(workspace, CLI_DIRECTORIES.WORKSPACE);
5749
+ const playcademyPkgPath = join10(playcademyDir, "package.json");
5750
+ const __dirname2 = dirname4(fileURLToPath2(import.meta.url));
5751
+ const cliPkg = await loadPackageJson({ cwd: __dirname2, searchUp: true, required: true });
5752
+ const workersTypesVersion = cliPkg?.devDependencies?.["@cloudflare/workers-types"] || "latest";
5753
+ const honoVersion = cliPkg?.dependencies?.hono || "latest";
5754
+ const playcademyPkg = {
5755
+ private: true,
5756
+ dependencies: {
5757
+ hono: honoVersion
5758
+ },
5759
+ devDependencies: {
5760
+ "@cloudflare/workers-types": workersTypesVersion
5761
+ }
5762
+ };
5763
+ writeFileSync4(playcademyPkgPath, JSON.stringify(playcademyPkg, null, 4) + "\n");
5764
+ const pm = detectPackageManager(workspace);
5765
+ const installCmd = getInstallCommand(pm);
5766
+ execSync3(installCmd, {
5767
+ cwd: playcademyDir,
5768
+ stdio: ["ignore", "ignore", "ignore"]
5769
+ });
5770
+ const bindings = [];
5771
+ if (hasKV) {
5772
+ bindings.push(" KV: KVNamespace");
5773
+ }
5774
+ if (hasDB) {
5775
+ bindings.push(" DB: D1Database");
5776
+ }
5777
+ if (hasBucket) {
5778
+ bindings.push(" BUCKET: R2Bucket");
5779
+ }
5780
+ const bindingsStr = bindings.length > 0 ? "\n" + bindings.join("\n") : "";
5781
+ const envContent = playcademyEnvTemplate.replace("{{BINDINGS}}", bindingsStr);
5782
+ const envPath = join10(workspace, "playcademy-env.d.ts");
5783
+ writeFileSync4(envPath, envContent);
5784
+ } catch (error) {
5785
+ logger.warn(
5786
+ `Failed to generate TypeScript types: ${error instanceof Error ? error.message : String(error)}`
5787
+ );
5788
+ }
5789
+ }
5790
+
5798
5791
  // src/lib/init/gitignore.ts
5799
5792
  init_core();
5800
5793
  init_loader2();
package/dist/utils.js CHANGED
@@ -1522,24 +1522,32 @@ function hasDatabaseSetup() {
1522
1522
  return existsSync6(drizzleConfigPath) || existsSync6(drizzleConfigJsPath);
1523
1523
  }
1524
1524
 
1525
- // src/lib/init/types.ts
1526
- init_file_loader();
1527
- import { execSync as execSync2 } from "child_process";
1528
- import { writeFileSync as writeFileSync3 } from "fs";
1529
- import { dirname as dirname4, join as join8 } from "path";
1530
- import { fileURLToPath as fileURLToPath2 } from "url";
1525
+ // src/lib/init/scaffold.ts
1526
+ var sampleCustomRouteTemplate = loadTemplateString("api/sample-custom.ts");
1527
+ var sampleDatabaseRouteTemplate = loadTemplateString("api/sample-database.ts");
1528
+ var sampleKvRouteTemplate = loadTemplateString("api/sample-kv.ts");
1529
+ var sampleBucketRouteTemplate = loadTemplateString("api/sample-bucket.ts");
1530
+ var playcademyGitignoreTemplate = loadTemplateString("playcademy-gitignore");
1531
1531
 
1532
- // src/lib/init/bucket.ts
1533
- function hasBucketSetup(config) {
1534
- return !!config.integrations?.bucket;
1535
- }
1532
+ // src/lib/init/display.ts
1533
+ import { blueBright } from "colorette";
1536
1534
 
1537
1535
  // src/lib/init/kv.ts
1538
1536
  function hasKVSetup(config) {
1539
1537
  return !!config.integrations?.kv;
1540
1538
  }
1541
1539
 
1540
+ // src/lib/init/bucket.ts
1541
+ function hasBucketSetup(config) {
1542
+ return !!config.integrations?.bucket;
1543
+ }
1544
+
1542
1545
  // src/lib/init/types.ts
1546
+ init_file_loader();
1547
+ import { execSync as execSync2 } from "child_process";
1548
+ import { writeFileSync as writeFileSync3 } from "fs";
1549
+ import { dirname as dirname4, join as join8 } from "path";
1550
+ import { fileURLToPath as fileURLToPath2 } from "url";
1543
1551
  var playcademyEnvTemplate = loadTemplateString("playcademy-env.d.ts");
1544
1552
  async function ensurePlaycademyTypes(configPath) {
1545
1553
  try {
@@ -1594,16 +1602,6 @@ async function ensurePlaycademyTypes(configPath) {
1594
1602
  }
1595
1603
  }
1596
1604
 
1597
- // src/lib/init/scaffold.ts
1598
- var sampleCustomRouteTemplate = loadTemplateString("api/sample-custom.ts");
1599
- var sampleDatabaseRouteTemplate = loadTemplateString("api/sample-database.ts");
1600
- var sampleKvRouteTemplate = loadTemplateString("api/sample-kv.ts");
1601
- var sampleBucketRouteTemplate = loadTemplateString("api/sample-bucket.ts");
1602
- var playcademyGitignoreTemplate = loadTemplateString("playcademy-gitignore");
1603
-
1604
- // src/lib/init/display.ts
1605
- import { blueBright } from "colorette";
1606
-
1607
1605
  // src/lib/init/gitignore.ts
1608
1606
  var rootGitignoreTemplate = loadTemplateString("gitignore");
1609
1607
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playcademy",
3
- "version": "0.13.13",
3
+ "version": "0.13.15",
4
4
  "type": "module",
5
5
  "module": "./dist/index.js",
6
6
  "main": "./dist/index.js",