create-prisma-php-app 1.11.541 → 1.11.543

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -31
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9,9 +9,9 @@ import https from "https";
9
9
  const __filename = fileURLToPath(import.meta.url);
10
10
  const __dirname = path.dirname(__filename);
11
11
  let updateAnswer = null;
12
- function bsConfigUrls(projectSettings) {
12
+ function bsConfigUrls(projectRootPath) {
13
13
  // Identify the base path dynamically up to and including 'htdocs'
14
- const htdocsIndex = projectSettings.PROJECT_ROOT_PATH.indexOf("\\htdocs\\");
14
+ const htdocsIndex = projectRootPath.indexOf("\\htdocs\\");
15
15
  if (htdocsIndex === -1) {
16
16
  console.error(
17
17
  "Invalid PROJECT_ROOT_PATH. The path does not contain \\htdocs\\"
@@ -22,17 +22,16 @@ function bsConfigUrls(projectSettings) {
22
22
  };
23
23
  }
24
24
  // Extract the path up to and including 'htdocs\\'
25
- const basePathToRemove = projectSettings.PROJECT_ROOT_PATH.substring(
25
+ const basePathToRemove = projectRootPath.substring(
26
26
  0,
27
27
  htdocsIndex + "\\htdocs\\".length
28
28
  );
29
29
  // Escape backslashes for the regex pattern
30
30
  const escapedBasePathToRemove = basePathToRemove.replace(/\\/g, "\\\\");
31
31
  // Remove the base path and replace backslashes with forward slashes for URL compatibility
32
- const relativeWebPath = projectSettings.PROJECT_ROOT_PATH.replace(
33
- new RegExp(`^${escapedBasePathToRemove}`),
34
- ""
35
- ).replace(/\\/g, "/");
32
+ const relativeWebPath = projectRootPath
33
+ .replace(new RegExp(`^${escapedBasePathToRemove}`), "")
34
+ .replace(/\\/g, "/");
36
35
  // Construct the Browser Sync command with the correct proxy URL, being careful not to affect the protocol part
37
36
  let proxyUrl = `http://localhost/${relativeWebPath}`;
38
37
  // Ensure the proxy URL does not end with a slash before appending '/public'
@@ -402,13 +401,6 @@ async function createDirectoryStructure(baseDir, answer) {
402
401
  } else {
403
402
  modifyLayoutPHP(baseDir, false);
404
403
  }
405
- const prismaEnvContent = `# Environment variables declared in this file are automatically made available to Prisma.
406
- # See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
407
-
408
- # Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
409
- # See the documentation for all the connection string options: https://pris.ly/d/connection-strings
410
-
411
- DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"`;
412
404
  const prismaPHPEnvContent = `# Prisma PHP Auth Secret Key For development only - Change this in production
413
405
  AUTH_SECRET=uxsjXVPHN038DEYls2Kw0QUgBcXKUyrjv416nIFWPY4=
414
406
 
@@ -420,13 +412,7 @@ AUTH_SECRET=uxsjXVPHN038DEYls2Kw0QUgBcXKUyrjv416nIFWPY4=
420
412
  # SMTP_ENCRYPTION=ssl or tls
421
413
  # MAIL_FROM=john.doe@gmail.com
422
414
  # MAIL_FROM_NAME="John Doe"`;
423
- let envContent = prismaPHPEnvContent;
424
- if (answer.prisma) {
425
- envContent = `${prismaEnvContent}\n\n${prismaPHPEnvContent}`;
426
- await createOrUpdateEnvFile(baseDir, envContent);
427
- } else {
428
- await createOrUpdateEnvFile(baseDir, envContent);
429
- }
415
+ await createOrUpdateEnvFile(baseDir, prismaPHPEnvContent);
430
416
  // Add vendor to .gitignore
431
417
  await createUpdateGitignoreFile(baseDir, ["vendor", ".env", "node_modules"]);
432
418
  }
@@ -731,16 +717,7 @@ async function main() {
731
717
  }
732
718
  const version = await fetchPackageVersion("create-prisma-php-app");
733
719
  const projectPathModified = projectPath.replace(/\\/g, "\\");
734
- const PHP_GENERATE_CLASS_PATH = answer.prisma
735
- ? "src/Lib/Prisma/Classes"
736
- : "";
737
- const projectSettings = {
738
- PROJECT_NAME: answer.projectName,
739
- PROJECT_ROOT_PATH: projectPathModified,
740
- PHP_ROOT_PATH_EXE: "C:\\\\xampp\\\\php\\\\php.exe",
741
- PHP_GENERATE_CLASS_PATH,
742
- };
743
- const bsConfig = bsConfigUrls(projectSettings);
720
+ const bsConfig = bsConfigUrls(projectPathModified);
744
721
  const phpGenerateClassPath = answer.prisma ? "src/Lib/Prisma/Classes" : "";
745
722
  const prismaPhpConfig = {
746
723
  projectName: answer.projectName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.11.541",
3
+ "version": "1.11.543",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",