create-prisma-php-app 1.22.507 → 1.23.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/dist/bootstrap.php +3 -5
- package/dist/index.js +26 -774
- package/dist/prisma-php.js +2 -4
- package/dist/settings/bs-config.ts +87 -0
- package/dist/settings/files-list.ts +51 -0
- package/dist/settings/project-name.ts +86 -0
- package/dist/settings/request-methods.php +1 -1
- package/dist/settings/restart-websocket.ts +57 -0
- package/dist/settings/swagger-config.ts +66 -0
- package/dist/settings/utils.ts +14 -0
- package/dist/tsconfig.json +5 -5
- package/package.json +1 -1
- package/dist/settings/bs-config.js +0 -75
- package/dist/settings/files-list.js +0 -43
- package/dist/settings/project-name.js +0 -60
- package/dist/settings/restart-websocket.js +0 -40
- package/dist/settings/swagger-config.js +0 -75
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import swaggerJsdoc from "swagger-jsdoc";
|
|
2
|
-
import { writeFileSync, readFileSync, existsSync } from "fs";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { join, dirname } from "path";
|
|
5
|
-
import chalk from "chalk";
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = dirname(__filename);
|
|
8
|
-
// Define the output path for the swagger.json file
|
|
9
|
-
const outputPath = join(__dirname, "../src/app/swagger-docs/apis/pphp-swagger.json");
|
|
10
|
-
const bsConnectionInfo = join(__dirname, "bs-config.json");
|
|
11
|
-
// Default connection info
|
|
12
|
-
const defaultConnectionInfo = {
|
|
13
|
-
local: "http://localhost:3000",
|
|
14
|
-
external: "http://192.168.1.5:3000",
|
|
15
|
-
ui: "http://localhost:3001",
|
|
16
|
-
uiExternal: "http://192.168.1.5:3001",
|
|
17
|
-
};
|
|
18
|
-
let jsonData = defaultConnectionInfo;
|
|
19
|
-
if (existsSync(bsConnectionInfo)) {
|
|
20
|
-
try {
|
|
21
|
-
const data = readFileSync(bsConnectionInfo, "utf8");
|
|
22
|
-
jsonData = JSON.parse(data);
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
console.error("Error parsing bs-output.json:", error);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
console.warn("bs-output.json not found, using default connection info.");
|
|
30
|
-
}
|
|
31
|
-
const options = {
|
|
32
|
-
definition: {
|
|
33
|
-
openapi: "3.0.0",
|
|
34
|
-
info: {
|
|
35
|
-
title: "Prisma PHP API Documentation",
|
|
36
|
-
version: "1.0.0",
|
|
37
|
-
description: "API documentation for the Prisma PHP project",
|
|
38
|
-
},
|
|
39
|
-
servers: [
|
|
40
|
-
{
|
|
41
|
-
url: jsonData.local, // For Development
|
|
42
|
-
description: "Development Server",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
url: "your-production-domain", // For Production
|
|
46
|
-
description: "Production Server",
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
components: {
|
|
50
|
-
securitySchemes: {
|
|
51
|
-
bearerAuth: {
|
|
52
|
-
type: "http",
|
|
53
|
-
scheme: "bearer",
|
|
54
|
-
bearerFormat: "JWT",
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
security: [
|
|
59
|
-
{
|
|
60
|
-
bearerAuth: [],
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
apis: [join(__dirname, "../src/app/swagger-docs/apis/**/*.ts")], // Adjust to match TypeScript file paths
|
|
65
|
-
};
|
|
66
|
-
// Generate the Swagger specification
|
|
67
|
-
const swaggerSpec = JSON.stringify(swaggerJsdoc(options), null, 2);
|
|
68
|
-
// Always generate the swagger.json file
|
|
69
|
-
try {
|
|
70
|
-
writeFileSync(outputPath, swaggerSpec, "utf-8");
|
|
71
|
-
console.log(`Swagger JSON has been generated and saved to ${chalk.blue("src/app/swagger-docs/pphp-swagger.json")}`);
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
console.error("Error saving Swagger JSON:", error);
|
|
75
|
-
}
|