create-prisma-php-app 1.6.53 → 1.6.55

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
@@ -163,6 +163,9 @@ async function createUpdateGitignoreFile(baseDir, additions) {
163
163
  }
164
164
  // Recursive copy function
165
165
  function copyRecursiveSync(src, dest) {
166
+ var _a;
167
+ console.log("🚀 ~ copyRecursiveSync ~ dest:", dest);
168
+ console.log("🚀 ~ copyRecursiveSync ~ src:", src);
166
169
  const exists = fs.existsSync(src);
167
170
  const stats = exists && fs.statSync(src);
168
171
  const isDirectory = exists && stats && stats.isDirectory();
@@ -173,6 +176,10 @@ function copyRecursiveSync(src, dest) {
173
176
  });
174
177
  }
175
178
  else {
179
+ if ((_a = updateAnswer === null || updateAnswer === void 0 ? void 0 : updateAnswer.excludeFiles) === null || _a === void 0 ? void 0 : _a.includes(dest.replace(/\\/g, "/"))) {
180
+ console.log(`Skipping file: ${src}`);
181
+ return;
182
+ }
176
183
  fs.copyFileSync(src, dest, 0);
177
184
  }
178
185
  }
@@ -426,8 +433,12 @@ function fetchPackageVersion(packageName) {
426
433
  .on("error", (err) => reject(err));
427
434
  });
428
435
  }
436
+ const readJsonFile = (filePath) => {
437
+ const jsonData = fs.readFileSync(filePath, "utf8");
438
+ return JSON.parse(jsonData);
439
+ };
429
440
  async function main() {
430
- var _a, _b;
441
+ var _a, _b, _c;
431
442
  try {
432
443
  const args = process.argv.slice(2);
433
444
  let projectName = args[0];
@@ -436,6 +447,9 @@ async function main() {
436
447
  if (projectName) {
437
448
  let useTailwind = args.includes("--tailwindcss");
438
449
  let useWebsocket = args.includes("--websocket");
450
+ const currentDir = process.cwd();
451
+ const configPath = path.join(currentDir, "prisma-php.json");
452
+ const localSettings = readJsonFile(configPath);
439
453
  const predefinedAnswers = {
440
454
  projectName,
441
455
  tailwindcss: useTailwind,
@@ -446,11 +460,18 @@ async function main() {
446
460
  console.log(chalk.red("Installation cancelled."));
447
461
  return;
448
462
  }
463
+ let excludeFiles = [];
464
+ (_a = localSettings.excludeFiles) === null || _a === void 0 ? void 0 : _a.map((file) => {
465
+ const filePath = path.join(currentDir, file);
466
+ if (fs.existsSync(filePath))
467
+ excludeFiles.push(path.join(currentDir, file));
468
+ });
449
469
  updateAnswer = {
450
470
  projectName,
451
- tailwindcss: (_a = answer === null || answer === void 0 ? void 0 : answer.tailwindcss) !== null && _a !== void 0 ? _a : false,
452
- websocket: (_b = answer === null || answer === void 0 ? void 0 : answer.websocket) !== null && _b !== void 0 ? _b : false,
471
+ tailwindcss: (_b = answer === null || answer === void 0 ? void 0 : answer.tailwindcss) !== null && _b !== void 0 ? _b : false,
472
+ websocket: (_c = answer === null || answer === void 0 ? void 0 : answer.websocket) !== null && _c !== void 0 ? _c : false,
453
473
  isUpdate: true,
474
+ excludeFiles: excludeFiles.length > 0 ? excludeFiles : [],
454
475
  };
455
476
  console.log("🚀 ~ main ~ answer:", answer);
456
477
  }
@@ -77,7 +77,14 @@ const main = async () => {
77
77
  ]);
78
78
  }
79
79
  catch (error) {
80
- console.error("Error in script execution:", error);
80
+ if (error instanceof Error) {
81
+ if (error.message.includes("no such file or directory")) {
82
+ console.error(chalk.red("The configuration file 'prisma-php.json' was not found in the current directory."));
83
+ }
84
+ }
85
+ else {
86
+ console.error("Error in script execution:", error);
87
+ }
81
88
  }
82
89
  }
83
90
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.6.53",
3
+ "version": "1.6.55",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",