create-prisma-php-app 1.22.500 → 1.22.502

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
@@ -75,7 +75,7 @@ const config = JSON.parse(jsonData);
75
75
 
76
76
  // Watch for file changes (create, delete, save)
77
77
  const watcher = chokidar.watch("src/**/*", {
78
- ignored: /(^|[\/\\])\../, // Ignore dotfiles
78
+ ignored: /(^|[\\/\\])\\../,
79
79
  persistent: true,
80
80
  usePolling: true,
81
81
  interval: 1000,
@@ -0,0 +1,61 @@
1
+ import { readdirSync, statSync, existsSync, writeFileSync } from "fs";
2
+ import path, { dirname } from "path";
3
+ import { fileURLToPath } from "url";
4
+
5
+ // Define __dirname equivalent in ES modules
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = dirname(__filename);
8
+
9
+ const dirPath = path.join(__dirname, "..", "src", "app");
10
+ const jsonFilePath = path.join(__dirname, "files-list.json");
11
+
12
+ // Function to get all files in the directory
13
+ const getAllFiles = (dirPath) => {
14
+ const files = [];
15
+
16
+ // Check if directory exists before reading
17
+ if (!existsSync(dirPath)) {
18
+ console.error(`Directory not found: ${dirPath}`);
19
+ return files; // Return an empty array if the directory doesn't exist
20
+ }
21
+
22
+ const items = readdirSync(dirPath);
23
+ items.forEach((item) => {
24
+ const fullPath = path.join(dirPath, item);
25
+ if (statSync(fullPath).isDirectory()) {
26
+ files.push(...getAllFiles(fullPath)); // Recursive call for subdirectories
27
+ } else {
28
+ // Generate the relative path and ensure it starts with ./src
29
+ const relativePath = `.${path.sep}${path.relative(
30
+ path.join(__dirname, ".."),
31
+ fullPath
32
+ )}`;
33
+ // Replace only the root backslashes with forward slashes and leave inner ones
34
+ files.push(relativePath.replace(/\\/g, "\\").replace(/^\.\.\//, ""));
35
+ }
36
+ });
37
+
38
+ return files;
39
+ };
40
+
41
+ // Function to generate the files-list.json
42
+ const generateFileListJson = () => {
43
+ const files = getAllFiles(dirPath);
44
+
45
+ // If files exist, generate JSON file
46
+ if (files.length > 0) {
47
+ writeFileSync(jsonFilePath, JSON.stringify(files, null, 2));
48
+ console.log(
49
+ `File list has been saved to: settings/files-list.json`
50
+ );
51
+ } else {
52
+ console.error("No files found to save in the JSON file.");
53
+ }
54
+ };
55
+
56
+ // Main function
57
+ async function processDirectory() {
58
+ generateFileListJson();
59
+ }
60
+
61
+ processDirectory();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.22.500",
3
+ "version": "1.22.502",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",