Skip to content

Commit

Permalink
add get version command [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Feb 17, 2020
1 parent 6fbd4bc commit 2f6d6d5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cli/prisma2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"bin": "build/index.js",
"prisma": {
"version": "a1a562d6f7093ae4ac17ebe3c8d2b387b2ed0598"
"version": "e68e8825105cef3b0aa1cd18ac1e1c29c6441e85"
},
"devDependencies": {
"@prisma/ci-info": "^2.1.1",
Expand Down Expand Up @@ -82,4 +82,4 @@
"prepublishOnly": "pnpm run download && pnpm run ncc:download && pnpm run install && pnpm run test && pnpm run build",
"pkg": "pkg . -o pkg-build"
}
}
}
1 change: 1 addition & 0 deletions cli/prisma2/src/bin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ts-node

import * as Sentry from '@sentry/node'
import dotenv = require('dotenv')
const packageJson = require('../package.json')
Expand Down
14 changes: 14 additions & 0 deletions cli/sdk/src/engineCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,17 @@ export async function dmmfToDml(
throw new Error(e)
}
}

export async function getVersion(enginePath?: string): Promise<string> {
enginePath = enginePath || (await getPrismaPath())

debug(`Getting version of ${enginePath}`)
const result = await execa(enginePath, ['--version'], {
env: {
...process.env,
},
maxBuffer: MAX_BUFFER,
})

return result.stdout
}
1 change: 1 addition & 0 deletions cli/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export {
dmmfToDml,
GetDMMFOptions,
ConfigMetaFormat,
getVersion,
} from './engineCommands'
export { getPackedPackage } from './getPackedPackage'
export { GeneratorPaths } from './predefinedGeneratorResolvers'
Expand Down

0 comments on commit 2f6d6d5

Please sign in to comment.