Skip to content

Icikowski/vanitygen

Repository files navigation

vanitygen

Static HTML generator for Go vanity import paths.

Introduction

vanitygen is a tool for generating static HTML files for Go vanity import paths. It is capable of accepting Git repositories hosted on GitHub, GitLab, Gitea and Sourcehut and generating static HTML files with plain (vangen-like) or Bootstrap-based styling.

Both providers and formatters can be easly extended, so don't hesitate to open issues and/or merge requests for new functionalities!

Installation

go install github.com/Icikowski/vanitygen@latest

Usage

Command line arguments

CLI argument Environment variable Description Default value
--out VANITYGEN_OUT Output directory for generated HTML files "out"
--config VANITYGEN_CONFIG Configuration file (in YAML or JSON format) "vanitygen.yaml"
--format VANITYGEN_FORMAT Formatter for generated HTML files (plain or bootstrap) "plain"

Configuration file

Configuration file defines the generated files' content. It contains both global and package-specific fields.

Schema for configuration file is available on https://raw.githubusercontent.com/Icikowski/vanitygen/main/config.schema.json.

Both YAML and JSON formats are supported.

Example configuration in YAML format
# yaml-language-server: $schema=https://raw.githubusercontent.com/Icikowski/vanitygen/main/config.schema.json
domain: "pkg.somesite.com"
siteName: "Go packages"
author: "John Doe"
docs: "https://pkg.go.dev"
pkgs:
  - name: utils
    provider: github
    repoUrl: "https://github.com/someuser/someutils"
    branch: main
    subpackages:
      - v1
      - v2
      - v3
  - name: tools
    provider: gitlab
    repoUrl: "https://gitlab.com/someuser/sometools"
    branch: devel
  - name: awesome
    provider: gitea
    repoUrl: "https://try.gitea.io/someuser/some-awesome-package"
    branch: staging
    website: "https://somesite.com/my-awesome-package"
  - name: others
    provider: sourcehut
    repoUrl: "https://git.sr.ht/~someuser/someotherpackage"
    branch: master
Example configuration in JSON format
{
  "$schema": "https://raw.githubusercontent.com/Icikowski/vanitygen/main/config.schema.json",
  "domain": "pkg.somesite.com",
  "siteName": "Go packages",
  "author": "John Doe",
  "docs": "https://pkg.go.dev",
  "pkgs": [
    {
      "name": "utils",
      "provider": "github",
      "repoUrl": "https://github.com/someuser/someutils",
      "branch": "main",
      "subpackages": [
        "v1",
        "v2",
        "v3"
      ]
    },
    {
      "name": "tools",
      "provider": "gitlab",
      "repoUrl": "https://gitlab.com/someuser/sometools",
      "branch": "devel"
    },
    {
      "name": "awesome",
      "provider": "gitea",
      "repoUrl": "https://try.gitea.io/someuser/some-awesome-package",
      "branch": "staging",
      "website": "https://somesite.com/my-awesome-package"
    },
    {
      "name": "others",
      "provider": "sourcehut",
      "repoUrl": "https://git.sr.ht/~someuser/someotherpackage",
      "branch": "master"
    }
  ]
}

Demo

Plain-themed HTML output

Plain-themed HTML output for home page

Plain-themed HTML output for package page

Bootstrap-themed HTML output

Bootstrap-themed HTML output for home page

Bootstrap-themed HTML output for package page