(projectDir: string)
| 78 | |
| 79 | /** Checks if `DATABASE_URL` in the project's `.env` already points to a Prisma Postgres instance. */ |
| 80 | export function isAlreadyLinked(projectDir: string): boolean { |
| 81 | const envPath = path.join(projectDir, '.env') |
| 82 | |
| 83 | if (!fs.existsSync(envPath)) { |
| 84 | return false |
| 85 | } |
| 86 | |
| 87 | const parsed = dotenv.parse(fs.readFileSync(envPath, 'utf-8')) |
| 88 | return PRISMA_POSTGRES_URL_PATTERN.test(parsed.DATABASE_URL ?? '') |
| 89 | } |
| 90 | |
| 91 | /** Writes connection strings to `.env` and reports the `.gitignore` status. */ |
| 92 | export function writeLocalFiles(projectDir: string, connection: ConnectionResult): WriteLocalFilesResult { |
no test coverage detected