azure-pr-manager 1.0.2 → 2.0.1
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/package.json +1 -1
- package/src/index.js +34 -9
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -8,12 +8,38 @@ import { AzureDevOpsApi } from "./api.js";
|
|
|
8
8
|
import { loadConfig, saveConfig, getDefaultConfig } from "./config.js";
|
|
9
9
|
import * as git from "./git.js";
|
|
10
10
|
|
|
11
|
+
// ==================== BANNER ====================
|
|
12
|
+
function showBanner(subtitle) {
|
|
13
|
+
console.log();
|
|
14
|
+
console.log(chalk.cyan(" ╔══════════════════════════════════════════════════════════╗"));
|
|
15
|
+
console.log(chalk.cyan(" ║") + " " + chalk.cyan("║"));
|
|
16
|
+
console.log(chalk.cyan(" ║") + chalk.bold.white(" ____ ____ __ __ ") + chalk.cyan("║"));
|
|
17
|
+
console.log(chalk.cyan(" ║") + chalk.bold.white(" / __ \\/ __ \\ / |/ /___ _____ ____ _____ ____ ") + chalk.cyan("║"));
|
|
18
|
+
console.log(chalk.cyan(" ║") + chalk.bold.white(" / /_/ / /_/ / / /|_/ / __ `/ __ \\/ __ `/ __ `/ _ \\ ") + chalk.cyan("║"));
|
|
19
|
+
console.log(chalk.cyan(" ║") + chalk.bold.white(" / ____/ _, _/ / / / / /_/ / / / / /_/ / /_/ / __/ ") + chalk.cyan("║"));
|
|
20
|
+
console.log(chalk.cyan(" ║") + chalk.bold.white(" /_/ /_/ |_| /_/ /_/\\__,_/_/ /_/\\__,_/\\__, /\\___/ ") + chalk.cyan("║"));
|
|
21
|
+
console.log(chalk.cyan(" ║") + chalk.bold.white(" /____/ ") + chalk.cyan("║"));
|
|
22
|
+
console.log(chalk.cyan(" ║") + " " + chalk.cyan("║"));
|
|
23
|
+
console.log(chalk.cyan(" ║") + chalk.gray(" Azure DevOps Pull Request Automation ") + chalk.cyan("║"));
|
|
24
|
+
console.log(chalk.cyan(" ║") + chalk.gray(" v2.0.1 — Desenvolvido por ") + chalk.white("Higor Santos") + " " + chalk.cyan("║"));
|
|
25
|
+
console.log(chalk.cyan(" ║") + " " + chalk.cyan("║"));
|
|
26
|
+
if (subtitle) {
|
|
27
|
+
const pad = Math.max(0, 58 - subtitle.length);
|
|
28
|
+
const left = Math.floor(pad / 2);
|
|
29
|
+
const right = pad - left;
|
|
30
|
+
console.log(chalk.cyan(" ║") + " ".repeat(left) + chalk.bold.yellow(subtitle) + " ".repeat(right) + chalk.cyan("║"));
|
|
31
|
+
console.log(chalk.cyan(" ║") + " " + chalk.cyan("║"));
|
|
32
|
+
}
|
|
33
|
+
console.log(chalk.cyan(" ╚══════════════════════════════════════════════════════════╝"));
|
|
34
|
+
console.log();
|
|
35
|
+
}
|
|
36
|
+
|
|
11
37
|
const program = new Command();
|
|
12
38
|
|
|
13
39
|
program
|
|
14
40
|
.name("azure-pr")
|
|
15
41
|
.description("CLI para criar Pull Requests no Azure DevOps automaticamente")
|
|
16
|
-
.version("
|
|
42
|
+
.version("2.0.1")
|
|
17
43
|
.addHelpText("after", "\n Desenvolvido por Higor Santos");
|
|
18
44
|
|
|
19
45
|
// ==================== INIT ====================
|
|
@@ -21,8 +47,7 @@ program
|
|
|
21
47
|
.command("init")
|
|
22
48
|
.description("Inicializa a configuracao do projeto (.prmanager.json)")
|
|
23
49
|
.action(async () => {
|
|
24
|
-
|
|
25
|
-
console.log(chalk.gray(" Desenvolvido por ") + chalk.white("Higor Santos\n"));
|
|
50
|
+
showBanner("Configuracao");
|
|
26
51
|
|
|
27
52
|
const existing = await loadConfig();
|
|
28
53
|
const defaults = existing || getDefaultConfig();
|
|
@@ -286,8 +311,7 @@ program
|
|
|
286
311
|
process.exit(1);
|
|
287
312
|
}
|
|
288
313
|
|
|
289
|
-
|
|
290
|
-
console.log(chalk.gray(" Desenvolvido por ") + chalk.white("Higor Santos\n"));
|
|
314
|
+
showBanner("Criar Pull Request");
|
|
291
315
|
|
|
292
316
|
// ── ETAPA 1: Verificar repositorio git ──
|
|
293
317
|
if (!git.isGitRepo()) {
|
|
@@ -618,9 +642,9 @@ program
|
|
|
618
642
|
: undefined;
|
|
619
643
|
|
|
620
644
|
const listChoices = [
|
|
621
|
-
...
|
|
645
|
+
{ name: chalk.yellow("Digitar o nome da branch..."), value: "_type" },
|
|
622
646
|
new inquirer.Separator("─────────────────────────────"),
|
|
623
|
-
|
|
647
|
+
...targetChoices,
|
|
624
648
|
];
|
|
625
649
|
|
|
626
650
|
const { target } = await inquirer.prompt([
|
|
@@ -629,7 +653,7 @@ program
|
|
|
629
653
|
name: "target",
|
|
630
654
|
message: "Branch de destino (selecione ou escolha digitar):",
|
|
631
655
|
choices: listChoices,
|
|
632
|
-
default:
|
|
656
|
+
default: "_type",
|
|
633
657
|
loop: false,
|
|
634
658
|
pageSize: 15,
|
|
635
659
|
},
|
|
@@ -820,7 +844,8 @@ program
|
|
|
820
844
|
const prUrl = `https://dev.azure.com/${config.organization}/${config.project}/_git/${config.repository}/pullrequest/${pr.pullRequestId}`;
|
|
821
845
|
createSpinner.succeed("Pull Request criado com sucesso!");
|
|
822
846
|
console.log(chalk.green(`\n PR #${pr.pullRequestId}: ${title}`));
|
|
823
|
-
console.log(chalk.blue(` ${prUrl}
|
|
847
|
+
console.log(chalk.blue(` ${prUrl}`));
|
|
848
|
+
console.log(chalk.gray(`\n Desenvolvido por `) + chalk.white("Higor Santos\n"));
|
|
824
849
|
} catch (err) {
|
|
825
850
|
createSpinner.fail("Erro ao criar PR: " + err.message);
|
|
826
851
|
process.exit(1);
|