doc: Adopters list in README (#252)
Adds a list of most popular projects using avo, based on Github Stars. Auto-generated from the third-party packages list using docgen. Updates #101
This commit is contained in:
committed by
GitHub
parent
956d98e549
commit
57ea8119b7
25
tests/thirdparty/config.go
vendored
25
tests/thirdparty/config.go
vendored
@@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -22,6 +23,11 @@ func (r GithubRepository) String() string {
|
||||
return path.Join(r.Owner, r.Name)
|
||||
}
|
||||
|
||||
// URL returns the Github repository URL.
|
||||
func (r GithubRepository) URL() string {
|
||||
return fmt.Sprintf("https://github.com/%s", r)
|
||||
}
|
||||
|
||||
// CloneURL returns the git clone URL.
|
||||
func (r GithubRepository) CloneURL() string {
|
||||
return fmt.Sprintf("https://github.com/%s.git", r)
|
||||
@@ -256,6 +262,25 @@ func (p Packages) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Ranked returns a copy of the packages list ranked in desending order of
|
||||
// popularity.
|
||||
func (p Packages) Ranked() Packages {
|
||||
ranked := append(Packages(nil), p...)
|
||||
sort.SliceStable(ranked, func(i, j int) bool {
|
||||
return ranked[i].Metadata.Stars > ranked[j].Metadata.Stars
|
||||
})
|
||||
return ranked
|
||||
}
|
||||
|
||||
// Top returns the top n most popular packages.
|
||||
func (p Packages) Top(n int) Packages {
|
||||
top := p.Ranked()
|
||||
if len(top) > n {
|
||||
top = top[:n]
|
||||
}
|
||||
return top
|
||||
}
|
||||
|
||||
// LoadPackages loads a list of package configurations from JSON format.
|
||||
func LoadPackages(r io.Reader) (Packages, error) {
|
||||
var pkgs Packages
|
||||
|
||||
Reference in New Issue
Block a user