create-prisma-php-app 1.6.38 → 1.6.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.
Files changed (2) hide show
  1. package/dist/index.js +38 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -398,6 +398,17 @@ async function installDependencies(baseDir, dependencies, isDev = false) {
398
398
  cwd: baseDir,
399
399
  });
400
400
  }
401
+ async function uninstallDependencies(baseDir, dependencies, isDev = false) {
402
+ console.log("Uninstalling dependencies:");
403
+ dependencies.forEach((dep) => console.log(`- ${chalk.blue(dep)}`));
404
+ // Prepare the npm uninstall command with the appropriate flag for dev dependencies
405
+ const npmUninstallCommand = `npm uninstall ${isDev ? "--save-dev" : "--save"} ${dependencies.join(" ")}`;
406
+ // Execute the npm uninstall command
407
+ execSync(npmUninstallCommand, {
408
+ stdio: "inherit",
409
+ cwd: baseDir,
410
+ });
411
+ }
401
412
  function fetchPackageVersion(packageName) {
402
413
  return new Promise((resolve, reject) => {
403
414
  https
@@ -418,6 +429,7 @@ function fetchPackageVersion(packageName) {
418
429
  });
419
430
  }
420
431
  async function main() {
432
+ var _a, _b;
421
433
  try {
422
434
  const args = process.argv.slice(2);
423
435
  let projectName = args[0];
@@ -434,8 +446,8 @@ async function main() {
434
446
  answer = await getAnswer(predefinedAnswers);
435
447
  updateAnswer = {
436
448
  projectName,
437
- tailwindcss: useTailwind,
438
- websocket: useWebsocket,
449
+ tailwindcss: (_a = answer === null || answer === void 0 ? void 0 : answer.tailwindcss) !== null && _a !== void 0 ? _a : false,
450
+ websocket: (_b = answer === null || answer === void 0 ? void 0 : answer.websocket) !== null && _b !== void 0 ? _b : false,
439
451
  isUpdate: true,
440
452
  };
441
453
  console.log("🚀 ~ main ~ answer:", answer);
@@ -557,6 +569,30 @@ async function main() {
557
569
  }
558
570
  });
559
571
  }
572
+ if (updateAnswer === null || updateAnswer === void 0 ? void 0 : updateAnswer.isUpdate) {
573
+ console.log("🚀 ~ main ~ updateAnswer:", updateAnswer);
574
+ const updateUninstallDependencies = [];
575
+ if (!updateAnswer.tailwindcss) {
576
+ const tailwindFiles = ["postcss.config.js", "tailwind.config.js"];
577
+ tailwindFiles.forEach((file) => {
578
+ const filePath = path.join(projectPath, file);
579
+ if (fs.existsSync(filePath)) {
580
+ fs.unlinkSync(filePath); // Delete each file if it exists
581
+ console.log(`${file} was deleted successfully.`);
582
+ }
583
+ else {
584
+ console.log(`${file} does not exist.`);
585
+ }
586
+ });
587
+ updateUninstallDependencies.push("tailwindcss", "autoprefixer", "postcss", "postcss-cli", "cssnano");
588
+ }
589
+ if (!updateAnswer.websocket) {
590
+ updateUninstallDependencies.push("chokidar-cli");
591
+ }
592
+ if (updateUninstallDependencies.length > 0) {
593
+ await uninstallDependencies(projectPath, updateUninstallDependencies, true);
594
+ }
595
+ }
560
596
  const version = await fetchPackageVersion("create-prisma-php-app");
561
597
  const prismaPhpConfig = {
562
598
  projectName: answer.projectName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.6.38",
3
+ "version": "1.6.40",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",