create-prisma-php-app 1.20.518 → 1.20.519

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/index.js CHANGED
@@ -460,13 +460,15 @@ async function createDirectoryStructure(baseDir, answer) {
460
460
  await executeCopy(baseDir, directoriesToCopy, answer);
461
461
  await updatePackageJson(baseDir, answer);
462
462
  await updateComposerJson(baseDir, answer);
463
- if (!answer.backendOnly) await updateIndexJsForWebSocket(baseDir, answer);
463
+ if (!answer.backendOnly) {
464
+ await updateIndexJsForWebSocket(baseDir, answer);
465
+ }
464
466
  if (answer.tailwindcss) {
465
467
  createOrUpdateTailwindConfig(baseDir);
466
- modifyLayoutPHP(baseDir, answer);
467
468
  modifyPostcssConfig(baseDir);
468
- } else {
469
- if (!answer.backendOnly) modifyLayoutPHP(baseDir, answer);
469
+ }
470
+ if (answer.tailwindcss || !answer.backendOnly || answer.swaggerDocs) {
471
+ modifyLayoutPHP(baseDir, answer);
470
472
  }
471
473
  const prismaPHPEnvContent = `# Prisma PHP Auth Secret Key For development only - Change this in production
472
474
  AUTH_SECRET=uxsjXVPHN038DEYls2Kw0QUgBcXKUyrjv416nIFWPY4=
@@ -1,8 +1,7 @@
1
1
  import swaggerJsdoc from "swagger-jsdoc";
2
- import { writeFileSync } from "fs";
2
+ import { writeFileSync, readFileSync, existsSync } from "fs";
3
3
  import { fileURLToPath } from "url";
4
4
  import { join, dirname } from "path";
5
- import { readFileSync } from "fs";
6
5
  import chalk from "chalk";
7
6
 
8
7
  // Define __dirname equivalent in ES modules
@@ -16,7 +15,27 @@ const outputPath = join(
16
15
  );
17
16
 
18
17
  const bsConnectionInfo = join(__dirname, "bs-output.json");
19
- const jsonData = JSON.parse(readFileSync(bsConnectionInfo, "utf8"));
18
+
19
+ // Check if the bs-output.json file exists
20
+ const defaultConnectionInfo = {
21
+ local: "http://localhost:3000",
22
+ external: "http://192.168.1.5:3000",
23
+ ui: "http://localhost:3001",
24
+ uiExternal: "http://192.168.1.5:3001",
25
+ };
26
+
27
+ let jsonData = defaultConnectionInfo;
28
+
29
+ if (existsSync(bsConnectionInfo)) {
30
+ try {
31
+ const data = readFileSync(bsConnectionInfo, "utf8");
32
+ jsonData = JSON.parse(data);
33
+ } catch (error) {
34
+ console.error("Error parsing bs-output.json:", error);
35
+ }
36
+ } else {
37
+ console.warn("bs-output.json not found, using default connection info.");
38
+ }
20
39
 
21
40
  // Swagger options
22
41
  const options = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.20.518",
3
+ "version": "1.20.519",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",