create-prisma-php-app 4.0.0-alpha.37 → 4.0.0-alpha.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 +43 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -957,29 +957,63 @@ async function main() {
957
957
  await uninstallComposerDependencies(projectPath, composerToUninstall);
958
958
  }
959
959
  }
960
- // Check if there's an existing config to merge with
960
+ // Check for existing config to merge with
961
961
  let existingConfig = null;
962
- const configPath = path.join(projectPath, "prisma-php.json");
963
- // Always check if config exists - don't depend on updateAnswer
964
- if (fs.existsSync(configPath)) {
962
+ const currentDirConfigPath = path.join(process.cwd(), "prisma-php.json");
963
+ const finalProjectConfigPath = path.join(projectPath, "prisma-php.json");
964
+ // First, check current directory (where command is run) for existing config
965
+ if (
966
+ fs.existsSync(currentDirConfigPath) &&
967
+ currentDirConfigPath !== finalProjectConfigPath
968
+ ) {
965
969
  try {
966
- const rawConfig = fs.readFileSync(configPath, "utf8");
970
+ const rawConfig = fs.readFileSync(currentDirConfigPath, "utf8");
967
971
  existingConfig = JSON.parse(rawConfig);
968
- console.log(chalk.blue("Found existing configuration, merging..."));
972
+ console.log(
973
+ chalk.blue(
974
+ "Found existing configuration in current directory, using exclusions..."
975
+ )
976
+ );
969
977
  console.log(
970
978
  chalk.gray(
971
- `Existing excludeFiles: ${JSON.stringify(
979
+ `Source excludeFiles: ${JSON.stringify(
972
980
  existingConfig.excludeFiles || []
973
981
  )}`
974
982
  )
975
983
  );
976
984
  } catch (error) {
977
- console.warn(
978
- chalk.yellow("Could not read existing config, creating new one")
985
+ console.warn(chalk.yellow("Could not read current directory config"));
986
+ existingConfig = null;
987
+ }
988
+ }
989
+ // If no config in current directory, check the target project directory
990
+ if (!existingConfig && fs.existsSync(finalProjectConfigPath)) {
991
+ try {
992
+ const rawConfig = fs.readFileSync(finalProjectConfigPath, "utf8");
993
+ existingConfig = JSON.parse(rawConfig);
994
+ console.log(
995
+ chalk.blue(
996
+ "Found existing configuration in project directory, merging..."
997
+ )
979
998
  );
999
+ console.log(
1000
+ chalk.gray(
1001
+ `Project excludeFiles: ${JSON.stringify(
1002
+ existingConfig.excludeFiles || []
1003
+ )}`
1004
+ )
1005
+ );
1006
+ } catch (error) {
1007
+ console.warn(chalk.yellow("Could not read project config"));
980
1008
  existingConfig = null;
981
1009
  }
982
1010
  }
1011
+ // If still no existing config found
1012
+ if (!existingConfig) {
1013
+ console.log(
1014
+ chalk.blue("No existing configuration found, creating new one...")
1015
+ );
1016
+ }
983
1017
  // Merge or create configuration
984
1018
  mergeConfigurationFiles(
985
1019
  projectPath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "4.0.0-alpha.37",
3
+ "version": "4.0.0-alpha.39",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",