Comparing version 0.1.54 to 0.1.55
@@ -6,3 +6,3 @@ { | ||
"description": "ZenStack is a toolkit that simplifies full-stack development", | ||
"version": "0.1.54", | ||
"version": "0.1.55", | ||
"author": { | ||
@@ -9,0 +9,0 @@ "name": "ZenStack Team" |
@@ -30,2 +30,12 @@ import { Context, Generator } from '../types'; | ||
sf.addVariableStatement({ | ||
declarationKind: VariableDeclarationKind.Let, | ||
declarations: [ | ||
{ | ||
name: 'guardModule', | ||
type: 'any', | ||
}, | ||
], | ||
}); | ||
const cls = sf.addClass({ | ||
@@ -48,11 +58,2 @@ name: 'ZenStackService', | ||
sf.addVariableStatement({ | ||
declarationKind: VariableDeclarationKind.Let, | ||
declarations: [ | ||
{ | ||
name: 'guardModule', | ||
type: 'any', | ||
}, | ||
], | ||
}); | ||
cls | ||
@@ -105,3 +106,10 @@ .addMethod({ | ||
sf.addStatements(['export default new ZenStackService();']); | ||
// Recommended by Prisma for Next.js | ||
// https://www.prisma.io/docs/guides/database/troubleshooting-orm/help-articles/nextjs-prisma-client-dev-practices#problem | ||
sf.addStatements([ | ||
'declare global { var zenstackService: ZenStackService | undefined}', | ||
'const service = global.zenstackService || new ZenStackService();', | ||
'export default service;', | ||
`if (process.env.NODE_ENV !== 'production') global.zenstackService = service;`, | ||
]); | ||
@@ -108,0 +116,0 @@ sf.formatText(); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29786565
17045