playcademy 0.15.3 → 0.15.4

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/cli.js CHANGED
@@ -2965,7 +2965,7 @@ import { join as join13 } from "path";
2965
2965
  // package.json with { type: 'json' }
2966
2966
  var package_default2 = {
2967
2967
  name: "playcademy",
2968
- version: "0.15.2",
2968
+ version: "0.15.3",
2969
2969
  type: "module",
2970
2970
  exports: {
2971
2971
  ".": {
package/dist/index.js CHANGED
@@ -3610,17 +3610,15 @@ ${indent(level)}integrations: {`];
3610
3610
  function getSlugFromConfig(config) {
3611
3611
  return generateSlug(config.name);
3612
3612
  }
3613
+ async function getGameBySlug(client, slug) {
3614
+ const games2 = await client.games.list();
3615
+ return games2.find((g) => g.slug === slug) ?? null;
3616
+ }
3613
3617
  async function ensureGameExists(client, config) {
3614
3618
  const slug = getSlugFromConfig(config);
3615
3619
  let game = await runStep(
3616
3620
  `Checking for app "${slug}"`,
3617
- async () => {
3618
- try {
3619
- return await client.games.fetch(slug);
3620
- } catch {
3621
- return null;
3622
- }
3623
- },
3621
+ () => getGameBySlug(client, slug),
3624
3622
  (result) => result ? "Found existing app" : "App not found"
3625
3623
  );
3626
3624
  if (!game) {
@@ -3649,16 +3647,30 @@ async function getGameFromConfig(client) {
3649
3647
  const game = await runStep(
3650
3648
  `Finding app "${slug}"`,
3651
3649
  async () => {
3652
- try {
3653
- return await client.games.fetch(slug);
3654
- } catch {
3650
+ const found = await getGameBySlug(client, slug);
3651
+ if (!found) {
3655
3652
  throw new Error(`App "${slug}" not found`);
3656
3653
  }
3654
+ return found;
3657
3655
  },
3658
3656
  "App found"
3659
3657
  );
3660
3658
  return { game, config };
3661
3659
  }
3660
+ async function getGameById(client, gameId, options) {
3661
+ const games2 = await client.games.list();
3662
+ const game = games2.find((g) => g.id === gameId);
3663
+ if (!game) {
3664
+ if (options?.noExit) {
3665
+ return null;
3666
+ }
3667
+ logger.newLine();
3668
+ logger.admonition("warning", "Game Not Found", [`Could not find game with ID: ${gameId}`]);
3669
+ logger.newLine();
3670
+ process.exit(1);
3671
+ }
3672
+ return game;
3673
+ }
3662
3674
 
3663
3675
  // src/lib/core/gitignore.ts
3664
3676
  import { existsSync as existsSync6, readFileSync as readFileSync3 } from "fs";
@@ -3960,7 +3972,7 @@ import { join as join12 } from "path";
3960
3972
  // package.json with { type: 'json' }
3961
3973
  var package_default2 = {
3962
3974
  name: "playcademy",
3963
- version: "0.15.2",
3975
+ version: "0.15.3",
3964
3976
  type: "module",
3965
3977
  exports: {
3966
3978
  ".": {
@@ -10609,7 +10621,7 @@ var getStatusCommand = new Command13("status").description("Check your developer
10609
10621
  });
10610
10622
 
10611
10623
  // package.json
10612
- var version2 = "0.15.2";
10624
+ var version2 = "0.15.3";
10613
10625
 
10614
10626
  // src/commands/dev/server.ts
10615
10627
  function setupCleanupHandlers(workspace, getServer) {
@@ -11135,7 +11147,7 @@ async function runDbResetRemote(options) {
11135
11147
  logger.newLine();
11136
11148
  process.exit(1);
11137
11149
  }
11138
- const game = await client.games.fetch(deployedGame.gameId);
11150
+ const game = await getGameById(client, deployedGame.gameId);
11139
11151
  logger.newLine();
11140
11152
  logger.admonition("warning", "DESTRUCTIVE OPERATION", [
11141
11153
  `Are you sure you want to ${redBright4(underline3(bold13("DELETE ALL DATA")))} in your ${environment} database?`,
@@ -11346,7 +11358,7 @@ async function runDbSeedRemote(seedFile, options) {
11346
11358
  logger.newLine();
11347
11359
  process.exit(1);
11348
11360
  }
11349
- const game = await client.games.fetch(deployedGame.gameId);
11361
+ const game = await getGameById(client, deployedGame.gameId);
11350
11362
  const willReset = options.reset !== false;
11351
11363
  logger.newLine();
11352
11364
  if (willReset) {
@@ -12562,7 +12574,7 @@ async function runBucketBulkRemote(directory, options) {
12562
12574
  outputDryRunResults(files, totalSize, options.prefix, options.json, options.raw);
12563
12575
  return;
12564
12576
  }
12565
- const game = await client.games.fetch(deployedGame.gameId);
12577
+ const game = await getGameById(client, deployedGame.gameId);
12566
12578
  const uploaded = await uploadFilesRemote(
12567
12579
  files,
12568
12580
  game.slug,
@@ -12691,7 +12703,7 @@ async function runBucketDeleteRemote(key, options) {
12691
12703
  }
12692
12704
  process.exit(1);
12693
12705
  }
12694
- const game = await client.games.fetch(deployedGame.gameId);
12706
+ const game = await getGameById(client, deployedGame.gameId);
12695
12707
  await client.dev.games.bucket.delete(game.slug, key);
12696
12708
  if (options.json) {
12697
12709
  logger.json({
@@ -12810,7 +12822,7 @@ async function runBucketGetRemote(key, options) {
12810
12822
  }
12811
12823
  process.exit(1);
12812
12824
  }
12813
- const game = await client.games.fetch(deployedGame.gameId);
12825
+ const game = await getGameById(client, deployedGame.gameId);
12814
12826
  let arrayBuffer;
12815
12827
  try {
12816
12828
  arrayBuffer = await client.dev.games.bucket.get(game.slug, key);
@@ -13060,7 +13072,7 @@ async function runBucketListRemote(options) {
13060
13072
  }
13061
13073
  process.exit(1);
13062
13074
  }
13063
- const game = await client.games.fetch(deployedGame.gameId);
13075
+ const game = await getGameById(client, deployedGame.gameId);
13064
13076
  const files = await client.dev.games.bucket.list(game.slug, options.prefix);
13065
13077
  if (options.json) {
13066
13078
  logger.json(files);
@@ -13225,7 +13237,7 @@ async function runBucketPutRemote(key, filePath, options) {
13225
13237
  }
13226
13238
  process.exit(1);
13227
13239
  }
13228
- const game = await client.games.fetch(deployedGame.gameId);
13240
+ const game = await getGameById(client, deployedGame.gameId);
13229
13241
  const contentType = getContentType(filePath);
13230
13242
  await client.dev.games.bucket.put(game.slug, key, fileBuffer, contentType);
13231
13243
  if (options.json) {
@@ -14470,6 +14482,7 @@ export {
14470
14482
  getEnvironment,
14471
14483
  getErrorMessage,
14472
14484
  getFrameworksForEngine,
14485
+ getGameById,
14473
14486
  getGameFromConfig,
14474
14487
  getGamesStorePath,
14475
14488
  getIntegrationKeys,
package/dist/utils.js CHANGED
@@ -2321,7 +2321,7 @@ import { join as join12 } from "path";
2321
2321
  // package.json with { type: 'json' }
2322
2322
  var package_default2 = {
2323
2323
  name: "playcademy",
2324
- version: "0.15.2",
2324
+ version: "0.15.3",
2325
2325
  type: "module",
2326
2326
  exports: {
2327
2327
  ".": {
package/dist/version.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // package.json with { type: 'json' }
2
2
  var package_default = {
3
3
  name: "playcademy",
4
- version: "0.15.2",
4
+ version: "0.15.3",
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.15.3",
3
+ "version": "0.15.4",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {