hytopia 0.10.0-prerelease-11 → 0.10.0-prerelease-13
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 +26 -16
- package/package.json +1 -1
- package/server.mjs +2 -2
package/bin/scripts.js
CHANGED
@@ -43,8 +43,8 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
43
43
|
'init-mcp': initMcp,
|
44
44
|
'package': packageProject,
|
45
45
|
'start': start,
|
46
|
-
'upgrade-cli': upgradeCli,
|
47
|
-
'upgrade-project': upgradeProject,
|
46
|
+
'upgrade-cli': () => upgradeCli(process.argv[3] || 'latest'),
|
47
|
+
'upgrade-project': () => upgradeProject(process.argv[3] || 'latest'),
|
48
48
|
'version': displayVersion,
|
49
49
|
};
|
50
50
|
|
@@ -69,8 +69,8 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
69
69
|
* @example
|
70
70
|
*/
|
71
71
|
async function build() {
|
72
|
-
logDivider();
|
73
72
|
console.log('🔧 Building project...');
|
73
|
+
|
74
74
|
await esbuild.build({
|
75
75
|
entryPoints: ['index.ts'],
|
76
76
|
outfile: './index.mjs',
|
@@ -89,6 +89,7 @@ async function build() {
|
|
89
89
|
function start() {
|
90
90
|
(async () => {
|
91
91
|
let child = null;
|
92
|
+
let restartTimer = null;
|
92
93
|
|
93
94
|
const stopNode = () => {
|
94
95
|
if (child && !child.killed) {
|
@@ -96,9 +97,9 @@ function start() {
|
|
96
97
|
}
|
97
98
|
};
|
98
99
|
|
99
|
-
const
|
100
|
+
const restartNode = () => {
|
100
101
|
stopNode();
|
101
|
-
child = spawn(process.execPath, ['--
|
102
|
+
child = spawn(process.execPath, ['--enable-source-maps', 'index.mjs'], { stdio: 'inherit', shell: false });
|
102
103
|
};
|
103
104
|
|
104
105
|
const ctx = await esbuild.context({
|
@@ -109,15 +110,24 @@ function start() {
|
|
109
110
|
platform: 'node',
|
110
111
|
target: 'node24',
|
111
112
|
sourcemap: 'inline',
|
113
|
+
plugins: [{
|
114
|
+
name: 'restart-after-build',
|
115
|
+
setup(build) {
|
116
|
+
build.onStart(() => {
|
117
|
+
if (restartTimer) { clearTimeout(restartTimer); restartTimer = null; }
|
118
|
+
});
|
119
|
+
build.onEnd((result) => {
|
120
|
+
if (result.errors?.length) return;
|
121
|
+
restartTimer = setTimeout(restartNode, 150);
|
122
|
+
});
|
123
|
+
}
|
124
|
+
}]
|
112
125
|
});
|
113
126
|
|
114
|
-
// Start watching (per esbuild, this performs an initial build before resolving)
|
115
127
|
await ctx.watch();
|
116
128
|
|
117
|
-
// Run node with native --watch to auto-restart on output changes
|
118
|
-
spawnNode();
|
119
|
-
|
120
129
|
const cleanup = async () => {
|
130
|
+
if (restartTimer) clearTimeout(restartTimer);
|
121
131
|
stopNode();
|
122
132
|
try { await ctx.dispose(); } catch {}
|
123
133
|
process.exit(0);
|
@@ -650,16 +660,16 @@ async function fetchLatestVersion(signal) {
|
|
650
660
|
}
|
651
661
|
}
|
652
662
|
|
653
|
-
function upgradeCli() {
|
654
|
-
const
|
655
|
-
console.log(`🔄 Upgrading HYTOPIA CLI to: hytopia@${
|
656
|
-
execSync(`npm install -g --force hytopia@${
|
663
|
+
function upgradeCli(versionArg = 'latest') {
|
664
|
+
const version = versionArg.trim();
|
665
|
+
console.log(`🔄 Upgrading HYTOPIA CLI to: hytopia@${version} ...`);
|
666
|
+
execSync(`npm install -g --force hytopia@${version}`, { stdio: 'inherit' });
|
657
667
|
console.log('✅ Upgrade complete. You may need to restart your shell for changes to take effect.');
|
658
668
|
}
|
659
669
|
|
660
|
-
function upgradeProject() {
|
661
|
-
const
|
662
|
-
const spec = `hytopia@${
|
670
|
+
function upgradeProject(versionArg = 'latest') {
|
671
|
+
const version = versionArg.trim();
|
672
|
+
const spec = `hytopia@${version}`;
|
663
673
|
console.log(`🔄 Upgrading project HYTOPIA SDK to: ${spec} ...`);
|
664
674
|
execSync(`npm install --force ${spec}`, { stdio: 'inherit' });
|
665
675
|
console.log('✅ Project dependency upgraded.');
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "hytopia",
|
3
|
-
"version": "0.10.0-prerelease-
|
3
|
+
"version": "0.10.0-prerelease-13",
|
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",
|