cskit-cli 1.0.34 → 1.0.37
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/init.js +4 -4
- package/src/commands/update.js +31 -11
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -457,15 +457,14 @@ async function initCommand(options) {
|
|
|
457
457
|
process.exit(1);
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
-
timeline.complete(0, 'OK');
|
|
461
|
-
|
|
462
460
|
// Check existing installation
|
|
463
461
|
const manifest = loadManifest(projectDir);
|
|
464
462
|
const isUpdate = manifest.version !== null;
|
|
465
463
|
|
|
466
464
|
if (isUpdate) {
|
|
467
|
-
|
|
465
|
+
timeline.addChild(0, `Current: ${manifest.version}`, 'info');
|
|
468
466
|
}
|
|
467
|
+
timeline.complete(0, 'OK');
|
|
469
468
|
|
|
470
469
|
// Get available versions
|
|
471
470
|
const releases = await getAllReleases(token);
|
|
@@ -483,6 +482,7 @@ async function initCommand(options) {
|
|
|
483
482
|
choices.push({ name: chalk.dim('main branch (dev)'), value: 'main' });
|
|
484
483
|
|
|
485
484
|
timeline.pause(); // Pause before prompt
|
|
485
|
+
console.log(''); // One blank line before prompt
|
|
486
486
|
const answer = await inquirer.prompt([{
|
|
487
487
|
type: 'list',
|
|
488
488
|
name: 'version',
|
|
@@ -496,7 +496,7 @@ async function initCommand(options) {
|
|
|
496
496
|
selectedVersion = latest.tag;
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
-
console.log(chalk.dim(
|
|
499
|
+
console.log(` ${chalk.dim('Installing:')} ${selectedVersion}\n`);
|
|
500
500
|
|
|
501
501
|
// Step 2: Download zip
|
|
502
502
|
timeline.start(1);
|
package/src/commands/update.js
CHANGED
|
@@ -26,6 +26,16 @@ function compareVersions(a, b) {
|
|
|
26
26
|
return 0;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Pad text to fixed width (ignoring ANSI codes)
|
|
31
|
+
*/
|
|
32
|
+
function padText(text, width) {
|
|
33
|
+
// Strip ANSI codes to get visible length
|
|
34
|
+
const visible = text.replace(/\x1b\[[0-9;]*m/g, '');
|
|
35
|
+
const padding = Math.max(0, width - visible.length);
|
|
36
|
+
return text + ' '.repeat(padding);
|
|
37
|
+
}
|
|
38
|
+
|
|
29
39
|
/**
|
|
30
40
|
* Main update command handler
|
|
31
41
|
*/
|
|
@@ -33,10 +43,7 @@ async function updateCommand() {
|
|
|
33
43
|
console.log(chalk.cyan('\n CSK CLI - Update\n'));
|
|
34
44
|
|
|
35
45
|
const currentVersion = pkg.version;
|
|
36
|
-
|
|
37
|
-
// Show version info box
|
|
38
|
-
console.log(chalk.dim(' ┌─────────────────────────────────────┐'));
|
|
39
|
-
console.log(chalk.dim(' │') + ` Current version: ${chalk.yellow('v' + currentVersion)}`.padEnd(46) + chalk.dim('│'));
|
|
46
|
+
const boxWidth = 37; // Inner width between │ and │
|
|
40
47
|
|
|
41
48
|
const spinner = ora({ text: 'Checking npm registry...', indent: 2 }).start();
|
|
42
49
|
|
|
@@ -48,8 +55,14 @@ async function updateCommand() {
|
|
|
48
55
|
}).trim();
|
|
49
56
|
|
|
50
57
|
spinner.stop();
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
|
|
59
|
+
// Show version info box (after spinner completes)
|
|
60
|
+
console.log(chalk.dim(' ┌' + '─'.repeat(boxWidth) + '┐'));
|
|
61
|
+
const currentLine = ` Current: ${chalk.yellow('v' + currentVersion)}`;
|
|
62
|
+
console.log(chalk.dim(' │') + padText(currentLine, boxWidth) + chalk.dim('│'));
|
|
63
|
+
const latestLine = ` Latest: ${chalk.green('v' + latestVersion)}`;
|
|
64
|
+
console.log(chalk.dim(' │') + padText(latestLine, boxWidth) + chalk.dim('│'));
|
|
65
|
+
console.log(chalk.dim(' └' + '─'.repeat(boxWidth) + '┘\n'));
|
|
53
66
|
|
|
54
67
|
const comparison = compareVersions(currentVersion, latestVersion);
|
|
55
68
|
|
|
@@ -77,15 +90,22 @@ async function updateCommand() {
|
|
|
77
90
|
|
|
78
91
|
// Show summary
|
|
79
92
|
console.log('');
|
|
80
|
-
console.log(chalk.dim('
|
|
81
|
-
|
|
82
|
-
console.log(chalk.dim('
|
|
93
|
+
console.log(chalk.dim(' ┌' + '─'.repeat(boxWidth) + '┐'));
|
|
94
|
+
const summaryLine = ` ${chalk.red('v' + currentVersion)} → ${chalk.green('v' + latestVersion)}`;
|
|
95
|
+
console.log(chalk.dim(' │') + padText(summaryLine, boxWidth) + chalk.dim('│'));
|
|
96
|
+
console.log(chalk.dim(' └' + '─'.repeat(boxWidth) + '┘'));
|
|
83
97
|
console.log(chalk.dim('\n Run `cskit init` to update project files.\n'));
|
|
84
98
|
|
|
85
99
|
} catch (error) {
|
|
86
100
|
spinner.stop();
|
|
87
|
-
|
|
88
|
-
|
|
101
|
+
|
|
102
|
+
// Show error box
|
|
103
|
+
console.log(chalk.dim(' ┌' + '─'.repeat(boxWidth) + '┐'));
|
|
104
|
+
const currentLine = ` Current: ${chalk.yellow('v' + currentVersion)}`;
|
|
105
|
+
console.log(chalk.dim(' │') + padText(currentLine, boxWidth) + chalk.dim('│'));
|
|
106
|
+
const errorLine = ` Latest: ${chalk.red('(unavailable)')}`;
|
|
107
|
+
console.log(chalk.dim(' │') + padText(errorLine, boxWidth) + chalk.dim('│'));
|
|
108
|
+
console.log(chalk.dim(' └' + '─'.repeat(boxWidth) + '┘\n'));
|
|
89
109
|
|
|
90
110
|
if (error.message.includes('npm view') || error.message.includes('404')) {
|
|
91
111
|
console.log(chalk.red(' ✗ Could not check for updates'));
|