Skip to content

feat: [#423] Optimize path#1297

Merged
hwbrzzl merged 5 commits intomasterfrom
bowen/#423-4
Dec 15, 2025
Merged

feat: [#423] Optimize path#1297
hwbrzzl merged 5 commits intomasterfrom
bowen/#423-4

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Dec 14, 2025

📑 Description

Closes goravel/goravel#423

This pull request refactors how configuration files and migration stubs reference and import the facades package across multiple modules. Instead of hardcoding the facades import path and package name, these values are now dynamically injected, making the codebase more modular and adaptable to different project structures. Additionally, there are new methods and interface changes to support more flexible path management for various components.

The most important changes are:

Dynamic Facades Import and Package Injection:

  • Updated the Config stub generators in auth, cache, and filesystem setup modules to accept facadesImport and facadesPackage as arguments, replacing hardcoded references with dynamic values. This change also updates the corresponding calls in their respective setup.go files. [1] [2] [3] [4] [5] [6] [7] [8] [9]
  • Migration stub generation in database/migration/stubs.go and related logic now use injected facadesImport and facadesPackage variables, removing direct references to the global facades package and supporting more flexible project layouts. [1] [2] [3] [4] [5] [6] [7] [8]

Path and Interface Enhancements:

  • Added Routes and Views methods to the Paths interface and their implementations, allowing for more granular and explicit path management in the framework. [1] [2] [3] [4]

Package Generator Improvements:

  • Refactored the package generator stubs in foundation/console/package_make_command_stubs.go to use the new dynamic config stub and updated the generated setup.go to use the new config and provider registration pattern. [1] [2] [3]

Minor Cleanups:

  • Removed unused appServiceProvider test stub from console/console/make_command_test.go.
  • Updated test stub generation to use dynamic imports for test cases.

✅ Checks

  • Added test cases for my code

@hwbrzzl hwbrzzl marked this pull request as ready for review December 14, 2025 08:06
@hwbrzzl hwbrzzl requested a review from a team as a code owner December 14, 2025 08:06
Copilot AI review requested due to automatic review settings December 14, 2025 08:06
@hwbrzzl hwbrzzl closed this Dec 14, 2025
@hwbrzzl hwbrzzl reopened this Dec 14, 2025
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 optimizes path handling across the framework by centralizing path configuration, extracting the Paths implementation into a dedicated subpackage, and standardizing stub generation patterns across all setup files.

  • Centralized path configuration with new Views, Routes, and Migrations path helpers
  • Refactored packages.Paths implementation into packages/paths subpackage for better organization
  • Standardized stub generation to use facadesImport and facadesPackage parameters consistently across all modules

Reviewed changes

Copilot reviewed 52 out of 52 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
view/console/view_make_command.go Simplified view creation by removing custom path flag and using centralized config
view/console/view_make_command_test.go Updated tests to match new populateStub signature (issues found)
view/console/stubs.go Simplified stub template to use single DummyDefinition placeholder
support/variable.go Added Views field to Paths struct for centralized view path configuration
support/path/path.go Added Migration(), Route(), and View() path helper functions
support/console/console.go Refactored GetFilePath() to use path/internals utilities
support/stubs/stub.go Standardized DatabaseConfig parameters to use facades import/package pattern
packages/paths/paths.go New file extracting Paths implementation from packages package
packages/paths.go Emptied - content moved to packages/paths subpackage
packages/setup.go Added public Paths() helper function and env.PackageName() usage
packages/modify/stubs.go Updated bootstrap stub generation to use dynamic package resolution
foundation/console/test_make_command.go Enhanced test generation with conditional imports based on subdirectory structure
foundation/console/stubs.go Updated test stub template to use DummyTestImport and DummyTestCase
foundation/console/package_make_command.go Changed config file location from setup/config/ to setup/stubs.go
foundation/console/package_make_command_stubs.go Refactored to generate setup stubs with proper config function
foundation/configuration/paths.go Added Routes() and Views() methods to Paths interface implementation
contracts/foundation/configuration/paths.go Added Routes() and Views() to Paths interface
contracts/packages/setup.go Added Migrations() method to Paths interface
database/migration/stubs.go Updated migration stubs to use facades import/package placeholders
database/migration/migrator.go Enhanced StubData to include FacadesPackage and FacadesImport
database/migration/creator.go Restructured StubData fields for better organization
database/setup/setup.go Updated to use facades import instead of main package
testing/setup/stubs.go Standardized parameter names to use Import/Package suffix pattern
testing/setup/setup.go Added bootstrapPackage parameter to stubs
telemetry/setup/stubs.go Removed unused time import and standardized parameters
telemetry/setup/setup.go Added facadesPackage variable for cleaner code
session/setup/stubs.go Standardized stub parameters to use facades import/package
session/setup/setup.go Refactored to use facades package instead of main package
route/setup/stubs.go Updated routes stub to use standardized facade parameters
route/setup/setup.go Simplified by using path helpers and removing hardcoded paths
queue/setup/stubs.go Standardized stub parameters across Config and JobMigration
queue/setup/setup.go Refactored to use path.Migration() helper
mail/setup/stubs.go Standardized stub parameters to use facades import/package
mail/setup/setup.go Updated to use facades package pattern
log/setup/stubs.go Standardized stub parameters to use facades import/package
log/setup/setup.go Updated to use facades package pattern
http/setup/stubs.go Standardized all config stub parameters
http/setup/setup.go Updated to use facades import in addition to package
hash/setup/stubs.go Standardized stub parameters to use facades import/package
hash/setup/setup.go Added facadesPackage variable
grpc/setup/stubs.go Standardized stub parameters to use facades import/package
grpc/setup/setup.go Simplified by using path.Route() helper
filesystem/setup/stubs.go Standardized stub parameters and reordered imports
filesystem/setup/setup.go Added facadesPackage variable
cache/setup/stubs.go Standardized stub parameters to use facades import/package
cache/setup/setup.go Added facadesPackage variable
auth/setup/stubs.go Standardized stub parameters to use facades import/package
auth/setup/setup.go Updated to use facades import/package pattern
mocks/packages/Paths.go Added mock implementation for Migrations() method
mocks/foundation/configuration/Paths.go Added mock implementations for Routes() and Views() methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Dec 14, 2025

Codecov Report

❌ Patch coverage is 52.66272% with 160 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.01%. Comparing base (35eaec3) to head (dc6ed6c).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
http/setup/stubs.go 0.00% 15 Missing ⚠️
queue/setup/stubs.go 0.00% 15 Missing ⚠️
grpc/setup/setup.go 0.00% 9 Missing ⚠️
route/setup/setup.go 0.00% 9 Missing ⚠️
support/path/path.go 0.00% 9 Missing ⚠️
queue/setup/setup.go 0.00% 8 Missing ⚠️
testing/setup/stubs.go 0.00% 8 Missing ⚠️
support/stubs/stub.go 0.00% 7 Missing ⚠️
route/setup/stubs.go 0.00% 6 Missing ⚠️
session/setup/stubs.go 0.00% 6 Missing ⚠️
... and 20 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1297      +/-   ##
==========================================
+ Coverage   68.82%   69.01%   +0.18%     
==========================================
  Files         278      277       -1     
  Lines       16114    16164      +50     
==========================================
+ Hits        11091    11156      +65     
+ Misses       4549     4534      -15     
  Partials      474      474              

☔ 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 hwbrzzl merged commit e260d8e into master Dec 15, 2025
14 of 15 checks passed
@hwbrzzl hwbrzzl deleted the bowen/#423-4 branch December 15, 2025 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ [Feature] goravel/framework could run independently of goravel/goravel

2 participants