fix: some stubs of make commands are incorrect#1369
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v1.17.x #1369 +/- ##
===========================================
- Coverage 68.66% 68.53% -0.14%
===========================================
Files 281 281
Lines 17698 17738 +40
===========================================
+ Hits 12153 12156 +3
- Misses 5043 5079 +36
- Partials 502 503 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Greptile Overview
Greptile Summary
Fixed stub generation for
make:packageand migration commands to support both new bootstrap structure and legacy config structure. The PR adds conditional logic usingenv.IsBootstrapSetup()to detect the project structure and generate appropriate stubs.Key Changes:
env.IsBootstrapSetup()checks to detect whether project uses newfoundation.Setup()patternOldConfig()andOldSetup()stub templates for backwards compatibilityProvidersInConfigdocumentation to clarify its usageIssue Found:
package_make_command.go,setup/setup.gois assigned twice - once unconditionally (line 82) and once in the else block (line 88), causing the first assignment to be overwrittenConfidence Score: 3/5
setup/setup.gogets assigned twice in the map (line 82 and 88), causing the first value to be overwritten. This will break the new bootstrap structure path.foundation/console/package_make_command.go- the duplicate map assignment must be fixedImportant Files Changed
Sequence Diagram
sequenceDiagram participant User participant MakeCommand as make:package/migrate:make participant EnvCheck as env.IsBootstrapSetup() participant Stubs as Stub Generator participant FileSystem as File System User->>MakeCommand: Execute make command MakeCommand->>EnvCheck: Check project structure EnvCheck->>EnvCheck: Read bootstrap/app.go EnvCheck->>EnvCheck: Check for "foundation.Setup()." alt New Bootstrap Structure EnvCheck-->>MakeCommand: true (new structure) MakeCommand->>Stubs: Generate new structure stubs Stubs->>Stubs: Use packages.Paths().Facades().Import() Stubs->>Stubs: Generate setup/stubs.go with config() Stubs->>Stubs: Generate setup/setup.go with modify.RegisterProvider() else Old Config Structure EnvCheck-->>MakeCommand: false (old structure) MakeCommand->>Stubs: Generate old structure stubs Stubs->>Stubs: Use "github.com/goravel/framework/facades" Stubs->>Stubs: Generate setup/config/{name}.go with facades.Config() Stubs->>Stubs: Generate setup/setup.go with ProvidersInConfig() end Stubs->>FileSystem: Write generated files FileSystem-->>User: Files created successfully