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

Function hasExpoRouter

cli/src/utils/project-detection.ts:147–163  ·  view source on GitHub ↗
(targetPath?: string)

Source from the content-addressed store, hash-verified

145 * Checks for expo-router dependency in package.json
146 */
147export async function hasExpoRouter(targetPath?: string): Promise<boolean> {
148 const projectPath = targetPath || process.cwd();
149 const packageJsonPath = path.join(projectPath, "package.json");
150
151 try {
152 const packageJson = await fs.readJson(packageJsonPath);
153
154 // Check if expo-router is in dependencies
155 const hasExpoRouterDep =
156 packageJson.dependencies?.["expo-router"] ||
157 packageJson.devDependencies?.["expo-router"];
158
159 return !!hasExpoRouterDep;
160 } catch (error) {
161 return false;
162 }
163}
164
165/**
166 * Creates an index.ts file for Expo Router projects with craftrn-ui theme import

Callers 1

initCommandFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected