kasy-cli 1.5.2 → 1.6.0

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.
@@ -4,8 +4,8 @@ const https = require('node:https');
4
4
  const path = require('node:path');
5
5
  const { existsSync, readJsonSync, writeJsonSync, ensureDirSync } = require('fs-extra');
6
6
  const kleur = require('kleur');
7
- const prompts = require('prompts');
8
7
  const pkg = require('../../package.json');
8
+ const ui = require('./ui');
9
9
  const { CONFIG_PATH } = require('./license');
10
10
 
11
11
  const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24 horas
@@ -105,28 +105,27 @@ async function warnIfOutdatedBeforeNew(t) {
105
105
  const cache = (readConfig().updateCheck) || {};
106
106
  if (!cache.latestVersion || !isNewer(cache.latestVersion, pkg.version)) return;
107
107
 
108
- console.log('');
108
+ const hint = t ? t('new.outdated.hint') : 'projetos criados agora não terão as últimas melhorias.';
109
109
  console.log(
110
- kleur.bgYellow().black(' VERSÃO DESATUALIZADA ') + ' ' +
110
+ '\n' +
111
+ kleur.bgYellow().black(' UPDATE ') + ' ' +
111
112
  kleur.bold(`v${cache.latestVersion} disponível`) +
112
- kleur.dim(` (você tem v${pkg.version})`)
113
+ kleur.dim(` ${hint}`) +
114
+ '\n'
113
115
  );
114
- console.log(kleur.dim(' Projetos novos são criados com a versão que você tem instalada.'));
115
- console.log(kleur.dim(' Para criar com a versão mais recente: ') + kleur.cyan('kasy upgrade') + kleur.dim(' (requer assinatura ativa)'));
116
- console.log('');
117
-
118
- const { proceed } = await prompts({
119
- type: 'confirm',
120
- name: 'proceed',
121
- message: t ? t('new.outdated.continueAnyway') : 'Continuar com a versão atual?',
122
- initial: true,
116
+
117
+ // Called BEFORE any ui.intro fires in kasy new, so this prompt runs as a
118
+ // standalone Clack confirm (no rail to break). On cancel we exit cleanly.
119
+ const upgrade = await ui.confirm({
120
+ message: t ? t('new.outdated.upgradeNow') : 'Atualizar antes de criar? (requer assinatura ativa)',
121
+ initialValue: false,
122
+ onCancel: () => process.exit(0),
123
123
  });
124
124
 
125
- if (proceed === false) {
126
- console.log('');
127
- console.log(kleur.cyan(' kasy upgrade'));
128
- console.log('');
129
- process.exit(0);
125
+ if (upgrade) {
126
+ const { spawnSync } = require('node:child_process');
127
+ const result = spawnSync('kasy', ['upgrade'], { stdio: 'inherit', shell: true });
128
+ process.exit(result.status ?? 0);
130
129
  }
131
130
  } catch {
132
131
  // Nunca travar o kasy new por causa do aviso de versão
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kasy-cli",
3
- "version": "1.5.2",
3
+ "version": "1.6.0",
4
4
  "description": "CLI for scaffolding production-ready Flutter SaaS apps with Firebase, Supabase, or API REST backends.",
5
5
  "bin": {
6
6
  "kasy": "./bin/kasy.js"
@@ -44,6 +44,8 @@
44
44
  "test:localize-docs": "node ./test/localize-release-docs.test.js"
45
45
  },
46
46
  "dependencies": {
47
+ "@clack/prompts": "^1.4.0",
48
+ "boxen": "^8.0.1",
47
49
  "commander": "^12.0.0",
48
50
  "fs-extra": "^11.2.0",
49
51
  "gradient-string": "^1.2.0",