Skip to content

Commit

Permalink
fix: vscode language accidentally bundles prisma packages (zenstackhq…
Browse files Browse the repository at this point in the history
  • Loading branch information
ymc9 authored Aug 12, 2023
1 parent 3e09a3a commit a81913e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 44 deletions.
2 changes: 1 addition & 1 deletion packages/schema/build/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require('esbuild')
entryPoints: ['src/extension.ts', 'src/language-server/main.ts'],
outdir: 'bundle',
bundle: true,
external: ['vscode'],
external: ['vscode', '@prisma/*'],
platform: 'node',
sourcemap: !minify,
watch: watch
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"ts-morph": "^16.0.0"
},
"devDependencies": {
"@types/node": "^18.0.0",
"@types/semver": "^7.3.13",
"copyfiles": "^2.4.1",
"rimraf": "^3.0.2",
Expand Down
10 changes: 6 additions & 4 deletions packages/sdk/src/prisma.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-var-requires */

import type { DMMF } from '@prisma/generator-helper';
import { getDMMF as getDMMF4 } from '@prisma/internals';
import { getDMMF as getDMMF5 } from '@prisma/internals-v5';
import { getPrismaVersion } from '@zenstackhq/runtime';
import path from 'path';
import * as semver from 'semver';
Expand Down Expand Up @@ -84,8 +84,10 @@ export type GetDMMFOptions = {
export function getDMMF(options: GetDMMFOptions): Promise<DMMF.Document> {
const prismaVersion = getPrismaVersion();
if (prismaVersion && semver.gte(prismaVersion, '5.0.0')) {
return getDMMF5(options);
const _getDMMF = require('@prisma/internals-v5').getDMMF;
return _getDMMF(options);
} else {
return getDMMF4(options);
const _getDMMF = require('@prisma/internals').getDMMF;
return _getDMMF(options);
}
}
46 changes: 7 additions & 39 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a81913e

Please sign in to comment.