create-prisma-php-app 1.6.37 → 1.6.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.
Files changed (2) hide show
  1. package/dist/index.js +41 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import prompts from "prompts";
8
8
  import https from "https";
9
9
  const __filename = fileURLToPath(import.meta.url);
10
10
  const __dirname = path.dirname(__filename);
11
- let UpdateAnswer = null;
11
+ let updateAnswer = null;
12
12
  function configureBrowserSyncCommand(baseDir, projectSettings) {
13
13
  // Identify the base path dynamically up to and including 'htdocs'
14
14
  const htdocsIndex = projectSettings.PROJECT_ROOT_PATH.indexOf("\\htdocs\\");
@@ -255,8 +255,11 @@ async function createDirectoryStructure(baseDir, answer, projectSettings) {
255
255
  { src: "/.htaccess", dest: "/.htaccess" },
256
256
  { src: "/../composer.json", dest: "/composer.json" },
257
257
  ];
258
- if (UpdateAnswer === null || UpdateAnswer === void 0 ? void 0 : UpdateAnswer.isUpdate) {
259
- filesToCopy.push({ src: "/.env", dest: "/.env" }, { src: "/postcss.config.js", dest: "/postcss.config.js" }, { src: "/tailwind.config.js", dest: "/tailwind.config.js" }, { src: "/tsconfig.json", dest: "/tsconfig.json" });
258
+ if (updateAnswer === null || updateAnswer === void 0 ? void 0 : updateAnswer.isUpdate) {
259
+ filesToCopy.push({ src: "/.env", dest: "/.env" }, { src: "/tsconfig.json", dest: "/tsconfig.json" });
260
+ if (updateAnswer.tailwindcss) {
261
+ filesToCopy.push({ src: "/postcss.config.js", dest: "/postcss.config.js" }, { src: "/tailwind.config.js", dest: "/tailwind.config.js" });
262
+ }
260
263
  }
261
264
  // if (answer.websocket) {
262
265
  // filesToCopy.push({
@@ -395,6 +398,17 @@ async function installDependencies(baseDir, dependencies, isDev = false) {
395
398
  cwd: baseDir,
396
399
  });
397
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
+ }
398
412
  function fetchPackageVersion(packageName) {
399
413
  return new Promise((resolve, reject) => {
400
414
  https
@@ -429,7 +443,7 @@ async function main() {
429
443
  websocket: useWebsocket,
430
444
  };
431
445
  answer = await getAnswer(predefinedAnswers);
432
- UpdateAnswer = {
446
+ updateAnswer = {
433
447
  projectName,
434
448
  tailwindcss: useTailwind,
435
449
  websocket: useWebsocket,
@@ -554,6 +568,29 @@ async function main() {
554
568
  }
555
569
  });
556
570
  }
571
+ if (updateAnswer === null || updateAnswer === void 0 ? void 0 : updateAnswer.isUpdate) {
572
+ const updateUninstallDependencies = [];
573
+ if (!updateAnswer.tailwindcss) {
574
+ const tailwindFiles = ["postcss.config.js", "tailwind.config.js"];
575
+ tailwindFiles.forEach((file) => {
576
+ const filePath = path.join(projectPath, file);
577
+ if (fs.existsSync(filePath)) {
578
+ fs.unlinkSync(filePath); // Delete each file if it exists
579
+ console.log(`${file} was deleted successfully.`);
580
+ }
581
+ else {
582
+ console.log(`${file} does not exist.`);
583
+ }
584
+ });
585
+ updateUninstallDependencies.push("tailwindcss", "autoprefixer", "postcss", "postcss-cli", "cssnano");
586
+ }
587
+ if (!updateAnswer.websocket) {
588
+ updateUninstallDependencies.push("chokidar-cli");
589
+ }
590
+ if (updateUninstallDependencies.length > 0) {
591
+ await uninstallDependencies(projectPath, updateUninstallDependencies, true);
592
+ }
593
+ }
557
594
  const version = await fetchPackageVersion("create-prisma-php-app");
558
595
  const prismaPhpConfig = {
559
596
  projectName: answer.projectName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.6.37",
3
+ "version": "1.6.39",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",