Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: vscode language accidentally bundles prisma packages #623

Merged
merged 1 commit into from
Aug 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading