Skip to content

Commit e3b3a40

Browse files
committed
chore: wip
1 parent aa2f1f7 commit e3b3a40

13 files changed

+1520
-234
lines changed

packages/launchpad/benchmark/file-detection-comparison.ts

Lines changed: 163 additions & 141 deletions
Large diffs are not rendered by default.

packages/launchpad/benchmark/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "@launchpad/benchmark",
3+
"type": "module",
34
"version": "1.0.0",
45
"private": true,
56
"description": "Performance benchmarks for Launchpad file detection",
6-
"type": "module",
77
"scripts": {
88
"file-detection": "bun run file-detection-comparison.ts"
99
},

packages/launchpad/bin/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,7 @@ cli
20242024
console.log(paths.join(':'))
20252025
process.exit(0)
20262026
}
2027-
catch (error) {
2027+
catch {
20282028
process.exit(1)
20292029
}
20302030
})
@@ -2038,7 +2038,7 @@ cli
20382038
console.log(paths.join(' '))
20392039
process.exit(0)
20402040
}
2041-
catch (error) {
2041+
catch {
20422042
process.exit(1)
20432043
}
20442044
})

packages/launchpad/src/dev/benchmark.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import { execSync } from 'node:child_process'
77
import { mkdirSync, readdirSync, writeFileSync } from 'node:fs'
88
import { dirname, join } from 'node:path'
9-
import process from 'node:process'
109

1110
// Configuration files to detect (matching the shell regex pattern)
1211
const PROJECT_FILES = [

packages/launchpad/src/dev/dump.ts

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,11 +1479,14 @@ export async function dump(dir: string, options: DumpOptions = {}): Promise<void
14791479
}
14801480
}
14811481
else {
1482-
// Always print a final activation message, even in quiet mode
1483-
const { config } = await import('../config')
1484-
const activation = (config.shellActivationMessage || '✅ Environment activated for {path}')
1485-
.replace('{path}', process.cwd())
1486-
console.log(activation)
1482+
// Print a final activation message, but skip in shell integration mode to avoid duplicates
1483+
// (shell integration handles its own custom activation messages)
1484+
if (!isShellIntegration) {
1485+
const { config } = await import('../config')
1486+
const activation = (config.shellActivationMessage || '✅ Environment activated for {path}')
1487+
.replace('{path}', process.cwd())
1488+
console.log(activation)
1489+
}
14871490
addTiming('total', tTotal)
14881491
flushTimings('regular-activation')
14891492

@@ -1590,6 +1593,7 @@ async function installPackagesOptimized(
15901593
}
15911594
catch (error) {
15921595
globalInstallSuccess = false
1596+
// Only show installation warnings in non-shell-integration mode to avoid confusing messages
15931597
if (!quiet && !isShellIntegration) {
15941598
console.warn(`Failed to install some global packages: ${error instanceof Error ? error.message : String(error)}`)
15951599
}
@@ -1619,6 +1623,7 @@ async function installPackagesOptimized(
16191623
}
16201624
catch (error) {
16211625
localInstallSuccess = false
1626+
// Only show installation warnings in non-shell-integration mode to avoid confusing messages
16221627
if (!quiet && !isShellIntegration) {
16231628
console.warn(`Failed to install some local packages: ${error instanceof Error ? error.message : String(error)}`)
16241629
}
@@ -1659,30 +1664,19 @@ async function installPackagesOptimized(
16591664

16601665
// Output environment warning messages AFTER all cleanup with a small delay
16611666
// Use the original quiet parameter, not effectiveQuiet, for environment warnings
1662-
if (needsEnvironmentWarning && !quiet) {
1667+
// Skip confusing messages in shell integration mode - they're not helpful for users
1668+
if (needsEnvironmentWarning && !quiet && !isShellIntegration) {
16631669
// Add a small delay to ensure all install function cleanup is complete
16641670
await new Promise(resolve => setTimeout(resolve, 50))
16651671

1666-
if (isShellIntegration) {
1667-
process.stderr.write('Environment not ready\n')
1668-
if (localPackages.length > 0) {
1669-
process.stderr.write('Local packages need installation\n')
1670-
}
1671-
if (globalPackages.length > 0) {
1672-
process.stderr.write('Global packages need installation\n')
1673-
}
1674-
process.stderr.write('Generating minimal shell environment for development\n')
1672+
console.warn('Environment not ready')
1673+
if (localPackages.length > 0) {
1674+
console.warn('Local packages need installation')
16751675
}
1676-
else {
1677-
console.warn('Environment not ready')
1678-
if (localPackages.length > 0) {
1679-
console.warn('Local packages need installation')
1680-
}
1681-
if (globalPackages.length > 0) {
1682-
console.warn('Global packages need installation')
1683-
}
1684-
console.warn('Generating minimal shell environment for development')
1676+
if (globalPackages.length > 0) {
1677+
console.warn('Global packages need installation')
16851678
}
1679+
console.warn('Generating minimal shell environment for development')
16861680
}
16871681
}
16881682

packages/launchpad/src/dev/path-scanner.ts

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export async function scanLibraryPaths(envDir: string): Promise<string[]> {
2525
const entries = readdirSync(envDir, { withFileTypes: true })
2626

2727
for (const entry of entries) {
28-
if (!entry.isDirectory()) continue
28+
if (!entry.isDirectory())
29+
continue
2930

3031
const domainName = entry.name
3132

@@ -41,7 +42,8 @@ export async function scanLibraryPaths(envDir: string): Promise<string[]> {
4142
const versionEntries = readdirSync(domainDir, { withFileTypes: true })
4243

4344
for (const versionEntry of versionEntries) {
44-
if (!versionEntry.isDirectory() || !versionEntry.name.startsWith('v')) continue
45+
if (!versionEntry.isDirectory() || !versionEntry.name.startsWith('v'))
46+
continue
4547

4648
const versionDir = join(domainDir, versionEntry.name)
4749

@@ -56,12 +58,14 @@ export async function scanLibraryPaths(envDir: string): Promise<string[]> {
5658
}
5759
}
5860
}
59-
} catch {
61+
}
62+
catch {
6063
// Skip directories we can't read
6164
continue
6265
}
6366
}
64-
} catch {
67+
}
68+
catch {
6569
// If we can't read the env directory, return what we have
6670
}
6771

@@ -92,7 +96,8 @@ export async function scanGlobalPaths(globalDir: string): Promise<string[]> {
9296
const entries = readdirSync(globalDir, { withFileTypes: true })
9397

9498
for (const entry of entries) {
95-
if (!entry.isDirectory()) continue
99+
if (!entry.isDirectory())
100+
continue
96101

97102
const domainName = entry.name
98103

@@ -111,8 +116,8 @@ export async function scanGlobalPaths(globalDir: string): Promise<string[]> {
111116
.map(entry => entry.name)
112117
.sort((a, b) => {
113118
// Simple version sort - extract numbers and compare
114-
const aNum = a.slice(1).split('.').map(n => parseInt(n, 10) || 0)
115-
const bNum = b.slice(1).split('.').map(n => parseInt(n, 10) || 0)
119+
const aNum = a.slice(1).split('.').map(n => Number.parseInt(n, 10) || 0)
120+
const bNum = b.slice(1).split('.').map(n => Number.parseInt(n, 10) || 0)
116121

117122
for (let i = 0; i < Math.max(aNum.length, bNum.length); i++) {
118123
const aPart = aNum[i] || 0
@@ -137,12 +142,14 @@ export async function scanGlobalPaths(globalDir: string): Promise<string[]> {
137142
}
138143
}
139144
}
140-
} catch {
145+
}
146+
catch {
141147
// Skip directories we can't read
142148
continue
143149
}
144150
}
145-
} catch {
151+
}
152+
catch {
146153
// If we can't read the global directory, return what we have
147154
}
148155

@@ -159,7 +166,8 @@ async function hasValidLibraries(libDir: string, domainName: string, versionDir:
159166

160167
// Check for common library patterns
161168
for (const entry of entries) {
162-
if (!entry.isFile()) continue
169+
if (!entry.isFile())
170+
continue
163171

164172
const name = entry.name
165173

@@ -171,7 +179,8 @@ async function hasValidLibraries(libDir: string, domainName: string, versionDir:
171179
if (stats > 100) {
172180
return true
173181
}
174-
} catch {
182+
}
183+
catch {
175184
// If we can't get size, assume it's valid
176185
return true
177186
}
@@ -184,7 +193,8 @@ async function hasValidLibraries(libDir: string, domainName: string, versionDir:
184193
}
185194

186195
return false
187-
} catch {
196+
}
197+
catch {
188198
return false
189199
}
190200
}
@@ -205,13 +215,14 @@ export async function checkEnvironmentReady(envDir: string): Promise<{
205215
try {
206216
const libPaths = await scanLibraryPaths(envDir)
207217
hasLibraries = libPaths.length > 0
208-
} catch {
218+
}
219+
catch {
209220
hasLibraries = false
210221
}
211222

212223
return {
213224
ready: binExists, // Environment is ready if bin directory exists
214225
binExists,
215-
hasLibraries
226+
hasLibraries,
216227
}
217228
}

0 commit comments

Comments
 (0)