Skip to content

Commit 7e319c7

Browse files
committed
chore: improve library path management
chore: wip chore: wip
1 parent 57ad50b commit 7e319c7

File tree

10 files changed

+1509
-223
lines changed

10 files changed

+1509
-223
lines changed

bun.lock

Lines changed: 150 additions & 182 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
"bumpp": "^10.2.0",
3636
"bun-plugin-dtsx": "0.9.5",
3737
"changelogen": "^0.6.2",
38-
"chromium-bidi": "^7.2.0",
39-
"electron": "^37.2.3",
4038
"lint-staged": "^15.5.2",
4139
"simple-git-hooks": "^2.13.0",
4240
"typescript": "^5.8.3"

packages/launchpad/bin/cli.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,16 +1175,25 @@ cli
11751175
dryrun: options?.dryRun || false,
11761176
quiet: options?.quiet || false,
11771177
shellOutput: options?.shell || false,
1178+
skipGlobal: false, // Always enable global support in production CLI
11781179
})
11791180
}
11801181
catch (error) {
11811182
if (!options?.quiet && !options?.shell) {
11821183
console.error('Failed to set up dev environment:', error instanceof Error ? error.message : String(error))
11831184
}
11841185
else if (options?.shell) {
1185-
// For shell mode, output minimal fallback and don't exit with error
1186+
// For shell mode, output robust fallback that ensures basic system tools are available
11861187
// This prevents shell integration from hanging or failing
1187-
console.log('# Environment setup failed, using fallback')
1188+
console.log('# Environment setup failed, using system fallback')
1189+
console.log('# Ensure basic system paths are available')
1190+
console.log('for sys_path in /usr/local/bin /usr/bin /bin /usr/sbin /sbin; do')
1191+
console.log(' if [[ -d "$sys_path" && ":$PATH:" != *":$sys_path:"* ]]; then')
1192+
console.log(' export PATH="$PATH:$sys_path"')
1193+
console.log(' fi')
1194+
console.log('done')
1195+
console.log('# Clear command hash to ensure fresh lookups')
1196+
console.log('hash -r 2>/dev/null || true')
11881197
return
11891198
}
11901199
if (!options?.shell) {

packages/launchpad/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"dependencies": {
6666
"bunfig": "^0.10.1",
6767
"cac": "^6.7.14",
68-
"ts-pkgx": "0.3.163"
68+
"ts-pkgx": "0.3.164"
6969
},
7070
"devDependencies": {
7171
"bun-plugin-dtsx": "^0.9.5"

packages/launchpad/src/bun.ts

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,15 @@ export async function install_bun(installPath: string, version?: string): Promis
277277

278278
// Create a temporary directory for the download/extraction
279279
const tempDir = path.join(installPath, 'temp')
280-
fs.mkdirSync(tempDir, { recursive: true })
280+
try {
281+
fs.mkdirSync(tempDir, { recursive: true })
282+
}
283+
catch (error) {
284+
if (config.verbose) {
285+
console.warn(`Failed to create temp directory ${tempDir}:`, error)
286+
}
287+
throw new Error(`Failed to create temporary directory for bun installation: ${error instanceof Error ? error.message : String(error)}`)
288+
}
281289

282290
let zipPath: string
283291

@@ -293,7 +301,15 @@ export async function install_bun(installPath: string, version?: string): Promis
293301

294302
// Copy cached file to temp directory for extraction
295303
zipPath = path.join(tempDir, filename)
296-
fs.copyFileSync(cachedArchivePath, zipPath)
304+
try {
305+
fs.copyFileSync(cachedArchivePath, zipPath)
306+
}
307+
catch (error) {
308+
if (config.verbose) {
309+
console.warn(`Failed to copy cached bun from ${cachedArchivePath} to ${zipPath}:`, error)
310+
}
311+
throw new Error(`Failed to copy cached bun file: ${error instanceof Error ? error.message : String(error)}`)
312+
}
297313
}
298314
else {
299315
// Download new version
@@ -365,7 +381,15 @@ export async function install_bun(installPath: string, version?: string): Promis
365381
offset += chunk.length
366382
}
367383

368-
fs.writeFileSync(zipPath, buffer)
384+
try {
385+
fs.writeFileSync(zipPath, buffer)
386+
}
387+
catch (error) {
388+
if (config.verbose) {
389+
console.warn(`Failed to write bun archive to ${zipPath}:`, error)
390+
}
391+
throw new Error(`Failed to write bun download: ${error instanceof Error ? error.message : String(error)}`)
392+
}
369393
}
370394
else if (config.verbose) {
371395
// Verbose mode - show size info like CLI upgrade
@@ -384,7 +408,15 @@ export async function install_bun(installPath: string, version?: string): Promis
384408
else {
385409
// Fallback: use arrayBuffer approach for compatibility
386410
const arrayBuffer = await response.arrayBuffer()
387-
fs.writeFileSync(zipPath, new Uint8Array(arrayBuffer))
411+
try {
412+
fs.writeFileSync(zipPath, new Uint8Array(arrayBuffer))
413+
}
414+
catch (error) {
415+
if (config.verbose) {
416+
console.warn(`Failed to write bun archive to ${zipPath}:`, error)
417+
}
418+
throw new Error(`Failed to write bun download: ${error instanceof Error ? error.message : String(error)}`)
419+
}
388420
}
389421

390422
if (config.verbose)

0 commit comments

Comments
 (0)