feat: [#719] package:install support install goravel/framework facades#1099
feat: [#719] package:install support install goravel/framework facades#1099
Conversation
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: 9d3b428 | Previous: e350df8 | Ratio |
|---|---|---|---|
BenchmarkFile_ReadWrite |
354357 ns/op 6202 B/op 97 allocs/op |
221570 ns/op 6201 B/op 97 allocs/op |
1.60 |
BenchmarkFile_ReadWrite - ns/op |
354357 ns/op |
221570 ns/op |
1.60 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
The goravel/goravel config/auth.go file will be removed, it will be added automatically when running ./artisan package:install auth.
| modify.GoFile(path.Config("app.go")). | ||
| Find(match.Imports()).Modify(modify.AddImport(packages.GetModulePath())). | ||
| Find(match.Providers()).Modify(modify.Register("&auth.ServiceProvider{}")), | ||
| modify.File(path.Config("auth.go")).Overwrite(config), |
There was a problem hiding this comment.
Add the new function: overwrite/create a file.
| func (s *PackageInstallCommandTestSuite) TestSignature() { | ||
| expected := "package:install" | ||
| s.Require().Equal(expected, NewPackageInstallCommand().Signature()) | ||
| } | ||
|
|
||
| func (s *PackageInstallCommandTestSuite) TestDescription() { | ||
| expected := "Install a package" | ||
| s.Require().Equal(expected, NewPackageInstallCommand().Description()) | ||
| } | ||
|
|
||
| func (s *PackageInstallCommandTestSuite) TestExtend() { | ||
| cmd := NewPackageInstallCommand() | ||
| got := cmd.Extend() | ||
|
|
||
| s.Run("should return correct category", func() { | ||
| expected := "package" | ||
| s.Require().Equal(expected, got.Category) | ||
| }) | ||
|
|
||
| s.Run("should return correct args usage", func() { | ||
| expected := " <package@version>" | ||
| s.Require().Equal(expected, got.ArgsUsage) | ||
| }) | ||
| } |
There was a problem hiding this comment.
Only fill in some fixed content, it's unnecessary to test them.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1099 +/- ##
==========================================
- Coverage 71.16% 70.89% -0.27%
==========================================
Files 183 185 +2
Lines 12826 12996 +170
==========================================
+ Hits 9127 9213 +86
- Misses 3330 3413 +83
- Partials 369 370 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| return false | ||
| } | ||
|
|
||
| func Keys[K comparable, V any](mp map[K]V) []K { |
There was a problem hiding this comment.
Starting from Go 1.21, the maps.Keys and maps.Values functions are built-in.
There was a problem hiding this comment.
Good catch, updated.
📑 Description
Closes goravel/goravel#719
Tested locally, will add more test cases in goravel/goravel, and will optimize all facades in another PR.
This pull request introduces enhancements to the authentication setup, refactors package installation logic, and updates error handling and mocking structures. The most important changes include adding a new authentication configuration, extending the
PackageInstallCommandto support facade installation, and modifying interfaces and mocks for consistency.Authentication Setup Enhancements:
auth/config/config.go: Added a new authentication configuration with support for JWT guards and ORM providers.auth/setup/setup.go: Implemented the setup logic for the authentication package, including installation and uninstallation procedures.Package Installation Improvements:
foundation/console/package_install_command.go: Enhanced thePackageInstallCommandto support facade installation, added error handling for missing facades, and introduced a mapping of facade names to their respective paths. [1] [2] [3] [4] [5]Error Handling Updates:
errors/list.go: Added new error messages for package and facade installation failures, and removed module-specific error settings for better generalization. [1] [2]Interface and Mock Refactoring:
contracts/packages/modify/modify.go: Refactored theFileinterface toApplyfor consistency and clarity.contracts/packages/setup.go: Updated theSetupinterface to use the newApplytype instead ofFile.mocks/packages/Setup.go: Adjusted mock methods and structures to align with the updatedApplyinterface. [1] [2] [3] [4] [5]✅ Checks