playcademy 0.16.9 → 0.16.10

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.16.8",
2968
+ version: "0.16.9",
2969
2969
  type: "module",
2970
2970
  exports: {
2971
2971
  ".": {
package/dist/index.js CHANGED
@@ -1357,6 +1357,26 @@ function ensureEnvironment(env) {
1357
1357
  }
1358
1358
  return getEnvironment();
1359
1359
  }
1360
+ function requireEnvironment(env, hostname) {
1361
+ if (env) {
1362
+ return ensureEnvironment(env);
1363
+ }
1364
+ const envVar = process.env.PLAYCADEMY_ENV;
1365
+ if (envVar) {
1366
+ return ensureEnvironment(envVar);
1367
+ }
1368
+ const example = hostname || "play.example.com";
1369
+ logger.error("Missing required --env flag");
1370
+ logger.newLine();
1371
+ logger.admonition("tip", "Usage", [
1372
+ `\`playcademy domain add ${example} --env production\``,
1373
+ `\`playcademy domain add ${example} --env staging\``,
1374
+ "",
1375
+ "Or set `PLAYCADEMY_ENV` in your environment."
1376
+ ]);
1377
+ logger.newLine();
1378
+ process.exit(1);
1379
+ }
1360
1380
  function getEnvironment() {
1361
1381
  const context2 = getCliContext();
1362
1382
  if (context2.environment) {
@@ -3996,7 +4016,7 @@ import { join as join12 } from "path";
3996
4016
  // package.json with { type: 'json' }
3997
4017
  var package_default2 = {
3998
4018
  name: "playcademy",
3999
- version: "0.16.8",
4019
+ version: "0.16.9",
4000
4020
  type: "module",
4001
4021
  exports: {
4002
4022
  ".": {
@@ -9967,6 +9987,13 @@ async function connectToLogStream(config) {
9967
9987
  const { url, slug, environment, json } = config;
9968
9988
  const ws = new WebSocket(url);
9969
9989
  ws.on("open", () => {
9990
+ if (json) {
9991
+ process.stderr.write(`Connected to ${environment} logs for "${slug}"
9992
+
9993
+ `);
9994
+ process.stderr.write(" Press ctrl+c to stop\n\n");
9995
+ return;
9996
+ }
9970
9997
  logger.success(`Connected to ${environment} logs for "${slug}"`);
9971
9998
  logger.newLine();
9972
9999
  logger.dim("Press ctrl+c to stop", 1);
@@ -9981,7 +10008,12 @@ async function connectToLogStream(config) {
9981
10008
  displayLogEntry(entry);
9982
10009
  }
9983
10010
  } catch {
9984
- logger.raw(data.toString());
10011
+ if (json) {
10012
+ process.stderr.write(`${data.toString()}
10013
+ `);
10014
+ } else {
10015
+ logger.raw(data.toString());
10016
+ }
9985
10017
  }
9986
10018
  });
9987
10019
  ws.on("error", (error) => {
@@ -10360,8 +10392,8 @@ function validateCustomHostname(hostname) {
10360
10392
  const labels = normalizedHostname.split(".");
10361
10393
  if (labels.length < 3) {
10362
10394
  return {
10363
- message: "Apex domains are not supported - you must use a subdomain",
10364
- suggestion: "Use a subdomain like game.example.com or play.example.com instead of example.com"
10395
+ message: "Apex domains are not supported \u2014 use a subdomain instead",
10396
+ suggestion: `Try <<play.${normalizedHostname}>> or <<game.${normalizedHostname}>>`
10365
10397
  };
10366
10398
  }
10367
10399
  const subdomain = labels[0];
@@ -11188,7 +11220,7 @@ var getStatusCommand = new Command13("status").description("Check your developer
11188
11220
  });
11189
11221
 
11190
11222
  // package.json
11191
- var version2 = "0.16.8";
11223
+ var version2 = "0.16.9";
11192
11224
 
11193
11225
  // src/commands/dev/server.ts
11194
11226
  function setupCleanupHandlers(workspace, getServer) {
@@ -14595,28 +14627,26 @@ async function runDomainAdd(hostname, options) {
14595
14627
  process.exit(1);
14596
14628
  }
14597
14629
  const normalizedHostname = hostname.trim().toLowerCase();
14598
- ensureEnvironment(options.env);
14630
+ requireEnvironment(options.env, normalizedHostname);
14599
14631
  await requireConfigFile();
14600
14632
  const config = await loadConfig();
14601
14633
  const slug = getSlugFromConfig(config);
14602
14634
  const client = await requireAuthenticatedClient();
14603
- logger.newLine();
14604
14635
  const domain = await runStep(
14605
14636
  "Adding custom domain",
14606
14637
  async () => {
14607
14638
  return client.dev.games.domains.add(slug, normalizedHostname);
14608
14639
  },
14609
- (domain2) => `Custom domain added: ${underline6(`<https://${domain2.hostname}>`)}`
14640
+ (domain2) => `Custom domain registered: ${underline6(domain2.hostname)} \u2014 configure DNS to activate`
14610
14641
  );
14611
14642
  logger.newLine();
14612
14643
  displayDomainValidationRecords(domain, normalizedHostname);
14613
- logger.newLine();
14614
14644
  logger.admonition("tip", "Next Steps", [
14615
14645
  "1. Add the DNS records shown above to your domain registrar",
14616
- `2. Run \`playcademy domain verify ${normalizedHostname}\` to check validation status`,
14646
+ `2. Run \`playcademy domain verify ${normalizedHostname} --env ${options.env}\` to check validation status`,
14617
14647
  "",
14618
- "Note: SSL certificate validation may take a few minutes to initialize.",
14619
- "Run verify command to see all required DNS records once SSL provisioning begins.",
14648
+ "Note: DNS propagation can take up to 24 hours. SSL certificates",
14649
+ "are provisioned automatically once DNS records are verified.",
14620
14650
  "",
14621
14651
  "Learn more: <<https://docs.playcademy.net/platform/cli/deployment#custom-domains>>"
14622
14652
  ]);
@@ -14635,7 +14665,7 @@ import { confirm as confirm16 } from "@inquirer/prompts";
14635
14665
  async function runDomainDelete(hostname, options) {
14636
14666
  try {
14637
14667
  logger.newLine();
14638
- ensureEnvironment(options.env);
14668
+ requireEnvironment(options.env, hostname);
14639
14669
  await requireConfigFile();
14640
14670
  const config = await loadConfig();
14641
14671
  const slug = getSlugFromConfig(config);
@@ -14660,7 +14690,6 @@ async function runDomainDelete(hostname, options) {
14660
14690
  }
14661
14691
  throw error;
14662
14692
  }
14663
- logger.newLine();
14664
14693
  logger.success(`Custom domain ${hostname} removed`);
14665
14694
  logger.newLine();
14666
14695
  } catch (error) {
@@ -14678,7 +14707,7 @@ async function runDomainList(options) {
14678
14707
  if (!options.raw && !options.json) {
14679
14708
  logger.newLine();
14680
14709
  }
14681
- ensureEnvironment(options.env);
14710
+ requireEnvironment(options.env);
14682
14711
  await requireConfigFile();
14683
14712
  const config = await loadConfig();
14684
14713
  const slug = getSlugFromConfig(config);
@@ -14696,12 +14725,11 @@ async function runDomainList(options) {
14696
14725
  logger.admonition("tip", "No Custom Domains", [
14697
14726
  `No custom domains configured for ${config.name}`,
14698
14727
  "",
14699
- `Run \`playcademy domain add my-domain.com\` to add a custom domain`
14728
+ "Run `playcademy domain add play.yourdomain.com --env production` to add one"
14700
14729
  ]);
14701
14730
  logger.newLine();
14702
14731
  return;
14703
14732
  }
14704
- logger.newLine();
14705
14733
  logger.table(
14706
14734
  domains.map((domain) => ({
14707
14735
  Hostname: domain.hostname,
@@ -14729,7 +14757,7 @@ async function runDomainVerify(hostname, options) {
14729
14757
  if (!options.json) {
14730
14758
  logger.newLine();
14731
14759
  }
14732
- ensureEnvironment(options.env);
14760
+ requireEnvironment(options.env, hostname);
14733
14761
  await requireConfigFile();
14734
14762
  const config = await loadConfig();
14735
14763
  const slug = getSlugFromConfig(config);
@@ -14755,9 +14783,7 @@ async function runDomainVerify(hostname, options) {
14755
14783
  logger.newLine();
14756
14784
  } else if (domain.status === "pending" || domain.status === "pending_validation" || domain.sslStatus === "pending_validation") {
14757
14785
  logger.admonition("tip", "Still Pending", [
14758
- "DNS records can take up to 24 hours to propagate.",
14759
- "",
14760
- `Run \`playcademy domain verify ${hostname}\` again to check status.`
14786
+ "DNS records can take up to 24 hours to propagate."
14761
14787
  ]);
14762
14788
  logger.newLine();
14763
14789
  }
@@ -14774,10 +14800,10 @@ async function runDomainVerify(hostname, options) {
14774
14800
 
14775
14801
  // src/commands/domain/index.ts
14776
14802
  var domainCommand = new Command22("domain").description("Custom domain management");
14777
- domainCommand.command("add <hostname>").description("Add a custom domain to your project").option("--env <env>", "Environment (staging or production)", "staging").action(runDomainAdd);
14778
- domainCommand.command("list").description("List custom domains for your project").option("--env <env>", "Environment (staging or production)", "staging").option("--json", "Output as JSON").option("--raw", "Output hostnames only").alias("ls").action(runDomainList);
14779
- domainCommand.command("verify <hostname>").description("Check custom domain validation status").option("--env <env>", "Environment (staging or production)", "staging").option("--json", "Output as JSON").option("--refresh", "Re-trigger domain validation", false).alias("status").action(runDomainVerify);
14780
- domainCommand.command("delete <hostname>").description("Remove a custom domain").option("--env <env>", "Environment (staging or production)", "staging").option("-f, --force", "Skip confirmation prompt").alias("rm").alias("remove").action(runDomainDelete);
14803
+ domainCommand.command("add <hostname>").description("Add a custom subdomain to your project (e.g., play.yourdomain.com)").option("--env <env>", "Target environment (staging or production)").action(runDomainAdd);
14804
+ domainCommand.command("list").description("List custom domains for your project").option("--env <env>", "Target environment (staging or production)").option("--json", "Output as JSON").option("--raw", "Output hostnames only").alias("ls").action(runDomainList);
14805
+ domainCommand.command("verify <hostname>").description("Check custom domain validation status").option("--env <env>", "Target environment (staging or production)").option("--json", "Output as JSON").option("--refresh", "Re-trigger domain validation", false).alias("status").action(runDomainVerify);
14806
+ domainCommand.command("delete <hostname>").description("Remove a custom domain").option("--env <env>", "Target environment (staging or production)").option("-f, --force", "Skip confirmation prompt").alias("rm").alias("remove").action(runDomainDelete);
14781
14807
 
14782
14808
  // src/commands/secret/index.ts
14783
14809
  import { Command as Command25 } from "commander";
@@ -15761,6 +15787,7 @@ export {
15761
15787
  requireAuthenticatedClient,
15762
15788
  requireConfigFile,
15763
15789
  requireDeveloperClient,
15790
+ requireEnvironment,
15764
15791
  resetDatabase,
15765
15792
  resolveSchemaStrategy,
15766
15793
  runInit,
package/dist/utils.js CHANGED
@@ -2358,7 +2358,7 @@ import { join as join12 } from "path";
2358
2358
  // package.json with { type: 'json' }
2359
2359
  var package_default2 = {
2360
2360
  name: "playcademy",
2361
- version: "0.16.8",
2361
+ version: "0.16.9",
2362
2362
  type: "module",
2363
2363
  exports: {
2364
2364
  ".": {
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.16.8",
4
+ version: "0.16.9",
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.16.9",
3
+ "version": "0.16.10",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@inquirer/prompts": "^7.8.6",
53
- "@playcademy/sdk": "0.2.12",
53
+ "@playcademy/sdk": "0.2.13",
54
54
  "chokidar": "^4.0.3",
55
55
  "colorette": "^2.0.20",
56
56
  "commander": "^14.0.1",