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

Function main

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

Source from the content-addressed store, hash-verified

441}
442
443function main() {
444 console.log('\n🗄️ Setting up database development tools...\n')
445 console.log('This will install Docker, Docker Compose, and Supabase CLI.\n')
446
447 let hasErrors = false
448
449 // Step 1: Check/Install Docker
450 console.log('📦 Step 1/3: Checking docker...')
451 if (checkToolExists(docker.command, docker.checkCommand)) {
452 try {
453 const version = execSync(docker.checkCommand, { encoding: 'utf-8' }).trim()
454 console.log(`✅ Docker is already installed (${version})`)
455 } catch {
456 console.log('✅ Docker is already installed')
457 }
458
459 // Check if Docker daemon is running
460 if (checkDockerRunning()) {
461 console.log('✅ Docker daemon is running')
462 } else {
463 console.log('\n⚠️ Docker is installed but daemon is not running.')
464 const os = getPlatform()
465 if (os === 'linux') {
466 console.log(' Please start it with: sudo systemctl start docker')
467 } else if (os === 'macos') {
468 console.log(' Please start Docker Desktop from Applications')
469 }
470 console.log(' Supabase CLI requires Docker to be running.\n')
471 }
472 } else {
473 console.log('📥 Docker is not installed (required)')
474 const installed = installDocker()
475 if (!installed) {
476 console.error('\n❌ Docker is required but installation failed')
477 console.error('Please install Docker manually and try again.\n')
478 exit(1)
479 }
480 }
481
482 // Step 2: Check Docker Compose
483 console.log('\n📦 Step 2/3: Checking Docker Compose...')
484 if (!checkDockerCompose()) {
485 console.error('\n❌ Docker Compose is required but not available')
486 console.error('Docker Compose should be included with Docker installation.')
487 hasErrors = true
488 }
489
490 // Step 3: Check/Install Supabase CLI
491 console.log('\n📦 Step 3/3: Checking Supabase CLI...')
492 if (checkToolExists(supabase.command, supabase.checkCommand)) {
493 try {
494 const version = execSync(supabase.checkCommand, { encoding: 'utf-8' }).trim()
495 console.log(`✅ Supabase CLI is already installed (${version})`)
496 } catch {
497 console.log('✅ Supabase CLI is already installed')
498 }
499 } else {
500 console.log(

Callers 1

setup-database.mjsFile · 0.70

Calls 6

checkDockerRunningFunction · 0.85
installDockerFunction · 0.85
checkDockerComposeFunction · 0.85
installSupabaseFunction · 0.85
checkToolExistsFunction · 0.70
getPlatformFunction · 0.70

Tested by

no test coverage detected