natureco-cli 2.11.6 → 2.12.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.
- package/package.json +1 -1
- package/src/commands/dashboard.js +2 -2
- package/src/commands/update.js +62 -17
package/package.json
CHANGED
|
@@ -211,7 +211,7 @@ body::before{
|
|
|
211
211
|
<div class="header-bot-name" id="header-bot-name">Nature Bot</div>
|
|
212
212
|
<div class="header-bot-model" id="header-bot-model">NatureCo</div>
|
|
213
213
|
</div>
|
|
214
|
-
<div class="version-badge" id="version-badge">v2.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.12.0</div>
|
|
215
215
|
</div>
|
|
216
216
|
<div class="messages" id="messages"></div>
|
|
217
217
|
<div class="input-area">
|
|
@@ -341,7 +341,7 @@ function dashboard(action) {
|
|
|
341
341
|
apiKey: cfg.apiKey,
|
|
342
342
|
defaultBot: cfg.defaultBot,
|
|
343
343
|
defaultBotId: cfg.defaultBotId,
|
|
344
|
-
version: 'v2.
|
|
344
|
+
version: 'v2.12.0',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/commands/update.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
2
|
const { execSync } = require('child_process');
|
|
3
|
+
const inquirer = require('inquirer');
|
|
3
4
|
const packageJson = require('../../package.json');
|
|
4
5
|
|
|
5
6
|
async function update() {
|
|
@@ -8,18 +9,17 @@ async function update() {
|
|
|
8
9
|
console.log(chalk.yellow('\n⏳ Güncelleme kontrol ediliyor...\n'));
|
|
9
10
|
|
|
10
11
|
try {
|
|
11
|
-
// npm'den en son versiyonu al
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
console.log(chalk.cyan('
|
|
18
|
-
console.log(chalk.cyan('En son versiyon:'), chalk.white(latestVersion));
|
|
12
|
+
// npm registry'den en son versiyonu al
|
|
13
|
+
const response = await fetch('https://registry.npmjs.org/natureco-cli/latest');
|
|
14
|
+
const data = await response.json();
|
|
15
|
+
const latestVersion = data.version;
|
|
16
|
+
|
|
17
|
+
console.log(chalk.cyan('Mevcut versiyon:'), chalk.white(`v${currentVersion}`));
|
|
18
|
+
console.log(chalk.cyan('En son versiyon:'), chalk.white(`v${latestVersion}`));
|
|
19
19
|
console.log('');
|
|
20
20
|
|
|
21
21
|
if (currentVersion === latestVersion) {
|
|
22
|
-
console.log(chalk.green(
|
|
22
|
+
console.log(chalk.green(`✅ Zaten güncel: v${currentVersion}\n`));
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -27,18 +27,63 @@ async function update() {
|
|
|
27
27
|
const isNewer = compareVersions(latestVersion, currentVersion) > 0;
|
|
28
28
|
|
|
29
29
|
if (isNewer) {
|
|
30
|
-
console.log(chalk.
|
|
30
|
+
console.log(chalk.green(`✅ Yeni versiyon mevcut: v${currentVersion} → v${latestVersion}\n`));
|
|
31
31
|
console.log(chalk.gray('Güncellemek için:\n'));
|
|
32
|
-
console.log(chalk.cyan(' npm install -g natureco-cli@latest\n'));
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
console.log(chalk.cyan(' npm install -g natureco-cli@latest --force\n'));
|
|
33
|
+
|
|
34
|
+
// İsteğe bağlı otomatik güncelleme
|
|
35
|
+
const { shouldUpdate } = await inquirer.prompt([
|
|
36
|
+
{
|
|
37
|
+
type: 'confirm',
|
|
38
|
+
name: 'shouldUpdate',
|
|
39
|
+
message: 'Şimdi güncellensin mi?',
|
|
40
|
+
default: true,
|
|
41
|
+
},
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
if (shouldUpdate) {
|
|
45
|
+
console.log(chalk.yellow('\n⏳ Güncelleme yapılıyor...\n'));
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
execSync('npm install -g natureco-cli@latest --force', {
|
|
49
|
+
stdio: 'inherit',
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
console.log(chalk.green(`\n✅ Güncelleme tamamlandı! v${latestVersion}\n`));
|
|
53
|
+
} catch (err) {
|
|
54
|
+
console.log(chalk.red('\n❌ Güncelleme başarısız oldu.\n'));
|
|
55
|
+
console.log(chalk.gray('Manuel olarak güncellemek için:\n'));
|
|
56
|
+
console.log(chalk.cyan(' npm install -g natureco-cli@latest --force\n'));
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
console.log(chalk.gray('\nGüncelleme iptal edildi.\n'));
|
|
60
|
+
}
|
|
35
61
|
} else {
|
|
36
|
-
console.log(chalk.green(
|
|
62
|
+
console.log(chalk.green(`✅ Zaten güncel: v${currentVersion}\n`));
|
|
37
63
|
}
|
|
38
64
|
} catch (err) {
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
65
|
+
// Fetch başarısız olursa fallback olarak npm view kullan
|
|
66
|
+
try {
|
|
67
|
+
const latestVersion = execSync('npm view natureco-cli version', {
|
|
68
|
+
encoding: 'utf8',
|
|
69
|
+
stdio: ['pipe', 'pipe', 'ignore'],
|
|
70
|
+
}).trim();
|
|
71
|
+
|
|
72
|
+
console.log(chalk.cyan('Mevcut versiyon:'), chalk.white(`v${currentVersion}`));
|
|
73
|
+
console.log(chalk.cyan('En son versiyon:'), chalk.white(`v${latestVersion}`));
|
|
74
|
+
console.log('');
|
|
75
|
+
|
|
76
|
+
if (currentVersion === latestVersion) {
|
|
77
|
+
console.log(chalk.green(`✅ Zaten güncel: v${currentVersion}\n`));
|
|
78
|
+
} else {
|
|
79
|
+
console.log(chalk.green(`✅ Yeni versiyon mevcut: v${currentVersion} → v${latestVersion}\n`));
|
|
80
|
+
console.log(chalk.gray('Güncellemek için:\n'));
|
|
81
|
+
console.log(chalk.cyan(' npm install -g natureco-cli@latest --force\n'));
|
|
82
|
+
}
|
|
83
|
+
} catch (fallbackErr) {
|
|
84
|
+
console.log(chalk.gray('Güncelleme kontrolü yapılamadı.\n'));
|
|
85
|
+
console.log(chalk.gray('İnternet bağlantınızı kontrol edin.\n'));
|
|
86
|
+
}
|
|
42
87
|
}
|
|
43
88
|
}
|
|
44
89
|
|