novatec-cli 1.0.1 → 1.0.2
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/index.js +2 -2
- package/lib/create.js +15 -16
- package/lib/utils.js +22 -9
- package/package.json +2 -2
package/bin/index.js
CHANGED
|
@@ -121,9 +121,9 @@ async function showBanner() {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
program
|
|
124
|
-
.name('novatec
|
|
124
|
+
.name('novatec')
|
|
125
125
|
.description('NOVATEC FULLSTACK CLI — Generador profesional de proyectos full stack')
|
|
126
|
-
.version('1.0.
|
|
126
|
+
.version('1.0.2', '-v, --version', 'Mostrar versión');
|
|
127
127
|
|
|
128
128
|
program
|
|
129
129
|
.command('create [name]')
|
package/lib/create.js
CHANGED
|
@@ -8,7 +8,6 @@ import { generateReadme } from './generators/readme.js';
|
|
|
8
8
|
import { run, isInstalled } from './utils.js';
|
|
9
9
|
|
|
10
10
|
const boxen = await import('boxen');
|
|
11
|
-
const gradient = await import('gradient-string');
|
|
12
11
|
|
|
13
12
|
async function runCreate(nameArg, options) {
|
|
14
13
|
const config = await askProjectOptions(nameArg, options);
|
|
@@ -41,7 +40,6 @@ async function runCreate(nameArg, options) {
|
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
// Resumen final
|
|
44
|
-
const novatecGradient = gradient.default(['#00C6FF', '#0072FF', '#7B2FF7']);
|
|
45
43
|
const backendCmd = {
|
|
46
44
|
express: 'npm run dev',
|
|
47
45
|
nestjs: 'npm run start:dev',
|
|
@@ -55,25 +53,26 @@ async function runCreate(nameArg, options) {
|
|
|
55
53
|
gin: 'go run main.go'
|
|
56
54
|
};
|
|
57
55
|
|
|
56
|
+
// Resumen final
|
|
58
57
|
console.log(
|
|
59
58
|
boxen.default(
|
|
60
|
-
|
|
61
|
-
chalk.
|
|
62
|
-
chalk.white('
|
|
63
|
-
chalk.white('
|
|
64
|
-
chalk.
|
|
65
|
-
chalk.
|
|
66
|
-
chalk.
|
|
67
|
-
chalk.white(
|
|
68
|
-
chalk.
|
|
69
|
-
chalk.
|
|
70
|
-
chalk.white(`
|
|
71
|
-
chalk.cyan(` ${backendCmd[config.backend] || 'npm start'}`),
|
|
59
|
+
chalk.bold.white(' ✔ PROYECTO CREADO EXITOSAMENTE\n\n') +
|
|
60
|
+
chalk.white(' Nombre ') + chalk.gray('│ ') + chalk.bold.white(config.name) + '\n' +
|
|
61
|
+
chalk.white(' Frontend ') + chalk.gray('│ ') + chalk.bold.white(config.frontend) + '\n' +
|
|
62
|
+
chalk.white(' Backend ') + chalk.gray('│ ') + chalk.bold.white(config.backend) + '\n\n' +
|
|
63
|
+
chalk.gray(' ─────────────────────────────────────────\n\n') +
|
|
64
|
+
chalk.white(' Iniciar Frontend\n') +
|
|
65
|
+
chalk.gray(` cd ${config.name}/frontend\n`) +
|
|
66
|
+
chalk.white(' npm run dev\n\n') +
|
|
67
|
+
chalk.white(' Iniciar Backend\n') +
|
|
68
|
+
chalk.gray(` cd ${config.name}/backend\n`) +
|
|
69
|
+
chalk.white(` ${backendCmd[config.backend] || 'npm start'}`),
|
|
72
70
|
{
|
|
73
71
|
padding: 1,
|
|
74
72
|
margin: { top: 1, left: 2 },
|
|
75
|
-
borderStyle: '
|
|
76
|
-
borderColor: '
|
|
73
|
+
borderStyle: 'round',
|
|
74
|
+
borderColor: 'white',
|
|
75
|
+
dimBorder: true,
|
|
77
76
|
}
|
|
78
77
|
)
|
|
79
78
|
);
|
package/lib/utils.js
CHANGED
|
@@ -8,33 +8,46 @@ export function isInstalled(cmd) {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export async function checkRequirements() {
|
|
11
|
-
const spinner = ora({
|
|
11
|
+
const spinner = ora({
|
|
12
|
+
text: chalk.white('Verificando entorno del sistema...'),
|
|
13
|
+
spinner: 'aesthetic',
|
|
14
|
+
color: 'white',
|
|
15
|
+
}).start();
|
|
16
|
+
|
|
12
17
|
const missing = [];
|
|
13
18
|
if (!isInstalled('node')) missing.push('Node.js');
|
|
14
19
|
if (!isInstalled('npm')) missing.push('npm');
|
|
20
|
+
|
|
15
21
|
if (missing.length) {
|
|
16
22
|
spinner.fail(chalk.red('Faltan herramientas: ' + missing.join(', ')));
|
|
17
23
|
throw new Error('Instala las herramientas faltantes y vuelve a intentarlo.');
|
|
18
24
|
}
|
|
25
|
+
|
|
19
26
|
const nodeVer = execSync('node --version', { encoding: 'utf8' }).trim();
|
|
20
27
|
const npmVer = execSync('npm --version', { encoding: 'utf8' }).trim();
|
|
28
|
+
|
|
21
29
|
spinner.succeed(
|
|
22
|
-
chalk.
|
|
23
|
-
chalk.gray('
|
|
24
|
-
chalk.
|
|
25
|
-
chalk.gray('│') +
|
|
26
|
-
chalk.cyan(` npm v${npmVer}`)
|
|
30
|
+
chalk.white('Entorno listo ') +
|
|
31
|
+
chalk.gray('· Node ') + chalk.bold.white(nodeVer) +
|
|
32
|
+
chalk.gray(' · npm ') + chalk.bold.white('v' + npmVer)
|
|
27
33
|
);
|
|
28
34
|
console.log();
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
export function run(cmd, cwd, label) {
|
|
32
|
-
const spinner = ora({
|
|
38
|
+
const spinner = ora({
|
|
39
|
+
text: chalk.white(label),
|
|
40
|
+
spinner: 'dots',
|
|
41
|
+
color: 'white',
|
|
42
|
+
}).start();
|
|
43
|
+
|
|
33
44
|
const result = spawnSync(cmd, { cwd, shell: true, stdio: 'pipe', encoding: 'utf8' });
|
|
45
|
+
|
|
34
46
|
if (result.status !== 0) {
|
|
35
|
-
spinner.fail(chalk.red(
|
|
47
|
+
spinner.fail(chalk.red('✖ ' + label));
|
|
36
48
|
const msg = result.stderr || result.stdout || 'Error desconocido';
|
|
37
49
|
throw new Error(msg.trim());
|
|
38
50
|
}
|
|
39
|
-
|
|
51
|
+
|
|
52
|
+
spinner.succeed(chalk.white('✔ ' + label));
|
|
40
53
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "novatec-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "🚀 NOVATEC FULLSTACK CLI — Generador profesional de proyectos full stack | React, Next.js, Vue, Express, NestJS, FastAPI y más",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/create.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"novatec
|
|
8
|
+
"novatec": "bin/index.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"start": "node ./bin/index.js create test-project",
|