MCPcopy Index your code
hub / github.com/craftreactnative/ui / detectPackageManager

Function detectPackageManager

cli/src/commands/init.ts:273–283  ·  view source on GitHub ↗
(
  targetPath: string
)

Source from the content-addressed store, hash-verified

271}
272
273async function detectPackageManager(
274 targetPath: string
275): Promise<"npm" | "yarn" | "pnpm"> {
276 if (await fs.pathExists(path.join(targetPath, "yarn.lock"))) {
277 return "yarn";
278 }
279 if (await fs.pathExists(path.join(targetPath, "pnpm-lock.yaml"))) {
280 return "pnpm";
281 }
282 return "npm";
283}
284
285function getInstallCommand(
286 packageManager: "npm" | "yarn" | "pnpm",

Callers 1

installDependencyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected