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

Function findValidEntrypoint

packages/python/src/entrypoint.ts:319–339  ·  view source on GitHub ↗
(
  workPath: string,
  candidates: string[]
)

Source from the content-addressed store, hash-verified

317}
318
319async function findValidEntrypoint(
320 workPath: string,
321 candidates: string[]
322): Promise<FindResult> {
323 const existingWithoutEntrypoint: string[] = [];
324 for (const candidate of candidates) {
325 const absPath = join(workPath, candidate);
326 if (!(await fileExists(absPath))) continue;
327 const content = await fs.promises.readFile(absPath, 'utf-8');
328 const varName = await findAppOrHandler(content);
329 if (varName) {
330 debug(`Detected Python entrypoint: ${candidate} (variable: ${varName})`);
331 return {
332 entrypoint: { entrypoint: candidate, variableName: varName },
333 existingWithoutEntrypoint,
334 };
335 }
336 existingWithoutEntrypoint.push(candidate);
337 }
338 return { entrypoint: null, existingWithoutEntrypoint };
339}
340
341/**
342 * Check if manage.py exists in workPath and references DJANGO_SETTINGS_MODULE.

Callers 2

Calls 4

findAppOrHandlerFunction · 0.90
debugFunction · 0.90
fileExistsFunction · 0.70
pushMethod · 0.65

Tested by

no test coverage detected