MCPcopy Create free account
hub / github.com/Snapchat/Valdi / linuxSetup

Function linuxSetup

npm_modules/cli/src/setup/linuxSetup.ts:53–237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51}
52
53export 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

Callers 1

beginEnvironmentSetupFunction · 0.90

Calls 15

runShellMethod · 0.95
downloadToPathMethod · 0.95
onCompleteMethod · 0.95
detectLinuxDistroFunction · 0.90
wrapInColorFunction · 0.90
getCommonPackageMappingsFunction · 0.90
checkCommandExistsFunction · 0.90
getPackageNameFunction · 0.90
buildInstallCommandFunction · 0.90
getDebianArchitectureFunction · 0.85

Tested by

no test coverage detected