Skip to content

feat: [#719] package:install support install goravel/framework facades#1099

Merged
hwbrzzl merged 9 commits intomasterfrom
bowen/#719
Jun 29, 2025
Merged

feat: [#719] package:install support install goravel/framework facades#1099
hwbrzzl merged 9 commits intomasterfrom
bowen/#719

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Jun 28, 2025

📑 Description

Closes goravel/goravel#719

Tested locally, will add more test cases in goravel/goravel, and will optimize all facades in another PR.

image

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 PackageInstallCommand to 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:

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:

✅ Checks

  • Added test cases for my code

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add the new function: overwrite/create a file.

Comment on lines -23 to -46
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)
})
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only fill in some fixed content, it's unnecessary to test them.

@codecov
Copy link

codecov bot commented Jun 28, 2025

Codecov Report

Attention: Patch coverage is 57.14286% with 60 lines in your changes missing coverage. Please review.

Project coverage is 70.89%. Comparing base (b98d29f) to head (a7f71b8).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
auth/config/config.go 0.00% 37 Missing ⚠️
auth/setup/setup.go 0.00% 18 Missing ⚠️
support/file/file.go 70.00% 2 Missing and 1 partial ⚠️
foundation/console/package_install_command.go 92.85% 2 Missing ⚠️
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.
📢 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.

return false
}

func Keys[K comparable, V any](mp map[K]V) []K {
Copy link
Contributor

Choose a reason for hiding this comment

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

Starting from Go 1.21, the maps.Keys and maps.Values functions are built-in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, updated.

@hwbrzzl hwbrzzl marked this pull request as ready for review June 28, 2025 15:02
@hwbrzzl hwbrzzl requested a review from a team as a code owner June 28, 2025 15:02
@hwbrzzl hwbrzzl merged commit 6e7dea0 into master Jun 29, 2025
12 of 14 checks passed
@hwbrzzl hwbrzzl deleted the bowen/#719 branch June 29, 2025 02:13
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.

package:install support install goravel/framework facades

2 participants