Skip to content

Commit c5dd13d

Browse files
committed
feat(cli): add Prisma CLI path to version output
Adds the installation path of the Prisma CLI to the version command output. This helps users debug issues where multiple Prisma installations exist. Fixes #7771
1 parent 455853d commit c5dd13d

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

packages/cli/src/Version.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
} from '@prisma/internals'
1818
import { bold, dim, red } from 'kleur/colors'
1919
import os from 'os'
20+
import path from 'path'
2021

2122
import { getInstalledPrismaClientVersion } from './utils/getClientVersion'
2223

@@ -79,6 +80,9 @@ export class Version implements Command {
7980
const prismaClientVersion = await getInstalledPrismaClientVersion()
8081
const typescriptVersion = await getTypescriptVersion()
8182

83+
// Get the Prisma CLI path from the current file location
84+
const prismaCliPath = path.resolve(__dirname, '..')
85+
8286
const rows = [
8387
[packageJson.name, packageJson.version],
8488
['@prisma/client', prismaClientVersion ?? 'Not found'],
@@ -92,6 +96,7 @@ export class Version implements Command {
9296

9397
['Default Engines Hash', enginesVersion],
9498
['Studio', packageJson.dependencies['@prisma/studio-core']],
99+
['Prisma CLI Path', prismaCliPath],
95100
]
96101

97102
/**

packages/cli/src/__tests__/commands/Version.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ describe('version', () => {
2222
PSL : @prisma/prisma-schema-wasm CLI_VERSION.ENGINE_VERSION
2323
Schema Engine : schema-engine-cli ENGINE_VERSION (at sanitized_path/schema-engine-TEST_PLATFORM)
2424
Default Engines Hash : ENGINE_VERSION
25-
Studio : STUDIO_VERSION"
25+
Studio : STUDIO_VERSION
26+
Prisma CLI Path : sanitized_path"
2627
`)
2728
expect(cleanSnapshot(data.stderr)).toMatchInlineSnapshot(`
2829
"Loaded Prisma config from prisma.config.ts.
@@ -73,5 +74,8 @@ function cleanSnapshot(str: string, versionOverride?: string): string {
7374
// sanitize windows specific engine names
7475
str = str.replace(/\.exe/g, '')
7576

77+
// sanitize Prisma CLI Path
78+
str = str.replace(new RegExp('(Prisma CLI Path\\s+:( ).*)', 'g'), '$1sanitized_path')
79+
7680
return str
7781
}

0 commit comments

Comments
 (0)