@@ -32,6 +32,12 @@ function cleanupSpinner(): void {
32
32
}
33
33
}
34
34
35
+ // Function to clean up all lingering processing messages at the end
36
+ function cleanupAllProcessingMessages ( ) : void {
37
+ cleanupSpinner ( )
38
+ // Additional cleanup can be added here if needed
39
+ }
40
+
35
41
// Setup signal handlers for clean exit
36
42
function setupSignalHandlers ( ) : void {
37
43
process . on ( 'SIGINT' , ( ) => {
@@ -103,19 +109,22 @@ function logUniqueMessage(message: string, forceLog = false): void {
103
109
if ( ! config . verbose && message . startsWith ( '✅' ) && ! message . includes ( 'Environment activated' ) ) {
104
110
// Add a small delay to make the success message visible before showing processing message
105
111
setTimeout ( ( ) => {
106
- const processingMsg = `🔄 Processing next dependency...`
112
+ // Only show processing message if we haven't completed all packages
113
+ if ( ! hasTemporaryProcessingMessage ) {
114
+ const processingMsg = `🔄 Processing next dependency...`
107
115
108
- if ( process . env . LAUNCHPAD_SHELL_INTEGRATION === '1' ) {
109
- process . stderr . write ( `${ processingMsg } \n` )
110
- if ( process . stderr . isTTY ) {
111
- fs . writeSync ( process . stderr . fd , '' )
116
+ if ( process . env . LAUNCHPAD_SHELL_INTEGRATION === '1' ) {
117
+ process . stderr . write ( `${ processingMsg } \n` )
118
+ if ( process . stderr . isTTY ) {
119
+ fs . writeSync ( process . stderr . fd , '' )
120
+ }
121
+ }
122
+ else {
123
+ process . stdout . write ( `${ processingMsg } \n` )
112
124
}
113
- }
114
- else {
115
- process . stdout . write ( `${ processingMsg } \n` )
116
- }
117
125
118
- hasTemporaryProcessingMessage = true
126
+ hasTemporaryProcessingMessage = true
127
+ }
119
128
} , 50 ) // Small delay to ensure success message is visible
120
129
}
121
130
}
@@ -1396,6 +1405,9 @@ export async function downloadPackage(
1396
1405
let archiveFile : string | null = null
1397
1406
let usedCache = false
1398
1407
1408
+ // Track whether we've shown a success message to avoid redundant extraction messages
1409
+ let showedSuccessMessage = false
1410
+
1399
1411
for ( const format of formats ) {
1400
1412
// Check if we have a cached version first
1401
1413
const cachedArchivePath = getCachedPackagePath ( domain , version , format )
@@ -1406,40 +1418,9 @@ export async function downloadPackage(
1406
1418
console . warn ( `Using cached ${ domain } v${ version } from: ${ cachedArchivePath } ` )
1407
1419
}
1408
1420
else {
1409
- // Show a brief processing message for cached packages to provide feedback
1410
- if ( ! config . verbose ) {
1411
- const processingMsg = `🔄 Loading ${ domain } v${ version } from cache...`
1412
- if ( process . env . LAUNCHPAD_SHELL_INTEGRATION === '1' ) {
1413
- process . stderr . write ( `${ processingMsg } \n` )
1414
- if ( process . stderr . isTTY ) {
1415
- fs . writeSync ( process . stderr . fd , '' )
1416
- }
1417
- }
1418
- else {
1419
- process . stdout . write ( `${ processingMsg } \n` )
1420
- }
1421
-
1422
- // Brief delay to make the message visible
1423
- await new Promise ( resolve => setTimeout ( resolve , 100 ) )
1424
-
1425
- // Clear the processing message by moving cursor up and clearing the line
1426
- if ( process . env . LAUNCHPAD_SHELL_INTEGRATION === '1' ) {
1427
- process . stderr . write ( '\x1B[1A\r\x1B[K' )
1428
- if ( process . stderr . isTTY ) {
1429
- try {
1430
- fs . writeSync ( process . stderr . fd , '' )
1431
- }
1432
- catch {
1433
- // Ignore flush errors
1434
- }
1435
- }
1436
- }
1437
- else {
1438
- process . stdout . write ( '\x1B[1A\r\x1B[K' )
1439
- }
1440
- }
1441
-
1421
+ // For cached packages, show completion message directly without intermediate processing message
1442
1422
logUniqueMessage ( `✅ ${ domain } \x1B[2m\x1B[3m(v${ version } )\x1B[0m` )
1423
+ showedSuccessMessage = true
1443
1424
}
1444
1425
1445
1426
// Copy cached file to temp directory
@@ -1671,8 +1652,9 @@ export async function downloadPackage(
1671
1652
}
1672
1653
else {
1673
1654
// Only show extraction for very large packages (>20MB) to keep output clean
1655
+ // But don't show if we already showed a success message (for cached packages)
1674
1656
const archiveStats = fs . statSync ( archiveFile )
1675
- if ( archiveStats . size > 20 * 1024 * 1024 ) {
1657
+ if ( archiveStats . size > 20 * 1024 * 1024 && ! showedSuccessMessage ) {
1676
1658
// Clear any existing spinner before starting extraction
1677
1659
if ( hasTemporaryProcessingMessage ) {
1678
1660
cleanupSpinner ( )
@@ -1778,7 +1760,7 @@ export async function downloadPackage(
1778
1760
else {
1779
1761
// Clear the extraction progress message if we showed one
1780
1762
const archiveStats = fs . statSync ( archiveFile )
1781
- if ( archiveStats . size > 20 * 1024 * 1024 ) {
1763
+ if ( archiveStats . size > 20 * 1024 * 1024 && ! showedSuccessMessage ) {
1782
1764
if ( process . env . LAUNCHPAD_SHELL_INTEGRATION === '1' ) {
1783
1765
process . stderr . write ( '\x1B[1A\r\x1B[K' )
1784
1766
if ( process . stderr . isTTY ) {
@@ -2861,6 +2843,9 @@ export async function install(packages: PackageSpec | PackageSpec[], basePath?:
2861
2843
}
2862
2844
}
2863
2845
2846
+ // Clean up any lingering processing messages
2847
+ cleanupAllProcessingMessages ( )
2848
+
2864
2849
return allInstalledFiles
2865
2850
}
2866
2851
0 commit comments