mgpanel-cli 1.0.0
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/mgpanel.js +47 -0
- package/package.json +15 -0
package/bin/mgpanel.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const command = process.argv[2];
|
|
7
|
+
const projectName = process.argv[3] || 'mgpanel-project';
|
|
8
|
+
|
|
9
|
+
if (command !== 'init') {
|
|
10
|
+
console.log('❌ Comando no reconocido');
|
|
11
|
+
console.log('👉 Usa: mgpanel init nombre-proyecto');
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const projectPath = path.join(process.cwd(), projectName);
|
|
16
|
+
|
|
17
|
+
if (fs.existsSync(projectPath)) {
|
|
18
|
+
console.log('❌ La carpeta ya existe');
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
console.log('🚀 Creando proyecto MGPanel:', projectName);
|
|
23
|
+
|
|
24
|
+
// Crear carpetas
|
|
25
|
+
fs.mkdirSync(projectPath);
|
|
26
|
+
fs.mkdirSync(path.join(projectPath, 'modules'));
|
|
27
|
+
fs.mkdirSync(path.join(projectPath, 'assets'));
|
|
28
|
+
fs.mkdirSync(path.join(projectPath, 'assets/css'));
|
|
29
|
+
fs.mkdirSync(path.join(projectPath, 'assets/js'));
|
|
30
|
+
|
|
31
|
+
// Crear index.html
|
|
32
|
+
const indexHTML = `<!DOCTYPE html>
|
|
33
|
+
<html lang="es">
|
|
34
|
+
<head>
|
|
35
|
+
<meta charset="UTF-8">
|
|
36
|
+
<title>MGPanel</title>
|
|
37
|
+
</head>
|
|
38
|
+
<body>
|
|
39
|
+
<h1>Hola Mundo desde MGPanel 🚀</h1>
|
|
40
|
+
</body>
|
|
41
|
+
</html>
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
fs.writeFileSync(path.join(projectPath, 'index.html'), indexHTML);
|
|
45
|
+
|
|
46
|
+
console.log('✅ Proyecto creado correctamente');
|
|
47
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mgpanel-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MGPanel CLI",
|
|
5
|
+
"bin": {
|
|
6
|
+
"mgpanel": "./bin/mgpanel.js"
|
|
7
|
+
},
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC"
|
|
15
|
+
}
|