forked from SE-JE/venida
-
Notifications
You must be signed in to change notification settings - Fork 0
/
venida.ts
executable file
·51 lines (36 loc) · 1.14 KB
/
venida.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* Venida Platform
* Free Open Source Software
* SEJE - Digital
*/
console.log('init Venida Platform');
global.Venida = require('./system/Core/Core');
Venida.setPath(__dirname);
/**
* Load Configuration
*/
Venida.define('Config', Venida.class('Venida.config.config'));
Venida.define('RouterConfig', Venida.class('Venida.config.router'));
Venida.define('DatabaseConfig', Venida.class('Venida.config.database'));
/**
* Initial Venida Utils
*/
Venida.define('Utils', Venida.class('Venida.config.util'));
// get first argument
let firstArgument = process.argv[2];
// Assign serve to firstArgument if argument is not set
if (!firstArgument) {
firstArgument = 'list';
}
// replace : with space
firstArgument = firstArgument.split(':').join(' ');
// capitalize first letter
firstArgument = firstArgument.toLowerCase().replace(/\b[a-z]/g, function (letter) {
return letter.toUpperCase();
});
// replace space with :
firstArgument = firstArgument.split(' ').join('.');
// check if command is exist
if (Venida.exist(`Venida.App.Console.${firstArgument}`)) {
Venida.command(`Venida.App.Console.${firstArgument}`, process.argv, false, true);
}