()
| 51 | } |
| 52 | |
| 53 | export async function linuxSetup(): Promise<void> { |
| 54 | const devSetup = new DevSetupHelper(); |
| 55 | |
| 56 | // Detect Linux distribution |
| 57 | const distro = detectLinuxDistro(); |
| 58 | console.log( |
| 59 | wrapInColor( |
| 60 | `Detected distribution: ${distro.name} (${distro.packageManager.name})`, |
| 61 | ANSI_COLORS.BLUE_COLOR, |
| 62 | ), |
| 63 | ); |
| 64 | |
| 65 | if (distro.type === LinuxDistroType.UNKNOWN) { |
| 66 | console.log(); |
| 67 | console.log(wrapInColor('Unable to detect Linux distribution.', ANSI_COLORS.YELLOW_COLOR)); |
| 68 | console.log( |
| 69 | wrapInColor( |
| 70 | 'Please manually install the following dependencies and re-run this command:', |
| 71 | ANSI_COLORS.YELLOW_COLOR, |
| 72 | ), |
| 73 | ); |
| 74 | console.log(' - git'); |
| 75 | console.log(' - npm (Node.js)'); |
| 76 | console.log(' - openjdk-17-jdk (or equivalent Java 17 JDK)'); |
| 77 | console.log(' - watchman'); |
| 78 | console.log(' - adb (Android Debug Bridge)'); |
| 79 | console.log(' - fontconfig development libraries'); |
| 80 | console.log(' - zlib development libraries'); |
| 81 | console.log(); |
| 82 | console.log( |
| 83 | wrapInColor( |
| 84 | 'For manual installation instructions, see: https://github.com/Snapchat/Valdi/blob/main/docs/INSTALL.md', |
| 85 | ANSI_COLORS.BLUE_COLOR, |
| 86 | ), |
| 87 | ); |
| 88 | throw new Error('Unable to proceed with automatic setup on unknown Linux distribution'); |
| 89 | } |
| 90 | |
| 91 | const packageMappings = getCommonPackageMappings(); |
| 92 | |
| 93 | // Build list of packages to install |
| 94 | const packagesToInstall: string[] = []; |
| 95 | |
| 96 | // Always needed packages |
| 97 | if (!checkCommandExists('npm')) { |
| 98 | packagesToInstall.push(getPackageName(packageMappings['npm']!, distro)); |
| 99 | } |
| 100 | if (!checkCommandExists('java')) { |
| 101 | packagesToInstall.push(getPackageName(packageMappings['openjdk-17']!, distro)); |
| 102 | } |
| 103 | if (!checkCommandExists('watchman')) { |
| 104 | packagesToInstall.push(getPackageName(packageMappings['watchman']!, distro)); |
| 105 | } |
| 106 | if (!checkCommandExists('adb')) { |
| 107 | packagesToInstall.push(getPackageName(packageMappings['adb']!, distro)); |
| 108 | } |
| 109 | |
| 110 | // Development libraries |
no test coverage detected