prisma-swagger-autogen 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/README.md +264 -0
- package/dist/chunk-SNNQZQLO.js +334 -0
- package/dist/cli.cjs +361 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +10 -0
- package/dist/index.cjs +368 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/package.json +56 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
run: () => run
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
37
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
38
|
+
var import_glob = require("glob");
|
|
39
|
+
var import_node_child_process = require("child_process");
|
|
40
|
+
var CONFIG = {
|
|
41
|
+
projectRoot: process.cwd(),
|
|
42
|
+
controllersGlob: "./src/web/api/controllers/**/*.ts",
|
|
43
|
+
outFile: "./swagger.config.js",
|
|
44
|
+
openapiOut: "./src/web/api/openapi.json",
|
|
45
|
+
serviceTitle: "Prescription Service",
|
|
46
|
+
serverUrl: "http://localhost:3008",
|
|
47
|
+
securitySchemeName: "keycloakOAuth",
|
|
48
|
+
oauth: {
|
|
49
|
+
tokenUrl: "http://auth.localhost/realms/haemo/protocol/openid-connect/token",
|
|
50
|
+
refreshUrl: "http://auth.localhost/realms/haemo/protocol/openid-connect/refresh",
|
|
51
|
+
scopes: { openid: "openid scope" }
|
|
52
|
+
},
|
|
53
|
+
omitFieldsInWriteDtos: /* @__PURE__ */ new Set(["id", "createdAt", "updatedAt", "v"])
|
|
54
|
+
};
|
|
55
|
+
function ensurePosix(p) {
|
|
56
|
+
return p.split(import_node_path.default.sep).join(import_node_path.default.posix.sep);
|
|
57
|
+
}
|
|
58
|
+
function pluralize(name) {
|
|
59
|
+
if (name.endsWith("s")) return `${name}es`;
|
|
60
|
+
return `${name}s`;
|
|
61
|
+
}
|
|
62
|
+
function scalarToSchema(scalar) {
|
|
63
|
+
switch (scalar) {
|
|
64
|
+
case "String":
|
|
65
|
+
return { type: "string" };
|
|
66
|
+
case "Boolean":
|
|
67
|
+
return { type: "boolean" };
|
|
68
|
+
case "Int":
|
|
69
|
+
return { type: "integer" };
|
|
70
|
+
case "BigInt":
|
|
71
|
+
return { type: "integer", format: "int64" };
|
|
72
|
+
case "Float":
|
|
73
|
+
return { type: "number" };
|
|
74
|
+
case "Decimal":
|
|
75
|
+
return { type: "number" };
|
|
76
|
+
case "DateTime":
|
|
77
|
+
return { type: "string", format: "date-time" };
|
|
78
|
+
case "Json":
|
|
79
|
+
return { type: "object" };
|
|
80
|
+
case "Bytes":
|
|
81
|
+
return { type: "string", format: "byte" };
|
|
82
|
+
default:
|
|
83
|
+
return { type: "string" };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function fieldSchema(field, getRefName) {
|
|
87
|
+
if (field.kind === "scalar") {
|
|
88
|
+
const base = scalarToSchema(field.type);
|
|
89
|
+
if (field.isList) return { type: "array", items: base };
|
|
90
|
+
return base;
|
|
91
|
+
}
|
|
92
|
+
if (field.kind === "enum") {
|
|
93
|
+
const base = { $ref: `#/components/schemas/${field.type}` };
|
|
94
|
+
if (field.isList) return { type: "array", items: base };
|
|
95
|
+
return base;
|
|
96
|
+
}
|
|
97
|
+
if (field.kind === "object") {
|
|
98
|
+
const ref = { $ref: `#/components/schemas/${getRefName(String(field.type))}` };
|
|
99
|
+
if (field.isList) return { type: "array", items: ref };
|
|
100
|
+
return ref;
|
|
101
|
+
}
|
|
102
|
+
return { type: "object" };
|
|
103
|
+
}
|
|
104
|
+
function modelToGetSchema(model, getRefName) {
|
|
105
|
+
const properties = {};
|
|
106
|
+
const required = [];
|
|
107
|
+
for (const f of model.fields) {
|
|
108
|
+
properties[f.name] = fieldSchema(f, getRefName);
|
|
109
|
+
if (f.isRequired) required.push(f.name);
|
|
110
|
+
}
|
|
111
|
+
const schema = { type: "object", properties };
|
|
112
|
+
if (required.length) schema.required = required;
|
|
113
|
+
return schema;
|
|
114
|
+
}
|
|
115
|
+
function stripWriteFields(model, getSchema, omit) {
|
|
116
|
+
const schema = JSON.parse(JSON.stringify(getSchema));
|
|
117
|
+
if (!schema.properties) return schema;
|
|
118
|
+
const relationFieldNames = new Set(model.fields.filter((f) => f.kind === "object").map((f) => f.name));
|
|
119
|
+
for (const key of Object.keys(schema.properties)) {
|
|
120
|
+
if (omit.has(key) || relationFieldNames.has(key)) delete schema.properties[key];
|
|
121
|
+
}
|
|
122
|
+
if (Array.isArray(schema.required)) {
|
|
123
|
+
schema.required = schema.required.filter((k) => !omit.has(k) && !relationFieldNames.has(k));
|
|
124
|
+
if (schema.required.length === 0) delete schema.required;
|
|
125
|
+
}
|
|
126
|
+
return schema;
|
|
127
|
+
}
|
|
128
|
+
function makeAllOptional(schema) {
|
|
129
|
+
const s = JSON.parse(JSON.stringify(schema));
|
|
130
|
+
delete s.required;
|
|
131
|
+
return s;
|
|
132
|
+
}
|
|
133
|
+
function listResponseSchema(itemRef) {
|
|
134
|
+
return {
|
|
135
|
+
type: "object",
|
|
136
|
+
properties: {
|
|
137
|
+
count: { type: "number", example: 3 },
|
|
138
|
+
hasPreviousPage: { type: "boolean", example: false },
|
|
139
|
+
hasNextPage: { type: "boolean", example: true },
|
|
140
|
+
pageNumber: { type: "number", example: 1 },
|
|
141
|
+
pageSize: { type: "number", example: 10 },
|
|
142
|
+
totalPages: { type: "number", example: 1 },
|
|
143
|
+
items: { type: "array", items: { $ref: itemRef } }
|
|
144
|
+
},
|
|
145
|
+
required: ["count", "hasPreviousPage", "hasNextPage", "pageNumber", "pageSize", "totalPages", "items"]
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function exampleForScalarType(type, format) {
|
|
149
|
+
if (type === "string" && format === "date-time") return (/* @__PURE__ */ new Date(0)).toISOString();
|
|
150
|
+
switch (type) {
|
|
151
|
+
case "string":
|
|
152
|
+
return "string";
|
|
153
|
+
case "integer":
|
|
154
|
+
return 0;
|
|
155
|
+
case "number":
|
|
156
|
+
return 0;
|
|
157
|
+
case "boolean":
|
|
158
|
+
return true;
|
|
159
|
+
case "object":
|
|
160
|
+
return {};
|
|
161
|
+
default:
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function buildExampleFromSchema(schema, components, depth = 0) {
|
|
166
|
+
if (depth > 2) return void 0;
|
|
167
|
+
if (schema.$ref) {
|
|
168
|
+
const name = String(schema.$ref).split("/").pop() || "";
|
|
169
|
+
const target = components[name];
|
|
170
|
+
if (!target) return void 0;
|
|
171
|
+
return buildExampleFromSchema(target, components, depth + 1);
|
|
172
|
+
}
|
|
173
|
+
if (Array.isArray(schema.allOf) && schema.allOf.length) {
|
|
174
|
+
const merged = {};
|
|
175
|
+
for (const part of schema.allOf) {
|
|
176
|
+
const ex = buildExampleFromSchema(part, components, depth + 1);
|
|
177
|
+
if (ex && typeof ex === "object" && !Array.isArray(ex)) Object.assign(merged, ex);
|
|
178
|
+
}
|
|
179
|
+
return Object.keys(merged).length ? merged : void 0;
|
|
180
|
+
}
|
|
181
|
+
if (schema.type === "array" && schema.items) {
|
|
182
|
+
const item = buildExampleFromSchema(schema.items, components, depth + 1);
|
|
183
|
+
return item === void 0 ? [] : [item];
|
|
184
|
+
}
|
|
185
|
+
if (schema.type === "object" && schema.properties) {
|
|
186
|
+
const obj = {};
|
|
187
|
+
for (const [k, v] of Object.entries(schema.properties)) {
|
|
188
|
+
const ex = buildExampleFromSchema(v, components, depth + 1);
|
|
189
|
+
if (ex !== void 0) obj[k] = ex;
|
|
190
|
+
}
|
|
191
|
+
return obj;
|
|
192
|
+
}
|
|
193
|
+
if (Array.isArray(schema.enum) && schema.enum.length) return schema.enum[0];
|
|
194
|
+
if (typeof schema.type === "string") return exampleForScalarType(schema.type, schema.format);
|
|
195
|
+
return void 0;
|
|
196
|
+
}
|
|
197
|
+
function attachExample(schema, components) {
|
|
198
|
+
const s = JSON.parse(JSON.stringify(schema));
|
|
199
|
+
if (s.example === void 0) {
|
|
200
|
+
const ex = buildExampleFromSchema(s, components);
|
|
201
|
+
if (ex !== void 0) s.example = ex;
|
|
202
|
+
}
|
|
203
|
+
return s;
|
|
204
|
+
}
|
|
205
|
+
async function loadDmmfFromProject() {
|
|
206
|
+
const schemaPath = import_node_path.default.resolve(process.cwd(), "prisma/schema.prisma");
|
|
207
|
+
if (!import_node_fs.default.existsSync(schemaPath)) {
|
|
208
|
+
throw new Error(`Prisma schema not found at: ${schemaPath}`);
|
|
209
|
+
}
|
|
210
|
+
const cmd = `npx prisma generate --schema "${schemaPath}" --print`;
|
|
211
|
+
const stdout = (0, import_node_child_process.execSync)(cmd, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
212
|
+
const firstBrace = stdout.indexOf("{");
|
|
213
|
+
const lastBrace = stdout.lastIndexOf("}");
|
|
214
|
+
if (firstBrace === -1 || lastBrace === -1) {
|
|
215
|
+
throw new Error(`Failed to parse Prisma DMMF from: ${cmd}`);
|
|
216
|
+
}
|
|
217
|
+
const jsonText = stdout.slice(firstBrace, lastBrace + 1);
|
|
218
|
+
const parsed = JSON.parse(jsonText);
|
|
219
|
+
const dmmf = parsed?.dmmf ?? parsed;
|
|
220
|
+
if (!dmmf?.datamodel?.models) {
|
|
221
|
+
throw new Error(`Prisma DMMF not found in prisma output. Got keys: ${Object.keys(parsed || {})}`);
|
|
222
|
+
}
|
|
223
|
+
return dmmf;
|
|
224
|
+
}
|
|
225
|
+
function buildSchemasFromDmmf(dmmf) {
|
|
226
|
+
const schemas = {};
|
|
227
|
+
const getRefName = (modelName) => `Get${modelName}Response`;
|
|
228
|
+
for (const e of dmmf.datamodel.enums) {
|
|
229
|
+
schemas[e.name] = { type: "string", enum: e.values.map((v) => v.name) };
|
|
230
|
+
}
|
|
231
|
+
for (const model of dmmf.datamodel.models) {
|
|
232
|
+
const getName = `Get${model.name}Response`;
|
|
233
|
+
const postName = `Post${model.name}Request`;
|
|
234
|
+
const putName = `Put${model.name}Request`;
|
|
235
|
+
const listName = `List${pluralize(model.name)}Response`;
|
|
236
|
+
const getSchema = modelToGetSchema(model, getRefName);
|
|
237
|
+
const postSchema = stripWriteFields(model, getSchema, CONFIG.omitFieldsInWriteDtos);
|
|
238
|
+
const putSchema = makeAllOptional(postSchema);
|
|
239
|
+
schemas[getName] = getSchema;
|
|
240
|
+
schemas[postName] = postSchema;
|
|
241
|
+
schemas[putName] = putSchema;
|
|
242
|
+
schemas[listName] = listResponseSchema(`#/components/schemas/${getName}`);
|
|
243
|
+
}
|
|
244
|
+
schemas["ExceptionResponse"] = {
|
|
245
|
+
type: "object",
|
|
246
|
+
properties: {
|
|
247
|
+
detail: { type: "string" },
|
|
248
|
+
errors: { type: "array", items: { type: "string" } },
|
|
249
|
+
status: { type: "number" },
|
|
250
|
+
title: { type: "string" },
|
|
251
|
+
type: { type: "string" }
|
|
252
|
+
},
|
|
253
|
+
required: ["status", "title", "type"]
|
|
254
|
+
};
|
|
255
|
+
schemas["BadRequestResponse"] = {
|
|
256
|
+
allOf: [{ $ref: "#/components/schemas/ExceptionResponse" }],
|
|
257
|
+
example: {
|
|
258
|
+
status: 400,
|
|
259
|
+
title: "The request was invalid",
|
|
260
|
+
type: "https://tools.ietf.org/html/rfc7231#section-6.5.1"
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
schemas["NotFoundResponse"] = {
|
|
264
|
+
allOf: [{ $ref: "#/components/schemas/ExceptionResponse" }],
|
|
265
|
+
example: {
|
|
266
|
+
status: 404,
|
|
267
|
+
title: "The specified resource was not found",
|
|
268
|
+
type: "https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.4"
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
schemas["InternalErrorResponse"] = {
|
|
272
|
+
allOf: [{ $ref: "#/components/schemas/ExceptionResponse" }],
|
|
273
|
+
example: {
|
|
274
|
+
status: 500,
|
|
275
|
+
title: "An error occurred while processing your request",
|
|
276
|
+
type: "https://tools.ietf.org/html/rfc7231#section-6.6.1"
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
for (const name of Object.keys(schemas)) {
|
|
280
|
+
if (name.startsWith("Post") && name.endsWith("Request")) schemas[name] = attachExample(schemas[name], schemas);
|
|
281
|
+
if (name.startsWith("Put") && name.endsWith("Request")) schemas[name] = attachExample(schemas[name], schemas);
|
|
282
|
+
}
|
|
283
|
+
return schemas;
|
|
284
|
+
}
|
|
285
|
+
function generateSwaggerConfigJs(schemas) {
|
|
286
|
+
const routes = (0, import_glob.globSync)(CONFIG.controllersGlob, { nodir: true }).map((p) => ensurePosix(p));
|
|
287
|
+
const docs = {
|
|
288
|
+
info: { title: CONFIG.serviceTitle },
|
|
289
|
+
servers: [{ url: CONFIG.serverUrl }],
|
|
290
|
+
components: {
|
|
291
|
+
schemas,
|
|
292
|
+
securitySchemes: {
|
|
293
|
+
[CONFIG.securitySchemeName]: {
|
|
294
|
+
type: "oauth2",
|
|
295
|
+
description: "This API uses OAuth2 with the password flow.",
|
|
296
|
+
flows: {
|
|
297
|
+
password: {
|
|
298
|
+
tokenUrl: CONFIG.oauth.tokenUrl,
|
|
299
|
+
refreshUrl: CONFIG.oauth.refreshUrl,
|
|
300
|
+
scopes: CONFIG.oauth.scopes
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
security: [{ [CONFIG.securitySchemeName]: ["openid"] }]
|
|
307
|
+
};
|
|
308
|
+
const fileContent = `const swaggerAutogen = require('swagger-autogen')();
|
|
309
|
+
const fs = require('fs');
|
|
310
|
+
const path = require('node:path');
|
|
311
|
+
|
|
312
|
+
function isPlainObject(v){return v!==null && typeof v==='object' && !Array.isArray(v);}
|
|
313
|
+
|
|
314
|
+
function normalizeSchema(schema){
|
|
315
|
+
if(!isPlainObject(schema)) return schema;
|
|
316
|
+
if(schema.$ref) return schema;
|
|
317
|
+
|
|
318
|
+
if(isPlainObject(schema.type) && typeof schema.type.example === 'string') schema.type = schema.type.example;
|
|
319
|
+
if(isPlainObject(schema.format) && typeof schema.format.example === 'string') schema.format = schema.format.example;
|
|
320
|
+
if(isPlainObject(schema.required) && Array.isArray(schema.required.example)) schema.required = schema.required.example;
|
|
321
|
+
if(isPlainObject(schema.enum) && Array.isArray(schema.enum.example)) schema.enum = schema.enum.example;
|
|
322
|
+
|
|
323
|
+
if(Array.isArray(schema.allOf)) schema.allOf = schema.allOf.map(normalizeSchema);
|
|
324
|
+
if(isPlainObject(schema.items)) schema.items = normalizeSchema(schema.items);
|
|
325
|
+
if(isPlainObject(schema.additionalProperties)) schema.additionalProperties = normalizeSchema(schema.additionalProperties);
|
|
326
|
+
|
|
327
|
+
if(isPlainObject(schema.properties)){
|
|
328
|
+
for(const k of Object.keys(schema.properties)){
|
|
329
|
+
schema.properties[k] = normalizeSchema(schema.properties[k]);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
return schema;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function fixOpenApiFile(openapiPath){
|
|
337
|
+
const abs = path.resolve(process.cwd(), openapiPath);
|
|
338
|
+
if(!fs.existsSync(abs)) return;
|
|
339
|
+
const doc = JSON.parse(fs.readFileSync(abs,'utf8'));
|
|
340
|
+
|
|
341
|
+
if(doc && doc.components && isPlainObject(doc.components.schemas)){
|
|
342
|
+
for(const name of Object.keys(doc.components.schemas)){
|
|
343
|
+
doc.components.schemas[name] = normalizeSchema(doc.components.schemas[name]);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
fs.writeFileSync(abs, JSON.stringify(doc,null,2),'utf8');
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const docs = ${JSON.stringify(docs, null, 2)};
|
|
351
|
+
const routes = ${JSON.stringify(routes, null, 2)};
|
|
352
|
+
|
|
353
|
+
swaggerAutogen('${ensurePosix(CONFIG.openapiOut)}', routes, docs)
|
|
354
|
+
.then(() => fixOpenApiFile('${ensurePosix(CONFIG.openapiOut)}'))
|
|
355
|
+
.catch((e) => { console.error(e); process.exitCode = 1; });
|
|
356
|
+
`;
|
|
357
|
+
const outPath = import_node_path.default.resolve(CONFIG.projectRoot, CONFIG.outFile);
|
|
358
|
+
import_node_fs.default.writeFileSync(outPath, fileContent, "utf8");
|
|
359
|
+
}
|
|
360
|
+
async function run(_args) {
|
|
361
|
+
const dmmf = await loadDmmfFromProject();
|
|
362
|
+
const schemas = buildSchemasFromDmmf(dmmf);
|
|
363
|
+
generateSwaggerConfigJs(schemas);
|
|
364
|
+
}
|
|
365
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
366
|
+
0 && (module.exports = {
|
|
367
|
+
run
|
|
368
|
+
});
|
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "prisma-swagger-autogen",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Generate swagger-autogen config + Prisma DMMF schemas and fix swagger-autogen output.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Joyce Marvin Rafflenbeul",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/quikk-software/prisma-swagger-autogen.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/quikk-software/prisma-swagger-autogen/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/quikk-software/prisma-swagger-autogen#readme",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"prisma",
|
|
17
|
+
"openapi",
|
|
18
|
+
"swagger",
|
|
19
|
+
"swagger-autogen",
|
|
20
|
+
"typescript"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "./dist/index.cjs",
|
|
24
|
+
"module": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"require": "./dist/index.cjs"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"bin": {
|
|
34
|
+
"prisma-swagger-autogen": "./dist/cli.js"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist",
|
|
38
|
+
"README.md",
|
|
39
|
+
"LICENSE"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsup src/index.ts src/cli.ts --format esm,cjs --dts --out-dir dist --tsconfig tsconfig.json",
|
|
43
|
+
"prepublishOnly": "npm run build"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@prisma/client": ">=4",
|
|
47
|
+
"prisma": ">=4",
|
|
48
|
+
"glob": ">=10",
|
|
49
|
+
"swagger-autogen": ">=2"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^25.1.0",
|
|
53
|
+
"tsup": "^8.0.0",
|
|
54
|
+
"typescript": "^5.0.0"
|
|
55
|
+
}
|
|
56
|
+
}
|