Skip to content

Commit 223bc5d

Browse files
committed
chore: wip
1 parent d6ad98d commit 223bc5d

11 files changed

+47
-95
lines changed

packages/launchpad/src/binary-downloader.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as fs from 'node:fs'
55
import * as path from 'node:path'
66
import process from 'node:process'
77
import { config } from './config'
8+
import type { GitHubRelease } from './types'
89

910
export interface BinaryInfo {
1011
filename: string
@@ -216,10 +217,10 @@ export class PrecompiledBinaryDownloader {
216217
throw new Error(`GitHub API error: ${response.status} ${response.statusText}`)
217218
}
218219

219-
const release = await response.json()
220+
const release = await response.json() as GitHubRelease
220221

221222
// Find manifest.json in release assets
222-
const manifestAsset = release.assets?.find((asset: any) => asset.name === 'manifest.json')
223+
const manifestAsset = release.assets?.find((asset) => asset.name === 'manifest.json')
223224
if (!manifestAsset) {
224225
throw new Error('No manifest.json found in latest release')
225226
}
@@ -230,11 +231,11 @@ export class PrecompiledBinaryDownloader {
230231
throw new Error(`Failed to download manifest: ${manifestResponse.statusText}`)
231232
}
232233

233-
const manifest: BinaryManifest = await manifestResponse.json()
234+
const manifest = await manifestResponse.json() as BinaryManifest
234235

235236
// Add download URLs to binaries
236237
manifest.binaries = manifest.binaries.map((binary) => {
237-
const asset = release.assets?.find((asset: any) => asset.name === binary.filename)
238+
const asset = release.assets?.find((asset) => asset.name === binary.filename)
238239
return {
239240
...binary,
240241
download_url: asset?.browser_download_url || '',

packages/launchpad/src/config.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,6 @@ export const defaultConfig: LaunchpadConfig = {
168168
timeout: 600000, // 10 minutes
169169
debug: false,
170170
},
171-
libraryFixes: {
172-
systemLibraryPaths: [
173-
'/opt/homebrew/lib',
174-
'/usr/local/lib',
175-
'/usr/lib',
176-
],
177-
},
178-
shim: {
179-
optimizeLibraryPath: true,
180-
environmentVariables: {},
181-
},
182171
},
183172
},
184173
}

packages/launchpad/src/dev/dump.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export async function detectLaravelProject(dir: string): Promise<{ isLaravel: bo
200200
}
201201

202202
// Execute post-setup commands if enabled
203-
if (config.services.frameworks.laravel.postSetupCommands.enabled) {
203+
if (config.services.frameworks.laravel.postSetupCommands?.enabled) {
204204
const postSetupResults = await executePostSetupCommands(dir, config.services.frameworks.laravel.postSetupCommands.commands)
205205
suggestions.push(...postSetupResults)
206206
}
@@ -264,8 +264,6 @@ function evaluateCommandCondition(condition: PostSetupCommand['condition'], proj
264264
switch (condition) {
265265
case 'always':
266266
return true
267-
case 'never':
268-
return false
269267
case 'hasUnrunMigrations':
270268
return hasUnrunMigrations(projectDir)
271269
case 'hasSeeders':

packages/launchpad/src/install.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,12 +2983,12 @@ async function installPackage(packageName: string, packageSpec: string, installP
29832983
}
29842984

29852985
// Install all PHP dependencies from ts-pkgx (includes build tools and runtime deps)
2986-
await installPhpBuildDependencies(installPath)
2986+
// PHP build dependencies are no longer needed with precompiled binaries
29872987

29882988
if (config.verbose) {
29892989
console.log('✅ All PHP dependencies ready - starting build...')
29902990
}
2991-
return await buildPhpFromSource(installPath, requestedVersion)
2991+
throw new Error('Source builds are no longer supported. Use precompiled binaries instead.')
29922992
}
29932993

29942994
// Special handling for zlib - disabled, let ts-pkgx handle it

packages/launchpad/src/php/php-shim.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,12 @@ export class PHPShimManager {
9696
const issues: string[] = []
9797
const recommendations: string[] = []
9898

99-
// Add system library paths if they exist
100-
for (const libPath of this.phpConfig.libraryFixes.systemLibraryPaths) {
99+
// Add common system library paths if they exist
100+
const commonLibPaths = ['/opt/homebrew/lib', '/usr/local/lib', '/usr/lib']
101+
for (const libPath of commonLibPaths) {
101102
if (fs.existsSync(libPath)) {
102103
libraryPaths.push(libPath)
103104
}
104-
else {
105-
issues.push(`System library path not found: ${libPath}`)
106-
}
107105
}
108106

109107
// Detect Launchpad environment libraries
@@ -128,14 +126,9 @@ export class PHPShimManager {
128126
// Add other optimizations
129127
environmentVariables.DYLD_FALLBACK_LIBRARY_PATH = '/opt/homebrew/lib:/usr/local/lib:/usr/lib'
130128

131-
// Configure PHP-specific optimizations
132-
if (this.phpConfig.shim.optimizeLibraryPath) {
133-
environmentVariables.PHP_INI_SCAN_DIR = '/opt/homebrew/etc/php/8.4/conf.d'
134-
recommendations.push('Optimized PHP configuration scanning')
135-
}
136-
137-
// Merge user-configured environment variables
138-
Object.assign(environmentVariables, this.phpConfig.shim.environmentVariables)
129+
// Configure PHP-specific optimizations for precompiled binaries
130+
environmentVariables.PHP_INI_SCAN_DIR = '/opt/homebrew/etc/php/8.4/conf.d'
131+
recommendations.push('Configured PHP configuration scanning')
139132

140133
return {
141134
libraryPaths,

packages/launchpad/src/php/php-strategy.ts

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
import { getLatestVersion, packages } from 'ts-pkgx'
8-
import { buildPhpFromSource } from '../install'
98

109
/**
1110
* Get the latest PHP version with fallback logic
@@ -90,39 +89,8 @@ export class SourceBuildPHPStrategy implements PHPStrategy {
9089
// Store the version for later use
9190
this.installedVersion = latestVersion
9291

93-
// Build PHP from source in the current environment
94-
const envDir = path.join(os.homedir(), '.local', 'share', 'launchpad', 'envs', 'global')
95-
const _installedFiles = await buildPhpFromSource(envDir, latestVersion)
96-
97-
const phpBinary = path.join(envDir, 'php.net', `v${latestVersion}`, 'bin', 'php')
98-
99-
// Test the installation
100-
const testResult = await this.testPHPInstallation(phpBinary)
101-
102-
return {
103-
success: testResult.success,
104-
phpPath: phpBinary,
105-
version: testResult.version || latestVersion,
106-
extensions: testResult.extensions || [],
107-
databaseSupport: {
108-
sqlite: true, // Built with SQLite support
109-
mysql: true, // Built with MySQL support
110-
postgresql: true, // Built with PostgreSQL support
111-
extensions: {
112-
pdo_sqlite: true,
113-
pdo_mysql: true,
114-
pdo_pgsql: true,
115-
mysqli: true,
116-
pgsql: true,
117-
},
118-
},
119-
libraryIssues: [],
120-
recommendations: [
121-
'PHP built from source with full database support',
122-
'All libraries properly linked during compilation',
123-
'Ready for Laravel development',
124-
],
125-
}
92+
// Source builds are no longer supported - use precompiled binaries instead
93+
throw new Error('Source builds are no longer supported. Use precompiled binaries via the main install command.')
12694
}
12795
catch (error) {
12896
return {

packages/launchpad/src/types.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
import type { Version } from '../test/version'
22
import type { Path } from './path'
33

4+
// GitHub API types
5+
export interface GitHubAsset {
6+
name: string
7+
browser_download_url: string
8+
size: number
9+
content_type: string
10+
}
11+
12+
export interface GitHubRelease {
13+
tag_name: string
14+
name: string
15+
body: string
16+
assets: GitHubAsset[]
17+
draft: boolean
18+
prerelease: boolean
19+
}
20+
421
export interface LaunchpadConfig {
522
/** Enable verbose logging (default: false) */
623
verbose: boolean

packages/launchpad/test/deps-yaml-integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ services:
260260
fs.writeFileSync(path.join(globalDir, 'global-tool'), 'global')
261261

262262
// Test cleanup with the temp directory
263-
TestUtils.cleanupEnvironmentDirs(tempDir)
263+
TestUtils.cleanupEnvironmentDirs()
264264

265265
// Test environment should be cleaned
266266
expect(fs.existsSync(testEnvDir)).toBe(false)

packages/launchpad/test/end-to-end-integration.test.ts

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -126,26 +126,12 @@ dependencies:
126126
// Import the Homebrew-style PHP build function
127127
const installModule = await import('../src/install')
128128

129-
// Check if the function exists
130-
if (typeof installModule.buildPhpFromSource === 'function') {
131-
const installPath = path.join(testHome, '.local', 'share', 'launchpad', 'envs', 'test-env')
132-
fs.mkdirSync(installPath, { recursive: true })
133-
134-
// In test mode, we expect this to handle gracefully
135-
try {
136-
const result = await installModule.buildPhpFromSource(installPath, '8.4.0')
137-
expect(result).toBeDefined()
138-
expect(Array.isArray(result)).toBe(true)
139-
}
140-
catch (error) {
141-
// In test mode, source building may fail but should be handled gracefully
142-
expect(error instanceof Error).toBe(true)
143-
}
144-
}
145-
else {
146-
// Function not exported yet, test passes by checking it exists in structure
147-
expect(typeof installModule).toBe('object')
148-
}
129+
// Source builds are no longer supported - test that error is thrown appropriately
130+
// Note: buildPhpFromSource function has been removed
131+
expect(true).toBe(true) // Placeholder test since source builds are removed
132+
133+
// Function not exported since source builds are no longer supported
134+
expect(typeof installModule).toBe('object')
149135
}
150136
catch (importError) {
151137
// If import fails, that's a test failure we need to address

packages/launchpad/test/install-deps-only.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ describe('Install Dependencies Only', () => {
115115

116116
// Should mention both packages
117117
const logCalls = mockConsoleLog.mock.calls.flat()
118-
expect(logCalls.some(call => call.includes('php'))).toBe(true)
119-
expect(logCalls.some(call => call.includes('nodejs'))).toBe(true)
118+
expect(logCalls.some((call: any) => call.includes('php'))).toBe(true)
119+
expect(logCalls.some((call: any) => call.includes('nodejs'))).toBe(true)
120120
})
121121

122122
it('should handle empty package list gracefully', async () => {
@@ -130,7 +130,7 @@ describe('Install Dependencies Only', () => {
130130
it('should handle packages with no dependencies', async () => {
131131
// Mock a package with no dependencies
132132
const tempPantry = { ...mockPantry }
133-
tempPantry.test = { dependencies: [] }
133+
;(tempPantry as any).test = { dependencies: [] }
134134

135135
const packages = ['test']
136136
const results = await installDependenciesOnly(packages, tempDir)
@@ -148,7 +148,7 @@ describe('Install Dependencies Only', () => {
148148

149149
// Should warn about missing package
150150
const warnCalls = mockConsoleWarn.mock.calls.flat()
151-
expect(warnCalls.some(call => call.includes('not found in pantry'))).toBe(true)
151+
expect(warnCalls.some((call: any) => call.includes('not found in pantry'))).toBe(true)
152152
})
153153

154154
it('should use provided install path', async () => {
@@ -167,7 +167,7 @@ describe('Install Dependencies Only', () => {
167167

168168
// Should not mention installing PHP itself, only dependencies
169169
const logCalls = mockConsoleLog.mock.calls.flat()
170-
const installMainPackage = logCalls.some(call =>
170+
const installMainPackage = logCalls.some((call: any) =>
171171
call.includes('Installing php') && !call.includes('dependencies'),
172172
)
173173
expect(installMainPackage).toBe(false)
@@ -227,7 +227,7 @@ describe('Install Dependencies Only', () => {
227227

228228
// Should warn about missing package
229229
const warnCalls = mockConsoleWarn.mock.calls.flat()
230-
expect(warnCalls.some(call => call.includes('not found in pantry'))).toBe(true)
230+
expect(warnCalls.some((call: any) => call.includes('not found in pantry'))).toBe(true)
231231
})
232232

233233
it('should handle individual dependency installation failures', async () => {

0 commit comments

Comments
 (0)