Skip to content

feat: [#423] goravel/framework could run independently of goravel/goravel#1222

Merged
hwbrzzl merged 1 commit intomasterfrom
bowen/#423
Oct 13, 2025
Merged

feat: [#423] goravel/framework could run independently of goravel/goravel#1222
hwbrzzl merged 1 commit intomasterfrom
bowen/#423

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Oct 12, 2025

📑 Description

Relate goravel/goravel#423

This is the first PR for this issue, to replace some fixed paths. User can configure the code structure by adding the code below in the bootstrap/app.go file in the future. The code can be optimized if needed.

WithPaths(
    ModelPath(""),
    FilterPath(""),
    ...
)

✅ Checks

  • Added test cases for my code

@hwbrzzl hwbrzzl requested a review from a team as a code owner October 12, 2025 08:17
Copilot AI review requested due to automatic review settings October 12, 2025 08:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces configurable paths to replace hardcoded file paths throughout the framework, supporting the goal of making goravel/framework run independently of goravel/goravel. The changes centralize path configuration in a new Configuration struct with predefined default paths.

  • Replaces hardcoded filepath.Join() calls with configurable path references
  • Adds a new Paths struct and Configuration type in support/variable.go
  • Updates all console make commands to use the centralized path configuration

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
support/variable.go Adds new Paths struct and Configuration with default path mappings
validation/console/rule_make_command.go Replaces hardcoded rule path with support.Config.Paths.Rule
validation/console/filter_make_command.go Replaces hardcoded filter path with support.Config.Paths.Filter
queue/console/job_make_command.go Replaces hardcoded job path with support.Config.Paths.Job
mail/console/mail_make_command.go Replaces hardcoded mail path with support.Config.Paths.Mail
http/console/request_make_command.go Replaces hardcoded request path with support.Config.Paths.Request
http/console/middleware_make_command.go Replaces hardcoded middleware path with support.Config.Paths.Middleware
http/console/controller_make_command.go Replaces hardcoded controller path with support.Config.Paths.Controller
foundation/console/test_make_command.go Replaces hardcoded test path with support.Config.Paths.Test
foundation/console/provider_make_command.go Replaces hardcoded provider path with support.Config.Paths.Provider
foundation/console/package_make_command.go Replaces hardcoded package default with support.Config.Paths.Package
event/console/listener_make_command.go Replaces hardcoded listener path with support.Config.Paths.Listener
event/console/event_make_command.go Replaces hardcoded event path with support.Config.Paths.Event
database/migration/creator.go Replaces hardcoded migration path with support.Config.Paths.Migration
database/console/seeder_make_command.go Replaces hardcoded seeder path with support.Config.Paths.Seeder
database/console/observer_make_command.go Replaces hardcoded observer path with support.Config.Paths.Observer
database/console/model_make_command.go Replaces hardcoded model path with support.Config.Paths.Model
database/console/factory_make_command.go Replaces hardcoded factory path with support.Config.Paths.Factory
console/console/make_command.go Replaces hardcoded command path with support.Config.Paths.Command
auth/console/policy_make_command.go Replaces hardcoded policy path with support.Config.Paths.Policy

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov
Copy link

codecov bot commented Oct 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.66%. Comparing base (e78715c) to head (d0203c9).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1222   +/-   ##
=======================================
  Coverage   66.66%   66.66%           
=======================================
  Files         237      237           
  Lines       15879    15879           
=======================================
  Hits        10585    10585           
  Misses       4928     4928           
  Partials      366      366           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hwbrzzl
Copy link
Contributor Author

hwbrzzl commented Oct 12, 2025

@goravel/core-developers Please help confirm if support.Config.Paths.Model is acceptable.

@krishankumar01
Copy link
Member

krishankumar01 commented Oct 12, 2025

@goravel/core-developers Please help confirm if support.Config.Paths.Model is acceptable.

@bowen I believe it would be better if we expose a method instead of directly accessing the internal representation. That way, we can always change the internal logic later without breaking anything.

For example:

path := support.ConfigPath("filter")
// or
path := support.ConfigPath(support.FilterKey)

This is similar to how you previously moved from direct access to using functions in the facades.

@hwbrzzl
Copy link
Contributor Author

hwbrzzl commented Oct 12, 2025

Or we can add a new WithStructure function, it can be called in the bootstrap/app.go file.

@krishankumar01
Copy link
Member

Or we can add a new WithStructure function, it can be called in the bootstrap/app.go file.

Yes, we could add a new WithStructure (or WithPaths) function, which can be called in bootstrap/app.go. The configured values can still be accessed using support.ConfigPath.

Instead of passing a large Config object, we can use a functional approach like this:

WithPaths(
    WithModelPath(""),
    WithFilterPath(""),
    ...
)

@hwbrzzl
Copy link
Contributor Author

hwbrzzl commented Oct 12, 2025

Good point, the sub paths can be below. And this PR can be merged first if there is no problem. We can optimize it when implementing WithPaths if needed.

WithPaths(
    ModelPath(""),
    FilterPath(""),
    ...
)

@hwbrzzl hwbrzzl merged commit f0abbce into master Oct 13, 2025
15 checks passed
@hwbrzzl hwbrzzl deleted the bowen/#423 branch October 13, 2025 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants