feat: [#423] goravel/framework could run independently of goravel/goravel#1289
feat: [#423] goravel/framework could run independently of goravel/goravel#1289
Conversation
| ) | ||
|
|
||
| func main() { | ||
| setup := packages.Setup(os.Args) |
There was a problem hiding this comment.
os.Args contains the paths info, packages.Setup(os.Args) should always be called at the start.
|
|
||
| // install package | ||
| if err := supportconsole.ExecuteCommand(ctx, exec.Command("go", "run", setup, "install", "--module="+packages.GetModuleName())); err != nil { | ||
| if err := supportconsole.ExecuteCommand(ctx, exec.Command("go", "run", setup, "install", "--package-name="+packages.GetPackageName(), "--paths="+r.paths)); err != nil { |
There was a problem hiding this comment.
support.Config.Paths cannot be shared with module when installing facade, so paths should be passed here.
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.
| Benchmark suite | Current: b4d0279 | Previous: 9a4a7b4 | Ratio |
|---|---|---|---|
Benchmark_DecryptString |
5252 ns/op 2032 B/op 16 allocs/op |
2082 ns/op 2032 B/op 16 allocs/op |
2.52 |
Benchmark_DecryptString - ns/op |
5252 ns/op |
2082 ns/op |
2.52 |
Benchmark_Fatal |
5e-7 ns/op 0 B/op 0 allocs/op |
2e-7 ns/op 0 B/op 0 allocs/op |
2.50 |
Benchmark_Fatal - ns/op |
5e-7 ns/op |
2e-7 ns/op |
2.50 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1289 +/- ##
==========================================
+ Coverage 68.58% 68.91% +0.32%
==========================================
Files 264 265 +1
Lines 15641 15732 +91
==========================================
+ Hits 10728 10841 +113
+ Misses 4447 4424 -23
- Partials 466 467 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR enables the Goravel framework to run independently of the goravel/goravel skeleton project by introducing a flexible path configuration system. The changes allow users to customize project structure through configurable paths, replacing hardcoded directory structures.
Key Changes:
- Introduced comprehensive path configuration with 23+ configurable directory paths, all using forward slashes for cross-platform compatibility
- Renamed interface methods from singular to plural (e.g.,
Command()→Commands(),Model()→Models()) for better clarity - Replaced
--moduleflag with--package-nameand added--pathsflag for JSON-based path configuration in package setup commands - Added helper functions
PathToSlice()andPathPackage()to parse path strings and extract package names - Refactored all application path methods to use the new configurable paths instead of hardcoded values
- Updated the cache setup as a reference implementation showing how packages should handle custom paths
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| support/variable.go | Adds comprehensive Paths struct with 23+ configurable directory paths and helper functions for path manipulation |
| support/variable_test.go | Adds comprehensive test coverage for PathToSlice function with various path formats |
| contracts/foundation/configuration/paths.go | Updates Paths interface with singular→plural method names and adds new path configuration methods |
| foundation/configuration/paths.go | Implements all new Paths interface methods to configure custom directory structures |
| foundation/configuration/paths_test.go | Adds comprehensive tests for all path configuration methods |
| foundation/application.go | Refactors path resolution methods to use PathToSlice and configured paths instead of hardcoded values |
| foundation/application_test.go | Updates LangPath tests to handle deprecated config key and new path resolution |
| foundation/application_builder_test.go | Updates WithPaths tests to use plural method names |
| support/path/internals/path.go | Updates internal path helpers to use PathToSlice for path resolution |
| support/path/internals/path_test.go | Adds new tests for Abs and BootstrapApp functions |
| support/path/path.go | Adds warning comment about avoiding import cycles in framework code |
| packages/setup.go | Replaces --module with --package-name flag, adds --paths JSON flag, and implements PackageName() method |
| packages/setup_test.go | Updates tests for new package name handling and refactors test structure |
| contracts/packages/setup.go | Adds PackageName() method to Setup interface |
| mocks/packages/Setup.go | Regenerates mock with new PackageName() method |
| foundation/console/package_install_command.go | Updates to pass package name and paths JSON to setup scripts |
| foundation/console/package_install_command_test.go | Updates all test expectations to include new --package-name and --paths flags |
| foundation/console/package_uninstall_command.go | Updates to pass package name and paths JSON to setup scripts |
| foundation/console/package_uninstall_command_test.go | Updates all test expectations to include new flags and adds json mock |
| foundation/console/test_make_command.go | Renames GetModuleName to GetPackageName |
| cache/setup/setup.go | Updates as reference implementation to handle custom paths and package names |
| cache/setup/stubs.go | Updates stubs to accept package parameter for proper code generation |
| mocks/foundation/configuration/Paths.go | Regenerates mocks with all new plural method names |
| database/console/migration/migrate_make_command.go | Minor formatting improvement (blank line after import) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📑 Description
This PR enables the Goravel framework to run independently without requiring the goravel/goravel skeleton project. It introduces a flexible path configuration system that allows users to customize project structure.
Related Issue: goravel/goravel#423
🔧 Changes
Core Changes
1. Path Configuration System
Pathsinterface with new methods (App(),Config(),Database(),Facades(),Lang(),Public(),Resources(),Storage())Command()→Commands(),Model()→Models(), etc.)support.Config.Pathswith default values2. Package Installation System
--moduleflag with--package-namein setup commands--pathsflag to pass path configuration as JSONPackageInstallCommandandPackageUninstallCommandto pass paths to setup scripts3. Path Resolution
ConfigPath(),DatabasePath(),ModelPath(), etc.) to use configured paths instead of hardcoded valuesLangPath()with backward compatibility for deprecatedapp.lang_pathconfigPathToSlice()helper4. Cache Setup Example
cache/setupas reference implementationWhenFacade()modifierNew Helper Functions
✅ Checks