vako 1.3.12 → 1.3.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/vako.js +38 -6
- package/package.json +1 -1
package/bin/vako.js
CHANGED
|
@@ -21,7 +21,7 @@ const program = new Command();
|
|
|
21
21
|
program
|
|
22
22
|
.name('vako')
|
|
23
23
|
.description('Vako Framework CLI')
|
|
24
|
-
.version('1.3.
|
|
24
|
+
.version('1.3.13');
|
|
25
25
|
|
|
26
26
|
// ============= DEV COMMAND =============
|
|
27
27
|
program
|
|
@@ -32,15 +32,47 @@ program
|
|
|
32
32
|
.option('-w, --watch <dirs>', 'Watch directories', 'views,routes,public')
|
|
33
33
|
.action(async (options) => {
|
|
34
34
|
try {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
const { App } = require('../index');
|
|
36
|
+
const path = require('path');
|
|
37
|
+
const fs = require('fs');
|
|
38
|
+
|
|
39
|
+
// Vérifier si le fichier d'entrée existe
|
|
40
|
+
const entryFile = path.resolve(process.cwd(), options.file);
|
|
41
|
+
if (fs.existsSync(entryFile)) {
|
|
42
|
+
// Charger le fichier d'entrée de l'utilisateur s'il existe
|
|
43
|
+
try {
|
|
44
|
+
require(entryFile);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.warn(chalk.yellow(`⚠️ Warning: Could not load ${options.file}: ${err.message}`));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Créer l'application en mode développement
|
|
51
|
+
const port = parseInt(options.port);
|
|
52
|
+
const wsPort = port + 8;
|
|
53
|
+
|
|
54
|
+
const app = new App({
|
|
55
|
+
port: port,
|
|
56
|
+
wsPort: wsPort,
|
|
57
|
+
isDev: true,
|
|
58
|
+
watchDirs: options.watch.split(',').map(dir => dir.trim()),
|
|
59
|
+
routesDir: 'routes',
|
|
60
|
+
viewsDir: 'views',
|
|
61
|
+
staticDir: 'public'
|
|
39
62
|
});
|
|
40
63
|
|
|
41
|
-
|
|
64
|
+
// Utiliser la méthode startDev qui configure automatiquement le devServer
|
|
65
|
+
app.startDev(port);
|
|
66
|
+
|
|
67
|
+
console.log(chalk.green(`\n🚀 Vako dev server running on http://localhost:${port}`));
|
|
68
|
+
console.log(chalk.cyan(`📡 WebSocket server on ws://localhost:${wsPort}`));
|
|
69
|
+
console.log(chalk.gray(`\n👀 Watching: ${options.watch}\n`));
|
|
70
|
+
|
|
42
71
|
} catch (error) {
|
|
43
72
|
console.error(chalk.red('❌ Error starting dev server:'), error.message);
|
|
73
|
+
if (error.stack) {
|
|
74
|
+
console.error(chalk.gray(error.stack));
|
|
75
|
+
}
|
|
44
76
|
process.exit(1);
|
|
45
77
|
}
|
|
46
78
|
});
|
package/package.json
CHANGED