create-prisma-php-app 4.0.0-alpha.35 → 4.0.0-alpha.37

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 +37 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -425,14 +425,23 @@ function mergeConfigurationFiles(
425
425
  const bsConfig = bsConfigUrls(projectPathModified);
426
426
  // If we have existing config, merge with it
427
427
  if (existingConfig) {
428
+ console.log(chalk.blue("Merging with existing configuration..."));
429
+ console.log(
430
+ chalk.gray(
431
+ `Preserving excludeFiles: ${JSON.stringify(
432
+ existingConfig.excludeFiles || []
433
+ )}`
434
+ )
435
+ );
428
436
  const mergedConfig = {
429
- ...existingConfig, // Start with existing config
430
- // Only update specific fields that should be updated
437
+ ...existingConfig, // Start with existing config to preserve all existing fields
438
+ // Only update specific fields that should be updated for starter kits
431
439
  projectName: answer.projectName,
432
440
  projectRootPath: projectPathModified,
433
441
  bsTarget: bsConfig.bsTarget,
434
442
  bsPathRewrite: bsConfig.bsPathRewrite,
435
- // Update feature flags only if they're different from existing
443
+ version: latestVersion,
444
+ // Update feature flags based on starter kit
436
445
  backendOnly: answer.backendOnly,
437
446
  swaggerDocs: answer.swaggerDocs,
438
447
  tailwindcss: answer.tailwindcss,
@@ -440,8 +449,7 @@ function mergeConfigurationFiles(
440
449
  mcp: answer.mcp,
441
450
  prisma: answer.prisma,
442
451
  docker: answer.docker,
443
- version: latestVersion,
444
- // KEEP existing excludeFiles - this is crucial!
452
+ // CRITICAL: Always preserve existing excludeFiles
445
453
  excludeFiles: existingConfig.excludeFiles || [],
446
454
  };
447
455
  fs.writeFileSync(
@@ -449,10 +457,16 @@ function mergeConfigurationFiles(
449
457
  JSON.stringify(mergedConfig, null, 2),
450
458
  { flag: "w" }
451
459
  );
460
+ console.log(chalk.green("✓ Configuration merged successfully!"));
452
461
  console.log(
453
- chalk.green("✓ Configuration merged successfully, exclusions preserved")
462
+ chalk.green(
463
+ `✓ Preserved ${
464
+ (existingConfig.excludeFiles || []).length
465
+ } excluded files`
466
+ )
454
467
  );
455
468
  } else {
469
+ console.log(chalk.blue("Creating new configuration..."));
456
470
  // New project - create fresh config
457
471
  const prismaPhpConfig = {
458
472
  projectName: answer.projectName,
@@ -476,6 +490,7 @@ function mergeConfigurationFiles(
476
490
  JSON.stringify(prismaPhpConfig, null, 2),
477
491
  { flag: "w" }
478
492
  );
493
+ console.log(chalk.green("✓ New configuration created"));
479
494
  }
480
495
  }
481
496
  async function main() {
@@ -657,6 +672,10 @@ async function main() {
657
672
  projectPath = path.join(currentDir, answer.projectName);
658
673
  process.chdir(answer.projectName);
659
674
  }
675
+ // Add starter kit setup before npm/composer installation
676
+ if (answer.starterKit) {
677
+ await setupStarterKit(projectPath, answer);
678
+ }
660
679
  let npmDependencies = [
661
680
  npmPkg("typescript"),
662
681
  npmPkg("@types/node"),
@@ -705,10 +724,6 @@ async function main() {
705
724
  if (answer.prisma) {
706
725
  execSync("npm install -g prisma-client-php", { stdio: "inherit" });
707
726
  }
708
- // Add starter kit setup before npm/composer installation
709
- if (answer.starterKit) {
710
- await setupStarterKit(projectPath, answer);
711
- }
712
727
  await installNpmDependencies(projectPath, npmDependencies, true);
713
728
  await installComposerDependencies(projectPath, composerDependencies);
714
729
  if (!projectName) {
@@ -945,14 +960,24 @@ async function main() {
945
960
  // Check if there's an existing config to merge with
946
961
  let existingConfig = null;
947
962
  const configPath = path.join(projectPath, "prisma-php.json");
948
- if (fs.existsSync(configPath) && updateAnswer?.excludeFiles) {
963
+ // Always check if config exists - don't depend on updateAnswer
964
+ if (fs.existsSync(configPath)) {
949
965
  try {
950
- existingConfig = JSON.parse(fs.readFileSync(configPath, "utf8"));
966
+ const rawConfig = fs.readFileSync(configPath, "utf8");
967
+ existingConfig = JSON.parse(rawConfig);
951
968
  console.log(chalk.blue("Found existing configuration, merging..."));
969
+ console.log(
970
+ chalk.gray(
971
+ `Existing excludeFiles: ${JSON.stringify(
972
+ existingConfig.excludeFiles || []
973
+ )}`
974
+ )
975
+ );
952
976
  } catch (error) {
953
977
  console.warn(
954
978
  chalk.yellow("Could not read existing config, creating new one")
955
979
  );
980
+ existingConfig = null;
956
981
  }
957
982
  }
958
983
  // Merge or create configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "4.0.0-alpha.35",
3
+ "version": "4.0.0-alpha.37",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",