create-prisma-php-app 2.3.38 → 2.3.40

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.
@@ -29,7 +29,7 @@ const watcher = chokidar.watch("src/app/**/*", {
29
29
 
30
30
  // On changes, generate file list and also update the class log
31
31
  const handleFileChange = async () => {
32
- generateFileListJson();
32
+ await generateFileListJson();
33
33
  await updateAllClassLogs();
34
34
  await updateComponentImports();
35
35
 
@@ -1,6 +1,12 @@
1
1
  import { join } from "path";
2
2
  import { generateFileListJson } from "./files-list.js";
3
3
  import { updateAllClassLogs } from "./class-log.js";
4
+ import {
5
+ deleteFilesIfExist,
6
+ filesToDelete,
7
+ deleteDirectoriesIfExist,
8
+ dirsToDelete,
9
+ } from "./project-name.js";
4
10
  import {
5
11
  analyzeImportsInFile,
6
12
  getAllPhpFiles,
@@ -13,6 +19,8 @@ import { checkComponentImports } from "./component-import-checker";
13
19
  console.log("📦 Generating files for production...");
14
20
 
15
21
  // 1) Run all watchers logic ONCE
22
+ await deleteFilesIfExist(filesToDelete);
23
+ await deleteDirectoriesIfExist(dirsToDelete);
16
24
  await generateFileListJson();
17
25
  await updateAllClassLogs();
18
26
  await updateComponentImports();
@@ -51,6 +51,12 @@ function updateProjectNameInConfig(
51
51
  // Function to determine the target path for browser-sync
52
52
  function getTargetPath(fullPath: string, environment: string): string {
53
53
  const normalizedPath = normalize(fullPath);
54
+
55
+ // Patch: if CI, return root ("/") as default target path
56
+ if (process.env.CI === "true") {
57
+ return "/";
58
+ }
59
+
54
60
  const webDirectories: { [key: string]: string } = {
55
61
  XAMPP: join("htdocs"),
56
62
  WAMP: join("www"),
@@ -91,7 +97,9 @@ const configFilePath = join(__dirname, "..", "prisma-php.json");
91
97
  // Run the function with your config file path and the new project name
92
98
  updateProjectNameInConfig(configFilePath, newProjectName);
93
99
 
94
- const deleteFilesIfExist = async (filePaths: string[]): Promise<void> => {
100
+ export const deleteFilesIfExist = async (
101
+ filePaths: string[]
102
+ ): Promise<void> => {
95
103
  for (const filePath of filePaths) {
96
104
  try {
97
105
  await fsPromises.unlink(filePath);
@@ -115,7 +123,9 @@ const deleteFilesIfExist = async (filePaths: string[]): Promise<void> => {
115
123
  }
116
124
  };
117
125
 
118
- async function deleteDirectoriesIfExist(dirPaths: string[]): Promise<void> {
126
+ export async function deleteDirectoriesIfExist(
127
+ dirPaths: string[]
128
+ ): Promise<void> {
119
129
  for (const dirPath of dirPaths) {
120
130
  try {
121
131
  await fsPromises.rm(dirPath, { recursive: true, force: true });
@@ -126,13 +136,16 @@ async function deleteDirectoriesIfExist(dirPaths: string[]): Promise<void> {
126
136
  }
127
137
  }
128
138
 
129
- const filesToDelete = [
139
+ export const filesToDelete = [
130
140
  join(__dirname, "request-data.json"),
131
141
  join(__dirname, "class-log.json"),
132
142
  join(__dirname, "class-imports.json"),
133
143
  ];
134
144
 
135
- const dirsToDelete = [join(__dirname, "..", "caches")];
145
+ export const dirsToDelete = [
146
+ join(__dirname, "..", "caches"),
147
+ join(__dirname, "..", ".pphp"),
148
+ ];
136
149
 
137
150
  await deleteFilesIfExist(filesToDelete);
138
151
  await deleteDirectoriesIfExist(dirsToDelete);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "2.3.38",
3
+ "version": "2.3.40",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",