Comparing version 0.1.16 to 0.1.17
@@ -48,3 +48,3 @@ "use strict"; | ||
generateIndex(project, context) { | ||
const sf = project.createSourceFile(path.join(context.outDir, 'auth/index.ts'), undefined, { overwrite: true }); | ||
const sf = project.createSourceFile(path.join(context.outDir, 'src/auth/index.ts'), undefined, { overwrite: true }); | ||
sf.addStatements([ | ||
@@ -60,3 +60,3 @@ `export * from './next-auth-adapter';`, | ||
import { Adapter } from 'next-auth/adapters'; | ||
import { Prisma } from '../.prisma'; | ||
import { Prisma } from '../../.prisma'; | ||
@@ -118,3 +118,3 @@ export function NextAuthAdapter(service: ZenStackService): Adapter { | ||
`; | ||
const sf = project.createSourceFile(path.join(context.outDir, 'auth/next-auth-adapter.ts'), content, { overwrite: true }); | ||
const sf = project.createSourceFile(path.join(context.outDir, 'src/auth/next-auth-adapter.ts'), content, { overwrite: true }); | ||
sf.formatText(); | ||
@@ -194,3 +194,3 @@ } | ||
`; | ||
const sf = project.createSourceFile(path.join(context.outDir, 'auth/authorize.ts'), content, { overwrite: true }); | ||
const sf = project.createSourceFile(path.join(context.outDir, 'src/auth/authorize.ts'), content, { overwrite: true }); | ||
sf.formatText(); | ||
@@ -197,0 +197,0 @@ } |
@@ -5,11 +5,6 @@ { | ||
"description": "ZenStack generated code", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"author": "ZenStack", | ||
"license": "MIT", | ||
"exports": { | ||
"./auth": "lib/auth/index", | ||
"./hooks": "lib/hooks/index", | ||
"./query": "lib/query" | ||
} | ||
"license": "MIT" | ||
} |
@@ -27,3 +27,3 @@ "use strict"; | ||
const project = new ts_morph_1.Project(); | ||
const sf = project.createSourceFile(path_1.default.join(this.context.outDir, 'query/guard.ts'), undefined, { overwrite: true }); | ||
const sf = project.createSourceFile(path_1.default.join(this.context.outDir, 'src/query/guard.ts'), undefined, { overwrite: true }); | ||
sf.addImportDeclaration({ | ||
@@ -38,3 +38,3 @@ namedImports: [{ name: 'QueryContext' }], | ||
namedImports: [{ name: e.name }], | ||
moduleSpecifier: '../.prisma', | ||
moduleSpecifier: '../../.prisma', | ||
}); | ||
@@ -41,0 +41,0 @@ } |
@@ -133,3 +133,3 @@ "use strict"; | ||
`; | ||
const sf = project.createSourceFile(path.join(context.outDir, `hooks/request.ts`), content, { overwrite: true }); | ||
const sf = project.createSourceFile(path.join(context.outDir, `src/hooks/request.ts`), content, { overwrite: true }); | ||
sf.formatText(); | ||
@@ -139,7 +139,7 @@ } | ||
const fileName = (0, change_case_1.paramCase)(model.name); | ||
const sf = project.createSourceFile(path.join(context.outDir, `hooks/${fileName}.ts`), undefined, { overwrite: true }); | ||
const sf = project.createSourceFile(path.join(context.outDir, `src/hooks/${fileName}.ts`), undefined, { overwrite: true }); | ||
sf.addImportDeclaration({ | ||
namedImports: [{ name: 'Prisma', alias: 'P' }, model.name], | ||
isTypeOnly: true, | ||
moduleSpecifier: '../.prisma', | ||
moduleSpecifier: '../../.prisma', | ||
}); | ||
@@ -254,3 +254,3 @@ sf.addStatements([`import * as request from './request';`]); | ||
generateIndex(project, context, models) { | ||
const sf = project.createSourceFile(path.join(context.outDir, 'hooks/index.ts'), undefined, { overwrite: true }); | ||
const sf = project.createSourceFile(path.join(context.outDir, 'src/hooks/index.ts'), undefined, { overwrite: true }); | ||
sf.addStatements(models.map((d) => `export * from './${(0, change_case_1.paramCase)(d.name)}';`)); | ||
@@ -257,0 +257,0 @@ sf.formatText(); |
@@ -46,6 +46,6 @@ "use strict"; | ||
const project = new ts_morph_1.Project(); | ||
const sf = project.createSourceFile(path.join(context.outDir, 'index.ts'), undefined, { overwrite: true }); | ||
const sf = project.createSourceFile(path.join(context.outDir, 'src/index.ts'), undefined, { overwrite: true }); | ||
sf.addImportDeclaration({ | ||
namedImports: ['PrismaClient'], | ||
moduleSpecifier: './.prisma', | ||
moduleSpecifier: '../.prisma', | ||
}); | ||
@@ -52,0 +52,0 @@ sf.addImportDeclaration({ |
@@ -5,3 +5,3 @@ { | ||
"description": "ZenStack CLI and Language Tools", | ||
"version": "0.1.16", | ||
"version": "0.1.17", | ||
"engines": { | ||
@@ -8,0 +8,0 @@ "vscode": "^1.56.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
331438
5915