smoonb 0.0.46 → 0.0.47

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smoonb",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "description": "Complete Supabase backup and migration tool - EXPERIMENTAL VERSION - USE AT YOUR OWN RISK",
5
5
  "preferGlobal": false,
6
6
  "preventGlobalInstall": true,
@@ -10,29 +10,40 @@ async function mapEnvVariablesInteractively(env, expectedKeys) {
10
10
  for (const expected of expectedKeys) {
11
11
  console.log(chalk.blue(`\n🔧 Mapeando variável: ${expected}`));
12
12
 
13
- const choices = [
14
- ...allKeys.map((k, idx) => ({ name: `${idx + 1}. ${k}`, value: k })),
15
- new inquirer.Separator(),
16
- { name: 'Adicionar nova chave com este nome', value: '__ADD_NEW__' }
17
- ];
18
-
19
- const { chosen } = await inquirer.prompt([{
20
- type: 'list',
21
- name: 'chosen',
22
- message: `Selecione a chave correspondente para: ${expected}`,
23
- choices
24
- }]);
13
+ let clientKey = undefined;
25
14
 
26
- let clientKey = chosen;
27
- if (chosen === '__ADD_NEW__') {
15
+ // 3) Se existir chave exatamente igual, pular seleção e ir direto para confirmação
16
+ if (Object.prototype.hasOwnProperty.call(finalEnv, expected)) {
28
17
  clientKey = expected;
29
- if (Object.prototype.hasOwnProperty.call(finalEnv, clientKey)) {
30
- // Evitar colisão: gerar sufixo incremental
31
- let i = 2;
32
- while (Object.prototype.hasOwnProperty.call(finalEnv, `${clientKey}_${i}`)) i++;
33
- clientKey = `${clientKey}_${i}`;
18
+ } else {
19
+ // 2) Remover o caractere '?' do início da pergunta definindo prefix: ''
20
+ // 4) Opção explícita para adicionar nova chave
21
+ const choices = [
22
+ ...allKeys.map((k, idx) => ({ name: `${idx + 1}. ${k}`, value: k })),
23
+ new inquirer.Separator(),
24
+ { name: 'Adicione uma nova chave para mim', value: '__ADD_NEW__' }
25
+ ];
26
+
27
+ const { chosen } = await inquirer.prompt([{
28
+ type: 'list',
29
+ name: 'chosen',
30
+ message: `Selecione a chave correspondente para: ${expected}`,
31
+ choices,
32
+ loop: false,
33
+ prefix: ''
34
+ }]);
35
+
36
+ clientKey = chosen;
37
+ if (chosen === '__ADD_NEW__') {
38
+ clientKey = expected;
39
+ if (Object.prototype.hasOwnProperty.call(finalEnv, clientKey)) {
40
+ // Evitar colisão: gerar sufixo incremental
41
+ let i = 2;
42
+ while (Object.prototype.hasOwnProperty.call(finalEnv, `${clientKey}_${i}`)) i++;
43
+ clientKey = `${clientKey}_${i}`;
44
+ }
45
+ finalEnv[clientKey] = '';
34
46
  }
35
- finalEnv[clientKey] = '';
36
47
  }
37
48
 
38
49
  const currentValue = finalEnv[clientKey] ?? '';
@@ -40,7 +51,8 @@ async function mapEnvVariablesInteractively(env, expectedKeys) {
40
51
  type: 'confirm',
41
52
  name: 'isCorrect',
42
53
  message: `Valor atual: ${currentValue || '(vazio)'} Este é o valor correto do projeto alvo? (S/n):`,
43
- default: true
54
+ default: true,
55
+ prefix: ''
44
56
  }]);
45
57
 
46
58
  let valueToWrite = currentValue;
@@ -48,7 +60,8 @@ async function mapEnvVariablesInteractively(env, expectedKeys) {
48
60
  const { newValue } = await inquirer.prompt([{
49
61
  type: 'input',
50
62
  name: 'newValue',
51
- message: `Cole o novo valor para ${clientKey}:`
63
+ message: `Cole o novo valor para ${clientKey}:`,
64
+ prefix: ''
52
65
  }]);
53
66
  valueToWrite = newValue || '';
54
67
  }
@@ -57,7 +70,8 @@ async function mapEnvVariablesInteractively(env, expectedKeys) {
57
70
  const { newValueRequired } = await inquirer.prompt([{
58
71
  type: 'input',
59
72
  name: 'newValueRequired',
60
- message: `Valor obrigatório. Informe valor para ${clientKey}:`
73
+ message: `Valor obrigatório. Informe valor para ${clientKey}:`,
74
+ prefix: ''
61
75
  }]);
62
76
  valueToWrite = newValueRequired || '';
63
77
  }