create-prisma-php-app 2.3.38 → 2.3.39

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();
@@ -91,7 +91,9 @@ const configFilePath = join(__dirname, "..", "prisma-php.json");
91
91
  // Run the function with your config file path and the new project name
92
92
  updateProjectNameInConfig(configFilePath, newProjectName);
93
93
 
94
- const deleteFilesIfExist = async (filePaths: string[]): Promise<void> => {
94
+ export const deleteFilesIfExist = async (
95
+ filePaths: string[]
96
+ ): Promise<void> => {
95
97
  for (const filePath of filePaths) {
96
98
  try {
97
99
  await fsPromises.unlink(filePath);
@@ -115,7 +117,9 @@ const deleteFilesIfExist = async (filePaths: string[]): Promise<void> => {
115
117
  }
116
118
  };
117
119
 
118
- async function deleteDirectoriesIfExist(dirPaths: string[]): Promise<void> {
120
+ export async function deleteDirectoriesIfExist(
121
+ dirPaths: string[]
122
+ ): Promise<void> {
119
123
  for (const dirPath of dirPaths) {
120
124
  try {
121
125
  await fsPromises.rm(dirPath, { recursive: true, force: true });
@@ -126,13 +130,16 @@ async function deleteDirectoriesIfExist(dirPaths: string[]): Promise<void> {
126
130
  }
127
131
  }
128
132
 
129
- const filesToDelete = [
133
+ export const filesToDelete = [
130
134
  join(__dirname, "request-data.json"),
131
135
  join(__dirname, "class-log.json"),
132
136
  join(__dirname, "class-imports.json"),
133
137
  ];
134
138
 
135
- const dirsToDelete = [join(__dirname, "..", "caches")];
139
+ export const dirsToDelete = [
140
+ join(__dirname, "..", "caches"),
141
+ join(__dirname, "..", ".pphp"),
142
+ ];
136
143
 
137
144
  await deleteFilesIfExist(filesToDelete);
138
145
  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.39",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",