MCPcopy Create free account
hub / github.com/vercel/vercel / createDetectEntrypoint

Function createDetectEntrypoint

packages/cli/src/util/projects/detect-entrypoint.ts:23–53  ·  view source on GitHub ↗
(
  projectRoot: string
)

Source from the content-addressed store, hash-verified

21 * environments) until a runtime framework is actually detected.
22 */
23export function createDetectEntrypoint(
24 projectRoot: string
25): DetectEntrypointFn {
26 return async ({ workPath, framework }): Promise<DetectedEntrypoint> => {
27 // Normalize to forward slashes so the path is platform-consistent;
28 // Node's `fs` accepts either separator on Windows.
29 const absWorkPath = normalizePath(join(projectRoot, workPath));
30 // Builder packages ship without `.d.ts`; casts re-narrow the
31 // `allowJs`-inferred return type back to `DetectedEntrypoint`.
32 if (isPythonFramework(framework)) {
33 const { detectEntrypoint } = await import('@vercel/python');
34 return detectEntrypoint({
35 workPath: absWorkPath,
36 framework,
37 }) as Promise<DetectedEntrypoint>;
38 }
39 if (isNodeBackendFramework(framework)) {
40 const { detectEntrypoint } = await import('@vercel/backends');
41 return detectEntrypoint({
42 workPath: absWorkPath,
43 }) as Promise<DetectedEntrypoint>;
44 }
45 if (framework === 'go') {
46 const { detectEntrypoint } = await import('@vercel/go');
47 return detectEntrypoint({
48 workPath: absWorkPath,
49 }) as Promise<DetectedEntrypoint>;
50 }
51 return null;
52 };
53}

Callers 3

getServicesSetupStateFunction · 0.90
tryDetectServicesFunction · 0.90

Calls 4

normalizePathFunction · 0.90
isPythonFrameworkFunction · 0.90
isNodeBackendFrameworkFunction · 0.90
detectEntrypointFunction · 0.50

Tested by

no test coverage detected