badge-generator icon indicating copy to clipboard operation
badge-generator copied to clipboard

Add Go URL to dependency badge

Open MichaelCurrin opened this issue 4 years ago • 2 comments

e.g.

https://pkg.go.dev/github.com/shurcooL/githubv4 https://pkg.go.dev/google.golang.org/api/transport/http https://pkg.go.dev/net/http/httputil https://pkg.go.dev/golang.org/x/oauth2

MichaelCurrin avatar Feb 15 '21 13:02 MichaelCurrin

New logic is needed to use the last part for the dependency name, or the last two parts, but exclude GitHub, even though it won't always be there

Sample

  it("returns a static badge for a Go package", () => {
    const imageTarget = "https://img.shields.io/badge/dependency-githubv4-blue";
    const linkTarget = "https://pkg.go.dev/github.com/shurcooL/githubv4";

    expect(dependency("githubv4", REGISTRY.Go, {})).toBe(
      `[![dependency - githubv4](${imageTarget})](${linkTarget})`
    );
  });

MichaelCurrin avatar Mar 03 '21 06:03 MichaelCurrin

This will be an extra option on the Packages screen and can use dependency function. Or a new function to keep that one light.

MichaelCurrin avatar Mar 03 '21 06:03 MichaelCurrin