Skip to content

Commit d3629be

Browse files
authored
fix: prisma.d.ts is not properly saved (#1090)
1 parent 36e515e commit d3629be

File tree

16 files changed

+26
-21
lines changed

16 files changed

+26
-21
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zenstack-monorepo",
3-
"version": "2.0.0-alpha.2",
3+
"version": "2.0.0-alpha.4",
44
"description": "",
55
"scripts": {
66
"build": "pnpm -r build",

packages/ide/jetbrains/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
}
1010

1111
group = "dev.zenstack"
12-
version = "2.0.0-alpha.1"
12+
version = "2.0.0-alpha.4"
1313

1414
repositories {
1515
mavenCentral()

packages/ide/jetbrains/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jetbrains",
3-
"version": "2.0.0-alpha.2",
3+
"version": "2.0.0-alpha.4",
44
"displayName": "ZenStack JetBrains IDE Plugin",
55
"description": "ZenStack JetBrains IDE plugin",
66
"homepage": "https://zenstack.dev",

packages/language/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/language",
3-
"version": "2.0.0-alpha.2",
3+
"version": "2.0.0-alpha.4",
44
"displayName": "ZenStack modeling language compiler",
55
"description": "ZenStack modeling language compiler",
66
"homepage": "https://zenstack.dev",

packages/misc/redwood/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/redwood",
33
"displayName": "ZenStack RedwoodJS Integration",
4-
"version": "2.0.0-alpha.2",
4+
"version": "2.0.0-alpha.4",
55
"description": "CLI and runtime for integrating ZenStack with RedwoodJS projects.",
66
"repository": {
77
"type": "git",

packages/plugins/openapi/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/openapi",
33
"displayName": "ZenStack Plugin and Runtime for OpenAPI",
4-
"version": "2.0.0-alpha.2",
4+
"version": "2.0.0-alpha.4",
55
"description": "ZenStack plugin and runtime supporting OpenAPI",
66
"main": "index.js",
77
"repository": {

packages/plugins/swr/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/swr",
33
"displayName": "ZenStack plugin for generating SWR hooks",
4-
"version": "2.0.0-alpha.2",
4+
"version": "2.0.0-alpha.4",
55
"description": "ZenStack plugin for generating SWR hooks",
66
"main": "index.js",
77
"repository": {

packages/plugins/tanstack-query/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/tanstack-query",
33
"displayName": "ZenStack plugin for generating tanstack-query hooks",
4-
"version": "2.0.0-alpha.2",
4+
"version": "2.0.0-alpha.4",
55
"description": "ZenStack plugin for generating tanstack-query hooks",
66
"main": "index.js",
77
"exports": {

packages/plugins/trpc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/trpc",
33
"displayName": "ZenStack plugin for tRPC",
4-
"version": "2.0.0-alpha.2",
4+
"version": "2.0.0-alpha.4",
55
"description": "ZenStack plugin for tRPC",
66
"main": "index.js",
77
"repository": {

packages/plugins/trpc/tests/projects/t3-trpc-v10/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ yarn-error.log*
4040

4141
# typescript
4242
*.tsbuildinfo
43-
package-lock.json
43+
package-lock.json
44+
package.json

packages/runtime/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/runtime",
33
"displayName": "ZenStack Runtime Library",
4-
"version": "2.0.0-alpha.2",
4+
"version": "2.0.0-alpha.4",
55
"description": "Runtime of ZenStack for both client-side and server-side environments.",
66
"repository": {
77
"type": "git",

packages/schema/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"publisher": "zenstack",
44
"displayName": "ZenStack Language Tools",
55
"description": "Build scalable web apps with minimum code by defining authorization and validation rules inside the data schema that closer to the database",
6-
"version": "2.0.0-alpha.2",
6+
"version": "2.0.0-alpha.4",
77
"author": {
88
"name": "ZenStack Team"
99
},

packages/schema/src/plugins/enhancer/enhance/index.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ export async function generate(model: Model, options: PluginOptions, project: Pr
3636
let logicalPrismaClientDir: string | undefined;
3737
let dmmf: DMMF.Document | undefined;
3838

39-
if (needsLogicalClient(model)) {
39+
const withLogicalClient = needsLogicalClient(model);
40+
41+
if (withLogicalClient) {
4042
// schema contains delegate models, need to generate a logical prisma schema
4143
const result = await generateLogicalPrisma(model, options, outDir);
4244

@@ -49,15 +51,15 @@ export async function generate(model: Model, options: PluginOptions, project: Pr
4951
`export type * from '${logicalPrismaClientDir}/index-fixed';`,
5052
{ overwrite: true }
5153
);
52-
await saveSourceFile(prismaDts, options);
54+
await prismaDts.save();
5355
} else {
5456
// just reexport the prisma client
5557
const prismaDts = project.createSourceFile(
5658
path.join(outDir, 'prisma.d.ts'),
5759
`export type * from '${getPrismaClientImportSpec(outDir, options)}';`,
5860
{ overwrite: true }
5961
);
60-
await saveSourceFile(prismaDts, options);
62+
await prismaDts.save();
6163
}
6264

6365
const enhanceTs = project.createSourceFile(
@@ -67,16 +69,18 @@ import modelMeta from './model-meta';
6769
import policy from './policy';
6870
${options.withZodSchemas ? "import * as zodSchemas from './zod';" : 'const zodSchemas = undefined;'}
6971
import { Prisma } from '${getPrismaClientImportSpec(outDir, options)}';
70-
${logicalPrismaClientDir ? `import { type PrismaClient } from '${logicalPrismaClientDir}/index-fixed';` : ``}
72+
${withLogicalClient ? `import { type PrismaClient } from '${logicalPrismaClientDir}/index-fixed';` : ``}
7173
72-
export function enhance<DbClient extends object>(prisma: DbClient, context?: EnhancementContext, options?: EnhancementOptions) {
74+
export function enhance<DbClient extends object>(prisma: DbClient, context?: EnhancementContext, options?: EnhancementOptions)${
75+
withLogicalClient ? ': PrismaClient' : ''
76+
} {
7377
return createEnhancement(prisma, {
7478
modelMeta,
7579
policy,
7680
zodSchemas: zodSchemas as unknown as (ZodSchemas | undefined),
7781
prismaModule: Prisma,
7882
...options
79-
}, context)${logicalPrismaClientDir ? ' as PrismaClient' : ''};
83+
}, context)${withLogicalClient ? ' as PrismaClient' : ''};
8084
}
8185
`,
8286
{ overwrite: true }

packages/sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/sdk",
3-
"version": "2.0.0-alpha.2",
3+
"version": "2.0.0-alpha.4",
44
"description": "ZenStack plugin development SDK",
55
"main": "index.js",
66
"scripts": {

packages/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/server",
3-
"version": "2.0.0-alpha.2",
3+
"version": "2.0.0-alpha.4",
44
"displayName": "ZenStack Server-side Adapters",
55
"description": "ZenStack server-side adapters",
66
"homepage": "https://zenstack.dev",

packages/testtools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/testtools",
3-
"version": "2.0.0-alpha.2",
3+
"version": "2.0.0-alpha.4",
44
"description": "ZenStack Test Tools",
55
"main": "index.js",
66
"private": true,

0 commit comments

Comments
 (0)