MCPcopy
hub / github.com/prisma/prisma / detectProjectState

Function detectProjectState

packages/cli/src/bootstrap/project-state.ts:90–110  ·  view source on GitHub ↗
(baseDir: string)

Source from the content-addressed store, hash-verified

88}
89
90export function detectProjectState(baseDir: string): ProjectState {
91 const schemaPath = findSchemaPath(baseDir)
92 const hasSchemaFile = schemaPath !== null
93 let hasModels = false
94
95 if (schemaPath) {
96 try {
97 const content = fs.readFileSync(schemaPath, 'utf-8')
98 hasModels = MODEL_PATTERN.test(content)
99 } catch {}
100 }
101
102 return {
103 hasPackageJson: fs.existsSync(path.join(baseDir, 'package.json')),
104 hasSchemaFile,
105 hasPrismaConfig: fs.existsSync(path.join(baseDir, 'prisma.config.ts')),
106 hasEnvFile: fs.existsSync(path.join(baseDir, '.env')),
107 hasModels,
108 hasSeedScript: checkSeedScript(baseDir),
109 }
110}

Callers 2

runMethod · 0.90

Calls 2

findSchemaPathFunction · 0.85
checkSeedScriptFunction · 0.85

Tested by

no test coverage detected