hytopia 0.10.41 → 0.10.42

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/bin/scripts.js CHANGED
@@ -41,14 +41,14 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
41
41
  'init-mcp': initMcp,
42
42
  'package': packageProject,
43
43
  'start': start,
44
- 'update-hosts': checkHostsConfiguration,
44
+ 'update-hosts': () => checkHostsConfiguration(true),
45
45
  'upgrade-cli': () => upgradeCli(process.argv[3] || 'latest'),
46
46
  'upgrade-project': () => upgradeProject(process.argv[3] || 'latest'),
47
47
  'version': displayVersion,
48
48
  };
49
49
 
50
50
  // Check that hosts is properly configured
51
- checkHostsConfiguration();
51
+ checkHostsConfiguration(false);
52
52
 
53
53
  const handler = commandHandlers[command];
54
54
 
@@ -484,7 +484,7 @@ async function build(devMode = false) {
484
484
  /**
485
485
  * Checks the hosts files and makes sure that dev-local.hytopia.com points to localhost.
486
486
  */
487
- function checkHostsConfiguration() {
487
+ function checkHostsConfiguration(verbose = false) {
488
488
  const DOMAIN = 'dev-local.hytopia.com';
489
489
  const isWindows = process.platform === 'win32';
490
490
  const hostsPath = isWindows
@@ -495,7 +495,7 @@ function checkHostsConfiguration() {
495
495
  try {
496
496
  content = fs.existsSync(hostsPath) ? fs.readFileSync(hostsPath, 'utf8') : '';
497
497
  } catch {
498
- console.warn(`⚠️ Unable to check hosts configuration, if you're unable to connect and test your game, you may need to run this command using 'sudo hytopia'`);
498
+ console.warn(`⚠️ Unable to check hosts configuration. If you can connect to your local server you can ignore this. Otherwise, run 'sudo hytopia update-hosts' to fix this.`);
499
499
  return; // no read access; skip silently
500
500
  }
501
501
 
@@ -503,7 +503,10 @@ function checkHostsConfiguration() {
503
503
  const managedEnd = '# HYTOPIA DEV-LOCAL END';
504
504
 
505
505
  if (content.includes(managedBegin) && content.includes(managedEnd)) {
506
- console.log(`✅ Hosts already configured: ${DOMAIN} -> 127.0.0.1, ::1`);
506
+ if (verbose) {
507
+ console.log(`✅ Hosts already configured: ${DOMAIN} -> 127.0.0.1, ::1`);
508
+ }
509
+
507
510
  return; // already configured by us, skip
508
511
  }
509
512
 
@@ -522,7 +525,7 @@ function checkHostsConfiguration() {
522
525
  fs.writeFileSync(hostsPath, newContent, { encoding: 'utf8' });
523
526
  console.log(`✅ Hosts updated: ${DOMAIN} -> 127.0.0.1, ::1`);
524
527
  } catch {
525
- console.warn(`⚠️ Could not modify hosts file (${hostsPath}) to add the dev-local.hytopia.com. Please run this command using 'sudo hytopia', otherwise you may not be able to connect and test your game.`);
528
+ console.error(`⚠️ Could not modify hosts file (${hostsPath}) to add the dev-local.hytopia.com. Please run 'sudo hytopia update-hosts' to fix this.`);
526
529
  }
527
530
  }
528
531
 
@@ -662,7 +665,7 @@ function displayHelp() {
662
665
  console.log(' init [--template NAME] Initialize a new project');
663
666
  console.log(' init-mcp Setup MCP integrations');
664
667
  console.log(' package Create a zip of the project for uploading to the HYTOPIA create portal.');
665
- console.log(' update-hosts Update the hosts file to add the dev-local.hytopia.com domain');
668
+ console.log(' update-hosts Update the hosts file to add the dev-local.hytopia.com domain (MUST RUN WITH SUDO: sudo hytopia update-hosts)');
666
669
  console.log(' upgrade-cli Upgrade the HYTOPIA CLI');
667
670
  console.log(' upgrade-project [VERSION] Upgrade project SDK dep (default: latest)');
668
671
  console.log('');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.10.41",
3
+ "version": "0.10.42",
4
4
  "description": "The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./server.mjs",