verde-sync 1.0.0 → 2.0.3

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/build.js CHANGED
@@ -8,7 +8,7 @@
8
8
  const fs = require('fs');
9
9
  const path = require('path');
10
10
 
11
- const SRC = path.join(__dirname, '..', 'plugin', 'src');
11
+ const SRC = path.join(__dirname, '..', 'plugin', 'Workspace', 'VerdePlugin');
12
12
  const OUT = path.join(__dirname, '..', 'plugin', 'SyncPlugin.lua');
13
13
 
14
14
  // Read all module files in dependency order
package/local-sync.js CHANGED
@@ -11,12 +11,9 @@ const {
11
11
  const app = express();
12
12
 
13
13
  // ---------------------------------------------------------------------------
14
- // Project root & config (Phase 2 - #4)
14
+ // Project root & config
15
15
  // ---------------------------------------------------------------------------
16
- const targetDirArg = process.argv[2]
17
- ? path.resolve(process.argv[2])
18
- : path.join(__dirname, '..', 'test_project');
19
- const PROJECT_ROOT = targetDirArg;
16
+ const PROJECT_ROOT = process.cwd();
20
17
 
21
18
  const projectConfig = loadProjectConfig(PROJECT_ROOT);
22
19
  const PORT = projectConfig.port || 34872;
@@ -194,10 +191,16 @@ app.get('/ping', (req, res) => {
194
191
  res.json({
195
192
  status: 'ok',
196
193
  project: projectConfig.name || path.basename(PROJECT_ROOT),
197
- version: '2.0.0',
194
+ version: '2.0.2',
198
195
  });
199
196
  });
200
197
 
198
+ app.post('/shutdown', (req, res) => {
199
+ res.json({ success: true });
200
+ logServer('Apagado solicitado por la extensión VS Code.');
201
+ setTimeout(() => shutdown('SIGTERM'), 100);
202
+ });
203
+
201
204
  app.get('/tree', (req, res) => {
202
205
  try {
203
206
  const tree = [];
@@ -394,7 +397,7 @@ process.on('SIGTERM', () => shutdown('SIGTERM'));
394
397
  // Start
395
398
  // ---------------------------------------------------------------------------
396
399
  function startServer() {
397
- app.listen(PORT, () => {
400
+ const server = app.listen(PORT, () => {
398
401
  console.log('');
399
402
  console.log(c.bold(c.green(' ╔══════════════════════════════════════════╗')));
400
403
  console.log(c.bold(c.green(' ║ 🌿 VERDE SYNC v2.0 🌿 ║')));
@@ -406,6 +409,17 @@ function startServer() {
406
409
  logServer(`Esperando conexión de Roblox Studio...`);
407
410
  console.log('');
408
411
  });
412
+
413
+ server.on('error', (e) => {
414
+ if (e.code === 'EADDRINUSE') {
415
+ logError(`El puerto ${PORT} ya está en uso. ¿Hay otro servidor de Verde ejecutándose?`);
416
+ logError(`Cierra el otro servidor o cambia el puerto en verde.project.json`);
417
+ process.exit(1);
418
+ } else {
419
+ logError(`Error fatal: ${e.message}`);
420
+ process.exit(1);
421
+ }
422
+ });
409
423
  }
410
424
 
411
425
  module.exports = { startServer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verde-sync",
3
- "version": "1.0.0",
3
+ "version": "2.0.3",
4
4
  "description": "Bidirectional sync tool between PC and Roblox Studio",
5
5
  "main": "local-sync.js",
6
6
  "bin": {