( dep: string, isExpoProject: boolean )
| 248 | } |
| 249 | |
| 250 | async function installDependency( |
| 251 | dep: string, |
| 252 | isExpoProject: boolean |
| 253 | ): Promise<void> { |
| 254 | const packageName = dep.split("@")[0]; |
| 255 | const targetPath = process.cwd(); |
| 256 | |
| 257 | // For native dependencies in Expo projects, use expo install |
| 258 | const isExpoDep = |
| 259 | packageName.includes("react-native-svg") || |
| 260 | packageName.includes("react-native-reanimated") || |
| 261 | packageName.includes("react-native-gesture-handler"); |
| 262 | |
| 263 | if (isExpoProject && isExpoDep) { |
| 264 | await execAsync(`npx expo install ${packageName}`, { cwd: targetPath }); |
| 265 | } else { |
| 266 | // For unistyles or non-Expo projects, use regular package manager |
| 267 | const packageManager = await detectPackageManager(targetPath); |
| 268 | const installCommand = getInstallCommand(packageManager, dep); |
| 269 | await execAsync(installCommand, { cwd: targetPath }); |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | async function detectPackageManager( |
| 274 | targetPath: string |
no test coverage detected