azure-pr-manager 1.0.0 → 1.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 +62 -19
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -13,14 +13,16 @@ const program = new Command();
|
|
|
13
13
|
program
|
|
14
14
|
.name("azure-pr")
|
|
15
15
|
.description("CLI para criar Pull Requests no Azure DevOps automaticamente")
|
|
16
|
-
.version("1.0.
|
|
16
|
+
.version("1.0.1")
|
|
17
|
+
.addHelpText("after", "\n Desenvolvido por Higor Santos");
|
|
17
18
|
|
|
18
19
|
// ==================== INIT ====================
|
|
19
20
|
program
|
|
20
21
|
.command("init")
|
|
21
22
|
.description("Inicializa a configuracao do projeto (.prmanager.json)")
|
|
22
23
|
.action(async () => {
|
|
23
|
-
console.log(chalk.cyan("\n Azure PR Manager - Configuracao
|
|
24
|
+
console.log(chalk.cyan("\n Azure PR Manager - Configuracao"));
|
|
25
|
+
console.log(chalk.gray(" Desenvolvido por ") + chalk.white("Higor Santos\n"));
|
|
24
26
|
|
|
25
27
|
const existing = await loadConfig();
|
|
26
28
|
const defaults = existing || getDefaultConfig();
|
|
@@ -66,7 +68,8 @@ program
|
|
|
66
68
|
console.log(chalk.gray(" │") + chalk.white(" Como criar o Personal Access Token (PAT):"));
|
|
67
69
|
console.log(chalk.gray(" │"));
|
|
68
70
|
console.log(chalk.gray(" │") + " 1. Acesse " + chalk.cyan("dev.azure.com") + " e faca login");
|
|
69
|
-
console.log(chalk.gray(" │") + " 2.
|
|
71
|
+
console.log(chalk.gray(" │") + " 2. No canto superior direito, clique em " + chalk.white("User Settings"));
|
|
72
|
+
console.log(chalk.gray(" │") + " (icone de engrenagem ao lado do seu avatar)");
|
|
70
73
|
console.log(chalk.gray(" │") + " 3. Selecione " + chalk.white("Personal access tokens"));
|
|
71
74
|
console.log(chalk.gray(" │") + " 4. Clique em " + chalk.white("+ New Token"));
|
|
72
75
|
console.log(chalk.gray(" │") + " 5. De um nome, ex: " + chalk.yellow("\"PR Manager CLI\""));
|
|
@@ -75,7 +78,7 @@ program
|
|
|
75
78
|
console.log(chalk.gray(" │") + chalk.green(" ✓ Code > Read & Write"));
|
|
76
79
|
console.log(chalk.gray(" │") + chalk.green(" ✓ Identity > Read"));
|
|
77
80
|
console.log(chalk.gray(" │") + chalk.green(" ✓ Member Entitlement Management > Read"));
|
|
78
|
-
console.log(chalk.gray(" │") + " 8. Clique em Create e copie o token gerado");
|
|
81
|
+
console.log(chalk.gray(" │") + " 8. Clique em " + chalk.white("Create") + " e copie o token gerado");
|
|
79
82
|
console.log(chalk.gray(" │"));
|
|
80
83
|
console.log(chalk.gray(" │") + chalk.red(" O token so aparece uma vez! Salve em lugar seguro."));
|
|
81
84
|
console.log(chalk.gray(" └─────────────────────────────────────────────────────\n"));
|
|
@@ -283,7 +286,8 @@ program
|
|
|
283
286
|
process.exit(1);
|
|
284
287
|
}
|
|
285
288
|
|
|
286
|
-
console.log(chalk.cyan("\n Azure PR Manager - Criar Pull Request
|
|
289
|
+
console.log(chalk.cyan("\n Azure PR Manager - Criar Pull Request"));
|
|
290
|
+
console.log(chalk.gray(" Desenvolvido por ") + chalk.white("Higor Santos\n"));
|
|
287
291
|
|
|
288
292
|
// ── ETAPA 1: Verificar repositorio git ──
|
|
289
293
|
if (!git.isGitRepo()) {
|
|
@@ -598,30 +602,69 @@ program
|
|
|
598
602
|
chalk.cyan("develop") +
|
|
599
603
|
"."
|
|
600
604
|
);
|
|
605
|
+
console.log(
|
|
606
|
+
chalk.gray(" │") +
|
|
607
|
+
" Voce pode selecionar da lista ou digitar o nome manualmente."
|
|
608
|
+
);
|
|
601
609
|
console.log(
|
|
602
610
|
chalk.gray(
|
|
603
611
|
" └─────────────────────────────────────────────────────\n"
|
|
604
612
|
)
|
|
605
613
|
);
|
|
606
614
|
|
|
607
|
-
|
|
615
|
+
// Detectar default inteligente
|
|
616
|
+
const defaultTarget = targetChoices.includes("main")
|
|
617
|
+
? "main"
|
|
618
|
+
: targetChoices.includes("master")
|
|
619
|
+
? "master"
|
|
620
|
+
: targetChoices.includes("develop")
|
|
621
|
+
? "develop"
|
|
622
|
+
: undefined;
|
|
623
|
+
|
|
624
|
+
const { targetMode } = await inquirer.prompt([
|
|
608
625
|
{
|
|
609
626
|
type: "list",
|
|
610
|
-
name: "
|
|
611
|
-
message: "
|
|
612
|
-
choices:
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
627
|
+
name: "targetMode",
|
|
628
|
+
message: "Como deseja informar a branch de destino?",
|
|
629
|
+
choices: [
|
|
630
|
+
{
|
|
631
|
+
name: "Selecionar da lista",
|
|
632
|
+
value: "list",
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
name: "Digitar o nome da branch",
|
|
636
|
+
value: "type",
|
|
637
|
+
},
|
|
638
|
+
],
|
|
622
639
|
},
|
|
623
640
|
]);
|
|
624
|
-
|
|
641
|
+
|
|
642
|
+
if (targetMode === "list") {
|
|
643
|
+
const { target } = await inquirer.prompt([
|
|
644
|
+
{
|
|
645
|
+
type: "list",
|
|
646
|
+
name: "target",
|
|
647
|
+
message: "Branch de destino (target):",
|
|
648
|
+
choices: targetChoices,
|
|
649
|
+
default: defaultTarget,
|
|
650
|
+
loop: false,
|
|
651
|
+
pageSize: 15,
|
|
652
|
+
},
|
|
653
|
+
]);
|
|
654
|
+
targetBranch = target;
|
|
655
|
+
} else {
|
|
656
|
+
const { target } = await inquirer.prompt([
|
|
657
|
+
{
|
|
658
|
+
type: "input",
|
|
659
|
+
name: "target",
|
|
660
|
+
message: "Nome da branch de destino:",
|
|
661
|
+
default: defaultTarget,
|
|
662
|
+
validate: (v) =>
|
|
663
|
+
v.trim() ? true : "O nome da branch e obrigatorio",
|
|
664
|
+
},
|
|
665
|
+
]);
|
|
666
|
+
targetBranch = target.trim();
|
|
667
|
+
}
|
|
625
668
|
}
|
|
626
669
|
|
|
627
670
|
// Titulo
|