Skip to content

Commit 436384e

Browse files
committed
chore: wip
1 parent 5d647d5 commit 436384e

File tree

3 files changed

+74
-31
lines changed

3 files changed

+74
-31
lines changed

packages/launchpad/bin/cli.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ cli
779779
.option('--shell', 'Output shell code for evaluation (use with eval)')
780780
.example('launchpad install node python')
781781
.example('launchpad install --path ~/.local node python')
782-
.example('launchpad install --deps-only php')
782+
.example('launchpad install php --deps-only')
783783
.example('launchpad install')
784784
.example('launchpad install ./my-project')
785785
.example('launchpad install --global-deps')
@@ -831,8 +831,6 @@ cli
831831
console.log(` ${file}`)
832832
})
833833
}
834-
} else {
835-
console.log('⚠️ No dependencies were installed')
836834
}
837835
}
838836
return

packages/launchpad/src/binary-downloader.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Buffer } from 'node:buffer'
33
import { execSync } from 'node:child_process'
44
import * as fs from 'node:fs'
55
import * as path from 'node:path'
6+
import process from 'node:process'
67
import { config } from './config'
78

89
export interface BinaryInfo {

packages/launchpad/src/install.ts

Lines changed: 72 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { Buffer } from 'node:buffer'
33
import { execSync } from 'node:child_process'
44
import fs from 'node:fs'
5-
import os, { arch, platform } from 'node:os'
5+
import { arch, platform } from 'node:os'
66
import path from 'node:path'
77
import process from 'node:process'
88
import { aliases, packages } from 'ts-pkgx'
@@ -2227,7 +2227,14 @@ export async function downloadPackage(
22272227
// Validate package completeness and trigger source build if incomplete
22282228
const isValidPackage = await validatePackageInstallation(packageDir, domain)
22292229
if (!isValidPackage) {
2230-
logUniqueMessage(`⚠️ Package ${domain} appears incomplete, source build not available...`)
2230+
// Some packages like ca-certs don't have traditional binaries, so this is expected
2231+
if (domain.includes('ca-certs')) {
2232+
if (config.verbose) {
2233+
logUniqueMessage(`ℹ️ ${domain} installed (certificate bundle, no binaries expected)`)
2234+
}
2235+
} else {
2236+
logUniqueMessage(`⚠️ Package ${domain} appears incomplete, source build not available...`)
2237+
}
22312238
}
22322239

22332240
// Find binaries and create shims
@@ -4165,6 +4172,8 @@ export async function installDependenciesOnly(packages: string[], installPath?:
41654172
await fs.promises.mkdir(targetPath, { recursive: true })
41664173

41674174
const allInstalledFiles: string[] = []
4175+
let totalDepsProcessed = 0
4176+
let totalDepsAlreadyInstalled = 0
41684177

41694178
try {
41704179
// Import pantry from ts-pkgx to get package dependencies
@@ -4175,12 +4184,23 @@ export async function installDependenciesOnly(packages: string[], installPath?:
41754184
const domain = resolvePackageName(packageName)
41764185

41774186
// Try different ways to find the package in pantry
4178-
const packageKey = Object.keys(pantry).find(key =>
4179-
key === domain
4180-
|| key === packageName
4181-
|| key.includes(packageName)
4182-
|| key.includes(domain.split('.')[0]),
4183-
)
4187+
// For PHP, we need to check php.net specifically
4188+
let packageKey: string | undefined
4189+
4190+
// First, try exact matches
4191+
packageKey = Object.keys(pantry).find(key => key === domain || key === packageName)
4192+
4193+
// Handle PHP special case - check phpnet specifically
4194+
if (!packageKey && packageName === 'php') {
4195+
packageKey = Object.keys(pantry).find(key => key === 'phpnet')
4196+
}
4197+
4198+
// Fallback to partial matches only if no exact match found
4199+
if (!packageKey) {
4200+
packageKey = Object.keys(pantry).find(key =>
4201+
key.includes(packageName) || key.includes(domain.split('.')[0])
4202+
)
4203+
}
41844204

41854205
const packageSpec = packageKey ? pantry[packageKey] : null
41864206

@@ -4190,56 +4210,72 @@ export async function installDependenciesOnly(packages: string[], installPath?:
41904210
}
41914211

41924212
if (config.verbose) {
4193-
console.warn(`${packageName} dependencies: ${packageSpec.dependencies.join(', ')}`)
4213+
console.log(`📋 ${packageName} has ${packageSpec.dependencies.length} dependencies: ${packageSpec.dependencies.join(', ')}`)
41944214
}
41954215

4196-
// Filter out problematic dependencies that cause builds to hang
4216+
// Filter out problematic dependencies - these are now included since source builds don't exist
41974217
const skipPatterns = [
4198-
'zlib.net', // Causes build failures
4199-
'libzip.org', // Complex build
4200-
'gnome.org/libxslt', // Complex build
4201-
'libpng.org', // Complex build
4202-
'google.com/webp', // Complex build
4203-
'ijg.org', // Complex build
4204-
'gnu.org/gmp', // Let ts-pkgx handle GMP instead of custom build
4218+
// Only skip dependencies that are truly problematic or incompatible
42054219
]
42064220

42074221
const filteredDeps = packageSpec.dependencies.filter(dep =>
42084222
!skipPatterns.some(pattern => dep.includes(pattern)),
42094223
)
42104224

42114225
if (filteredDeps.length === 0) {
4212-
console.log(`✅ No dependencies to install for ${packageName}`)
4226+
console.log(`✅ No installable dependencies found for ${packageName}`)
42134227
continue
42144228
}
42154229

4216-
// Filter out already installed dependencies
4230+
// Filter out already installed dependencies and the main package itself
42174231
const depsToInstall = filteredDeps.filter((dep) => {
4218-
const depInstallPath = path.join(targetPath, dep.split(/[<>=~^]/)[0])
4232+
const depDomain = dep.split(/[<>=~^]/)[0]
4233+
4234+
// Skip if this dependency is the same as the main package we're installing deps for
4235+
if (depDomain === domain || depDomain === packageName ||
4236+
(packageName === 'php' && depDomain === 'php.net') ||
4237+
(domain === 'php.net' && depDomain === 'php.net')) {
4238+
if (config.verbose) {
4239+
console.log(`⏭️ Skipping ${dep} (this is the main package, not a dependency)`)
4240+
}
4241+
return false
4242+
}
4243+
4244+
const depInstallPath = path.join(targetPath, depDomain)
42194245
const alreadyInstalled = fs.existsSync(depInstallPath)
4220-
if (alreadyInstalled && config.verbose) {
4221-
console.log(`✅ ${dep} already installed`)
4246+
if (alreadyInstalled) {
4247+
totalDepsAlreadyInstalled++
4248+
if (config.verbose) {
4249+
console.log(`✅ ${dep} already installed`)
4250+
}
42224251
}
42234252
return !alreadyInstalled
42244253
})
42254254

4255+
totalDepsProcessed += filteredDeps.length
4256+
42264257
if (depsToInstall.length === 0) {
4227-
console.log(`✅ All dependencies for ${packageName} already installed`)
4258+
if (config.verbose) {
4259+
console.log(`✅ All ${filteredDeps.length} dependencies for ${packageName} already installed`)
4260+
}
42284261
continue
42294262
}
42304263

4231-
console.log(`📦 Installing ${depsToInstall.length} dependencies for ${packageName}...`)
4264+
console.log(`📦 Installing ${depsToInstall.length} new dependencies for ${packageName}...`)
4265+
if (config.verbose) {
4266+
console.log(` Dependencies to install: ${depsToInstall.join(', ')}`)
4267+
}
42324268

42334269
try {
42344270
// Install dependencies using the main install function
42354271
const installedFiles = await install(depsToInstall, targetPath)
42364272
allInstalledFiles.push(...installedFiles)
42374273

42384274
if (config.verbose) {
4239-
console.log(`✅ Installed ${packageName} dependencies: ${depsToInstall.join(', ')}`)
4275+
console.log(`✅ Successfully installed ${depsToInstall.length} dependencies for ${packageName}`)
42404276
}
4241-
}
4242-
catch (error) {
4277+
}
4278+
catch (error) {
42434279
console.warn(`⚠️ Some dependencies for ${packageName} failed to install, trying individual installation`)
42444280

42454281
// Fallback to individual installation
@@ -4258,7 +4294,15 @@ export async function installDependenciesOnly(packages: string[], installPath?:
42584294
}
42594295
}
42604296

4261-
console.log(`🎉 Dependencies installation complete. ${allInstalledFiles.length} files installed.`)
4297+
// Improved final message
4298+
if (allInstalledFiles.length > 0) {
4299+
console.log(`🎉 Dependencies installation complete. Installed ${allInstalledFiles.length} files for ${packages.join(', ')}.`)
4300+
} else if (totalDepsAlreadyInstalled > 0) {
4301+
console.log(`✅ All ${totalDepsAlreadyInstalled} dependencies for ${packages.join(', ')} were already installed.`)
4302+
} else {
4303+
console.log(`ℹ️ No dependencies found to install for ${packages.join(', ')}.`)
4304+
}
4305+
42624306
return allInstalledFiles
42634307
}
42644308
catch (error) {

0 commit comments

Comments
 (0)