playcademy 0.15.1 → 0.15.3-alpha.1

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
@@ -2317,16 +2317,23 @@ function displaySuccessMessage(context2) {
2317
2317
  const stepNum = nextSteps.length + 1;
2318
2318
  nextSteps.push(`${stepNum}. Customize API routes: <${context2.apiDirectory}>`);
2319
2319
  }
2320
- if (context2.timebackConfig) {
2321
- const stepNum = nextSteps.length + 1;
2322
- nextSteps.push(`${stepNum}. Set up TimeBack: \`playcademy timeback setup\``);
2323
- }
2324
2320
  const deployStep = nextSteps.length + 1;
2325
2321
  nextSteps.push(`${deployStep}. Deploy: \`playcademy deploy\``);
2326
2322
  nextSteps.push("");
2327
2323
  nextSteps.push(`Learn more: <<${DOCS_URL}>>`);
2328
2324
  logger.admonition("tip", "Next Steps", nextSteps);
2329
2325
  logger.newLine();
2326
+ if (context2.timebackConfig) {
2327
+ logger.admonition("note", "TimeBack Integration", [
2328
+ "Your config file is configured for TimeBack integration",
2329
+ "",
2330
+ " \u2192 Run `playcademy timeback setup` to create resources",
2331
+ " \u2192 Then verify with `playcademy timeback verify`",
2332
+ "",
2333
+ "Learn more: <<https://docs.playcademy.net/timeback>>"
2334
+ ]);
2335
+ logger.newLine();
2336
+ }
2330
2337
  }
2331
2338
 
2332
2339
  // src/lib/init/engine/fetch.ts
@@ -2958,7 +2965,7 @@ import { join as join13 } from "path";
2958
2965
  // package.json with { type: 'json' }
2959
2966
  var package_default2 = {
2960
2967
  name: "playcademy",
2961
- version: "0.15.0",
2968
+ version: "0.15.3",
2962
2969
  type: "module",
2963
2970
  exports: {
2964
2971
  ".": {
package/dist/index.js CHANGED
@@ -3194,7 +3194,7 @@ function derivePlatformTimebackSetupRequest(config) {
3194
3194
  prerequisites: [],
3195
3195
  prerequisiteCriteria: RESOURCE_DEFAULTS.component.prerequisiteCriteria
3196
3196
  };
3197
- const envName = process.env.PLAYCADEMY_ENVIRONMENT === "staging" ? "staging" : "production";
3197
+ const envName = getEnvironment();
3198
3198
  const platformUrl = PLAYCADEMY_DEFAULTS.launchBaseUrls[envName];
3199
3199
  const defaultLaunchUrl = `${platformUrl}/play/${appSlug}`;
3200
3200
  const defaultResource = {
@@ -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.0",
3975
+ version: "0.15.3",
3964
3976
  type: "module",
3965
3977
  exports: {
3966
3978
  ".": {
@@ -4455,9 +4467,8 @@ function displayConfigSuccess(timebackConfig) {
4455
4467
  if (timebackConfig) {
4456
4468
  logger.admonition("note", "TimeBack Integration", [
4457
4469
  "Your config file is configured for TimeBack integration",
4458
- "Before deploying, you must set up the TimeBack resources:",
4459
4470
  "",
4460
- " \u2192 Run `playcademy timeback setup`",
4471
+ " \u2192 Run `playcademy timeback setup` to create resources",
4461
4472
  " \u2192 Then verify with `playcademy timeback verify`",
4462
4473
  "",
4463
4474
  "Learn more: <<https://docs.playcademy.net/timeback>>"
@@ -4494,16 +4505,23 @@ function displaySuccessMessage(context2) {
4494
4505
  const stepNum = nextSteps.length + 1;
4495
4506
  nextSteps.push(`${stepNum}. Customize API routes: <${context2.apiDirectory}>`);
4496
4507
  }
4497
- if (context2.timebackConfig) {
4498
- const stepNum = nextSteps.length + 1;
4499
- nextSteps.push(`${stepNum}. Set up TimeBack: \`playcademy timeback setup\``);
4500
- }
4501
4508
  const deployStep = nextSteps.length + 1;
4502
4509
  nextSteps.push(`${deployStep}. Deploy: \`playcademy deploy\``);
4503
4510
  nextSteps.push("");
4504
4511
  nextSteps.push(`Learn more: <<${DOCS_URL}>>`);
4505
4512
  logger.admonition("tip", "Next Steps", nextSteps);
4506
4513
  logger.newLine();
4514
+ if (context2.timebackConfig) {
4515
+ logger.admonition("note", "TimeBack Integration", [
4516
+ "Your config file is configured for TimeBack integration",
4517
+ "",
4518
+ " \u2192 Run `playcademy timeback setup` to create resources",
4519
+ " \u2192 Then verify with `playcademy timeback verify`",
4520
+ "",
4521
+ "Learn more: <<https://docs.playcademy.net/timeback>>"
4522
+ ]);
4523
+ logger.newLine();
4524
+ }
4507
4525
  }
4508
4526
 
4509
4527
  // src/lib/init/kv.ts
@@ -10603,7 +10621,7 @@ var getStatusCommand = new Command13("status").description("Check your developer
10603
10621
  });
10604
10622
 
10605
10623
  // package.json
10606
- var version2 = "0.15.0";
10624
+ var version2 = "0.15.3";
10607
10625
 
10608
10626
  // src/commands/dev/server.ts
10609
10627
  function setupCleanupHandlers(workspace, getServer) {
@@ -11129,7 +11147,7 @@ async function runDbResetRemote(options) {
11129
11147
  logger.newLine();
11130
11148
  process.exit(1);
11131
11149
  }
11132
- const game = await client.games.fetch(deployedGame.gameId);
11150
+ const game = await getGameById(client, deployedGame.gameId);
11133
11151
  logger.newLine();
11134
11152
  logger.admonition("warning", "DESTRUCTIVE OPERATION", [
11135
11153
  `Are you sure you want to ${redBright4(underline3(bold13("DELETE ALL DATA")))} in your ${environment} database?`,
@@ -11340,7 +11358,7 @@ async function runDbSeedRemote(seedFile, options) {
11340
11358
  logger.newLine();
11341
11359
  process.exit(1);
11342
11360
  }
11343
- const game = await client.games.fetch(deployedGame.gameId);
11361
+ const game = await getGameById(client, deployedGame.gameId);
11344
11362
  const willReset = options.reset !== false;
11345
11363
  logger.newLine();
11346
11364
  if (willReset) {
@@ -12556,7 +12574,7 @@ async function runBucketBulkRemote(directory, options) {
12556
12574
  outputDryRunResults(files, totalSize, options.prefix, options.json, options.raw);
12557
12575
  return;
12558
12576
  }
12559
- const game = await client.games.fetch(deployedGame.gameId);
12577
+ const game = await getGameById(client, deployedGame.gameId);
12560
12578
  const uploaded = await uploadFilesRemote(
12561
12579
  files,
12562
12580
  game.slug,
@@ -12685,7 +12703,7 @@ async function runBucketDeleteRemote(key, options) {
12685
12703
  }
12686
12704
  process.exit(1);
12687
12705
  }
12688
- const game = await client.games.fetch(deployedGame.gameId);
12706
+ const game = await getGameById(client, deployedGame.gameId);
12689
12707
  await client.dev.games.bucket.delete(game.slug, key);
12690
12708
  if (options.json) {
12691
12709
  logger.json({
@@ -12804,7 +12822,7 @@ async function runBucketGetRemote(key, options) {
12804
12822
  }
12805
12823
  process.exit(1);
12806
12824
  }
12807
- const game = await client.games.fetch(deployedGame.gameId);
12825
+ const game = await getGameById(client, deployedGame.gameId);
12808
12826
  let arrayBuffer;
12809
12827
  try {
12810
12828
  arrayBuffer = await client.dev.games.bucket.get(game.slug, key);
@@ -13054,7 +13072,7 @@ async function runBucketListRemote(options) {
13054
13072
  }
13055
13073
  process.exit(1);
13056
13074
  }
13057
- const game = await client.games.fetch(deployedGame.gameId);
13075
+ const game = await getGameById(client, deployedGame.gameId);
13058
13076
  const files = await client.dev.games.bucket.list(game.slug, options.prefix);
13059
13077
  if (options.json) {
13060
13078
  logger.json(files);
@@ -13219,7 +13237,7 @@ async function runBucketPutRemote(key, filePath, options) {
13219
13237
  }
13220
13238
  process.exit(1);
13221
13239
  }
13222
- const game = await client.games.fetch(deployedGame.gameId);
13240
+ const game = await getGameById(client, deployedGame.gameId);
13223
13241
  const contentType = getContentType(filePath);
13224
13242
  await client.dev.games.bucket.put(game.slug, key, fileBuffer, contentType);
13225
13243
  if (options.json) {
@@ -13986,8 +14004,7 @@ var initCommand2 = new Command33("init").description("Add TimeBack integration t
13986
14004
  logger.success("TimeBack integration added!");
13987
14005
  logger.newLine();
13988
14006
  logger.admonition("tip", "Next Steps", [
13989
- "1. Set up TimeBack resources: `playcademy timeback setup`",
13990
- "2. Deploy your project: `playcademy deploy`",
14007
+ "Set up TimeBack resources: `playcademy timeback setup`",
13991
14008
  "",
13992
14009
  "Learn more: <<https://docs.playcademy.net/timeback>>"
13993
14010
  ]);
@@ -14072,8 +14089,7 @@ var setupCommand = new Command34("setup").description("Set up TimeBack integrati
14072
14089
  logger.newLine();
14073
14090
  }
14074
14091
  logger.admonition("tip", "Next Steps", [
14075
- "1. Run `playcademy timeback verify` to verify the setup",
14076
- "2. Deploy your project with `playcademy deploy`",
14092
+ "Run `playcademy timeback verify` to verify the setup",
14077
14093
  "",
14078
14094
  "Learn more: <<https://docs.playcademy.net/timeback>>"
14079
14095
  ]);
@@ -14466,6 +14482,7 @@ export {
14466
14482
  getEnvironment,
14467
14483
  getErrorMessage,
14468
14484
  getFrameworksForEngine,
14485
+ getGameById,
14469
14486
  getGameFromConfig,
14470
14487
  getGamesStorePath,
14471
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.0",
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.0",
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.1",
3
+ "version": "0.15.3-alpha.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {