@lvnt/release-radar-cli 0.2.0 → 0.2.2
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/dist/index.js +43 -4
- package/dist/updater.js +8 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -40,14 +40,17 @@ async function runConfig() {
|
|
|
40
40
|
async function runInteractive() {
|
|
41
41
|
const configManager = new ConfigManager();
|
|
42
42
|
const tracker = new DownloadTracker();
|
|
43
|
+
// Check for updates first (before any prompts) unless --skip-update is passed
|
|
44
|
+
const skipUpdate = process.argv.includes('--skip-update');
|
|
45
|
+
if (!skipUpdate) {
|
|
46
|
+
await checkAndUpdate();
|
|
47
|
+
}
|
|
43
48
|
// First run setup
|
|
44
49
|
if (!configManager.isConfigured()) {
|
|
45
50
|
const config = await promptSetup();
|
|
46
51
|
configManager.save(config);
|
|
47
52
|
console.log(chalk.green('\nConfiguration saved!\n'));
|
|
48
53
|
}
|
|
49
|
-
// Check for updates and restart if needed
|
|
50
|
-
await checkAndUpdate();
|
|
51
54
|
// Load data
|
|
52
55
|
const config = configManager.load();
|
|
53
56
|
const versions = loadVersions();
|
|
@@ -60,6 +63,8 @@ async function runInteractive() {
|
|
|
60
63
|
}
|
|
61
64
|
// Download/update selected tools
|
|
62
65
|
console.log('');
|
|
66
|
+
const successes = [];
|
|
67
|
+
const failures = [];
|
|
63
68
|
for (const tool of selected) {
|
|
64
69
|
if (tool.type === 'npm') {
|
|
65
70
|
console.log(chalk.bold(`Updating npm package ${tool.displayName} (${tool.package})...`));
|
|
@@ -67,9 +72,11 @@ async function runInteractive() {
|
|
|
67
72
|
if (result.success) {
|
|
68
73
|
tracker.recordDownload(tool.name, tool.version, `npm:${tool.package}`);
|
|
69
74
|
console.log(chalk.green(` Updated ${tool.package} to ${tool.version} ✓\n`));
|
|
75
|
+
successes.push({ name: tool.displayName, version: tool.version, type: 'npm' });
|
|
70
76
|
}
|
|
71
77
|
else {
|
|
72
78
|
console.log(chalk.red(` Failed: ${result.error}\n`));
|
|
79
|
+
failures.push({ name: tool.displayName, version: tool.version, error: result.error || 'Unknown error' });
|
|
73
80
|
}
|
|
74
81
|
}
|
|
75
82
|
else {
|
|
@@ -78,16 +85,43 @@ async function runInteractive() {
|
|
|
78
85
|
if (result.success) {
|
|
79
86
|
tracker.recordDownload(tool.name, tool.version, tool.filename);
|
|
80
87
|
console.log(chalk.green(` Saved to ${config.downloadDir}/${tool.filename} ✓\n`));
|
|
88
|
+
successes.push({ name: tool.displayName, version: tool.version, type: 'download' });
|
|
81
89
|
}
|
|
82
90
|
else {
|
|
83
91
|
console.log(chalk.red(` Failed: ${result.error}\n`));
|
|
92
|
+
failures.push({ name: tool.displayName, version: tool.version, error: result.error || 'Unknown error' });
|
|
84
93
|
}
|
|
85
94
|
}
|
|
86
95
|
}
|
|
87
|
-
|
|
96
|
+
// Summary report
|
|
97
|
+
console.log(chalk.bold('─'.repeat(50)));
|
|
98
|
+
console.log(chalk.bold('Summary\n'));
|
|
99
|
+
if (successes.length > 0) {
|
|
100
|
+
console.log(chalk.green(`✓ ${successes.length} succeeded:`));
|
|
101
|
+
for (const s of successes) {
|
|
102
|
+
console.log(chalk.green(` • ${s.name} ${s.version}`));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (failures.length > 0) {
|
|
106
|
+
console.log(chalk.red(`\n✗ ${failures.length} failed:`));
|
|
107
|
+
for (const f of failures) {
|
|
108
|
+
console.log(chalk.red(` • ${f.name} ${f.version}: ${f.error}`));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
console.log('');
|
|
112
|
+
if (failures.length === 0) {
|
|
113
|
+
console.log(chalk.green('All downloads completed successfully!'));
|
|
114
|
+
}
|
|
115
|
+
else if (successes.length === 0) {
|
|
116
|
+
console.log(chalk.red('All downloads failed.'));
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
console.log(chalk.yellow(`Completed with ${failures.length} failure(s).`));
|
|
120
|
+
}
|
|
88
121
|
}
|
|
89
122
|
async function main() {
|
|
90
|
-
const
|
|
123
|
+
const args = process.argv.slice(2).filter(arg => !arg.startsWith('--'));
|
|
124
|
+
const command = args[0];
|
|
91
125
|
switch (command) {
|
|
92
126
|
case 'status':
|
|
93
127
|
await showStatus();
|
|
@@ -96,6 +130,11 @@ async function main() {
|
|
|
96
130
|
await runConfig();
|
|
97
131
|
break;
|
|
98
132
|
default:
|
|
133
|
+
// Check if stdin is a TTY for interactive mode
|
|
134
|
+
if (!process.stdin.isTTY) {
|
|
135
|
+
console.error(chalk.red('Error: Interactive mode requires a TTY. Use "status" command for non-interactive use.'));
|
|
136
|
+
process.exit(1);
|
|
137
|
+
}
|
|
99
138
|
await runInteractive();
|
|
100
139
|
break;
|
|
101
140
|
}
|
package/dist/updater.js
CHANGED
|
@@ -13,6 +13,7 @@ function getLatestVersion() {
|
|
|
13
13
|
const result = execSync('npm view @lvnt/release-radar-cli version', {
|
|
14
14
|
encoding: 'utf-8',
|
|
15
15
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
16
|
+
timeout: 10000, // 10 second timeout
|
|
16
17
|
});
|
|
17
18
|
return result.trim();
|
|
18
19
|
}
|
|
@@ -32,11 +33,15 @@ export async function checkAndUpdate() {
|
|
|
32
33
|
}
|
|
33
34
|
console.log(`Updating from ${current} to ${latest}...`);
|
|
34
35
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
// Use pipe instead of inherit to avoid messing with terminal state
|
|
37
|
+
const result = execSync('npm update -g @lvnt/release-radar-cli', {
|
|
38
|
+
encoding: 'utf-8',
|
|
39
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
37
40
|
});
|
|
41
|
+
if (result)
|
|
42
|
+
console.log(result);
|
|
38
43
|
console.log('Update complete. Restarting...\n');
|
|
39
|
-
// Restart self
|
|
44
|
+
// Restart self with a fresh terminal
|
|
40
45
|
const child = spawn(process.argv[0], process.argv.slice(1), {
|
|
41
46
|
detached: true,
|
|
42
47
|
stdio: 'inherit',
|