hytopia 0.10.12-prerelease โ 0.10.12
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 +22 -44
- package/package.json +1 -1
- package/server.mjs +106 -106
package/bin/scripts.js
CHANGED
@@ -79,7 +79,7 @@ async function build() {
|
|
79
79
|
mainFields: ['module', 'main'],
|
80
80
|
conditions: ['import', 'node'],
|
81
81
|
banner: {
|
82
|
-
js: 'import { createRequire as __cr } from "module"; import { fileURLToPath } from "url"; import { dirname } from "path"; const require = __cr(import.meta.url); const __filename = fileURLToPath(import.meta.url); const __dirname =
|
82
|
+
js: 'import { createRequire as __cr } from "module"; import { fileURLToPath } from "url"; import { dirname as __bundlerDirname } from "path"; const require = __cr(import.meta.url); const __filename = fileURLToPath(import.meta.url); const __dirname = __bundlerDirname(__filename);'
|
83
83
|
}
|
84
84
|
});
|
85
85
|
}
|
@@ -433,55 +433,33 @@ async function packageProject() {
|
|
433
433
|
return;
|
434
434
|
}
|
435
435
|
|
436
|
-
//
|
437
|
-
|
438
|
-
|
436
|
+
// Build the project
|
437
|
+
await build();
|
438
|
+
|
439
|
+
// Test server startup & make sure optimizer has ran
|
440
|
+
console.log('๐งช Testing server startup and making sure optimizer has ran...');
|
439
441
|
|
440
|
-
|
441
|
-
// Function to recursively check for .optimized directories
|
442
|
-
const checkForOptimizedDir = (dir) => {
|
443
|
-
const items = fs.readdirSync(dir);
|
444
|
-
|
445
|
-
for (const item of items) {
|
446
|
-
const itemPath = path.join(dir, item);
|
447
|
-
const stats = fs.statSync(itemPath);
|
448
|
-
|
449
|
-
if (stats.isDirectory()) {
|
450
|
-
if (item === '.optimized') {
|
451
|
-
hasOptimizedDir = true;
|
452
|
-
return true;
|
453
|
-
}
|
454
|
-
|
455
|
-
// Check subdirectories
|
456
|
-
if (checkForOptimizedDir(itemPath)) {
|
457
|
-
return true;
|
458
|
-
}
|
459
|
-
}
|
460
|
-
}
|
461
|
-
|
462
|
-
return false;
|
463
|
-
};
|
464
|
-
|
465
|
-
checkForOptimizedDir(assetsDir);
|
466
|
-
|
467
|
-
if (!hasOptimizedDir) {
|
468
|
-
console.warn('โ Error: No .optimized directories found in the assets folder.');
|
469
|
-
console.warn(' Make sure your server has ran the optimizer for your models.');
|
470
|
-
console.warn(' This can be done by running your server with the command `hytopia dev`');
|
471
|
-
return;
|
472
|
-
}
|
473
|
-
} else {
|
474
|
-
console.warn('โ Error: No assets directory found in the project.');
|
475
|
-
return;
|
476
|
-
}
|
442
|
+
logDivider();
|
477
443
|
|
444
|
+
const child = spawn(process.execPath, ['--enable-source-maps', 'index.mjs'], { stdio: 'pipe' });
|
445
|
+
|
446
|
+
await new Promise(resolve => {
|
447
|
+
child.stdout.on('data', data => {
|
448
|
+
process.stdout.write(data);
|
449
|
+
|
450
|
+
if (data.toString().includes('Server running')) {
|
451
|
+
child.kill();
|
452
|
+
resolve();
|
453
|
+
}
|
454
|
+
});
|
455
|
+
});
|
456
|
+
|
457
|
+
logDivider();
|
458
|
+
|
478
459
|
// Prepare to package
|
479
460
|
const outputFile = path.join(sourceDir, `${projectName}.zip`);
|
480
461
|
|
481
462
|
console.log(`๐ฆ Packaging project "${projectName}"...`);
|
482
|
-
|
483
|
-
// Build the project
|
484
|
-
await build();
|
485
463
|
|
486
464
|
// Create a file to stream archive data to
|
487
465
|
const output = fs.createWriteStream(outputFile);
|
package/package.json
CHANGED