MCPcopy Index your code
hub / github.com/zenstackhq/zenstack / execPrisma

Function execPrisma

packages/cli/src/utils/exec-utils.ts:32–61  ·  view source on GitHub ↗
(args: string, options?: Omit<ExecSyncOptions, 'env'> & { env?: Record<string, string> })

Source from the content-addressed store, hash-verified

30 * Utility for running prisma commands
31 */
32export function execPrisma(args: string, options?: Omit<ExecSyncOptions, 'env'> & { env?: Record<string, string> }) {
33 let prismaPath: string | undefined;
34 try {
35 if (typeof import.meta.resolve === 'function') {
36 // esm
37 prismaPath = fileURLToPath(import.meta.resolve('prisma/build/index.js'));
38 } else {
39 // cjs
40 prismaPath = require.resolve('prisma/build/index.js');
41 }
42 } catch {
43 // ignore and fallback
44 }
45
46 const _options = {
47 ...options,
48 env: {
49 ...options?.env,
50 PRISMA_HIDE_UPDATE_MESSAGE: '1',
51 },
52 };
53
54 if (!prismaPath) {
55 // fallback to npx/bunx execute
56 execPackage(`prisma ${args}`, _options);
57 return;
58 }
59
60 execSync(`node "${prismaPath}" ${args}`, _options);
61}

Callers 6

runPushFunction · 0.90
runDevFunction · 0.90
runResetFunction · 0.90
runDeployFunction · 0.90
runStatusFunction · 0.90
runResolveFunction · 0.90

Calls 3

execPackageFunction · 0.85
execSyncFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected