@devquest/cli 1.0.4 → 1.0.6

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.
@@ -11,6 +11,7 @@ const path_1 = __importDefault(require("path"));
11
11
  const chalk_1 = __importDefault(require("chalk"));
12
12
  const axios_1 = __importDefault(require("axios"));
13
13
  const auth_1 = require("./auth");
14
+ const child_process_1 = require("child_process");
14
15
  const env_1 = require("../utils/env");
15
16
  exports.cloneCommand = new commander_1.Command('clone')
16
17
  .argument('<id>', 'ID do desafio (ex: build-your-own-redis)')
@@ -81,6 +82,18 @@ exports.cloneCommand = new commander_1.Command('clone')
81
82
  const git = (0, simple_git_1.default)();
82
83
  await git.clone(finalUrl, destPath);
83
84
  }
85
+ // 3. Instalar dependências se houver um package.json
86
+ if (fs_1.default.existsSync(path_1.default.join(destPath, 'package.json'))) {
87
+ console.log(chalk_1.default.gray(`\n📦 Instalando dependências...`));
88
+ try {
89
+ // Usamos stdio: 'inherit' para mostrar o progresso para o usuário
90
+ (0, child_process_1.execSync)('npm install', { cwd: destPath, stdio: 'inherit' });
91
+ console.log(chalk_1.default.green(`✅ Dependências instaladas com sucesso.`));
92
+ }
93
+ catch (e) {
94
+ console.log(chalk_1.default.yellow(`\n⚠️ Aviso: Não foi possível instalar as dependências automaticamente. Tente rodar 'npm install' manualmente.`));
95
+ }
96
+ }
84
97
  console.log(chalk_1.default.green(`✅ Desafio clonado com sucesso em ./${targetFolderName}`));
85
98
  console.log(chalk_1.default.yellow(`\nPróximos passos:`));
86
99
  console.log(` cd ${targetFolderName}`);
package/dist/index.js CHANGED
@@ -1,15 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
3
6
  Object.defineProperty(exports, "__esModule", { value: true });
4
7
  const commander_1 = require("commander");
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
5
10
  const auth_1 = require("./commands/auth");
6
11
  const clone_1 = require("./commands/clone");
7
12
  const submit_1 = require("./commands/submit");
8
13
  const program = new commander_1.Command();
14
+ const pkg = JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, '../package.json'), 'utf8'));
9
15
  program
10
16
  .name('devquest')
11
17
  .description('DevQuest CLI - Construa seu próprio Redis, Docker, Git e mais')
12
- .version('1.0.0');
18
+ .version(pkg.version);
13
19
  program.addCommand(auth_1.authCommand);
14
20
  program.addCommand(clone_1.cloneCommand);
15
21
  program.addCommand(submit_1.submitCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devquest/cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "DevQuest CLI - Construa seu próprio Redis, Docker, Git e mais",
5
5
  "main": "dist/index.js",
6
6
  "bin": {