detectBuildToolFromFiles detects the build tool by checking for config files in dir. Falls back to the conventional default for the framework if no relevant file is found.
(dir, framework string)
| 469 | // detectBuildToolFromFiles detects the build tool by checking for config files in dir. |
| 470 | // Falls back to the conventional default for the framework if no relevant file is found. |
| 471 | func detectBuildToolFromFiles(dir, framework string) string { |
| 472 | if fileExistsAny(dir, "vite.config.ts", "vite.config.js") { |
| 473 | return "vite" |
| 474 | } |
| 475 | if fileExists(dir, "pom.xml") { |
| 476 | return "maven" |
| 477 | } |
| 478 | if fileExistsAny(dir, "build.gradle", "build.gradle.kts") { |
| 479 | return "gradle" |
| 480 | } |
| 481 | if fileExists(dir, "composer.json") { |
| 482 | return "composer" |
| 483 | } |
| 484 | // Framework-specific defaults as fallback. |
| 485 | switch framework { |
| 486 | case "ionic-react", "ionic-vue", "sveltekit": |
| 487 | return "vite" |
| 488 | case "spring-boot", "vanilla-java", "java-ee": |
| 489 | return "maven" |
| 490 | case "laravel", "vanilla-php": |
| 491 | return "composer" |
| 492 | } |
| 493 | return "" |
| 494 | } |
| 495 | |
| 496 | // findJavaBuildContent finds pom.xml or build.gradle and returns content + build tool name. |
| 497 | func findJavaBuildContent(dir string) (content, buildTool string, ok bool) { |
no test coverage detected