MCPcopy Create free account
hub / github.com/blockmatic/basilic / installSupabase

Function installSupabase

scripts/setup-database.mjs:324–441  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

322}
323
324function installSupabase() {
325 const os = getPlatform()
326 const instructions = supabase[os]
327 const displayName = supabase.name
328
329 if (!instructions) {
330 console.error(`\n⚠️ Cannot install ${displayName} on ${os}`)
331 console.error(`Please install ${displayName} manually.`)
332 return false
333 }
334
335 // macOS: Try brew first if available
336 if (os === 'macos' && instructions.brew && checkBrewAvailable()) {
337 try {
338 console.log(`\n📦 Installing ${displayName} via Homebrew...`)
339 execSync(instructions.brew, { stdio: 'inherit' })
340 if (checkToolExists(supabase.command, supabase.checkCommand)) {
341 console.log(`✅ ${displayName} installed successfully`)
342 return true
343 }
344 } catch (error) {
345 console.error(`\n⚠️ Homebrew installation failed: ${error.message}`)
346 console.error(`Please install manually: ${instructions.manual}`)
347 return false
348 }
349 }
350
351 // Linux: Install .deb package
352 if (os === 'linux' && instructions.getDownloadUrl) {
353 try {
354 // Get latest version
355 const version = getLatestVersion(supabase.repo)
356 if (!version) {
357 console.error(`\n❌ Failed to get latest version for ${displayName}`)
358 if (instructions.manual) {
359 console.error(`Please install manually: ${instructions.manual}`)
360 }
361 return false
362 }
363
364 const downloadUrl = instructions.getDownloadUrl(version)
365 const debFile = '/tmp/supabase_linux_amd64.deb'
366
367 // Check for wget or curl
368 if (!checkWgetAvailable() && !checkCurlAvailable()) {
369 console.error('\n❌ Neither wget nor curl is available. Please install one of them.')
370 if (instructions.manual) {
371 console.error(`Please install manually: ${instructions.manual}`)
372 }
373 return false
374 }
375
376 console.log(`\n📦 Installing ${displayName} (version ${version})...`)
377 console.log(` Downloading from: ${downloadUrl}`)
378
379 // Download .deb file
380 let downloadCommand
381 if (checkWgetAvailable()) {

Callers 1

mainFunction · 0.85

Calls 6

checkWgetAvailableFunction · 0.85
getPlatformFunction · 0.70
checkBrewAvailableFunction · 0.70
checkToolExistsFunction · 0.70
getLatestVersionFunction · 0.70
checkCurlAvailableFunction · 0.70

Tested by

no test coverage detected