mods

package module
v0.0.0-...-c9cb115 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// Set when Go modules are initialized in the current repo, that is:
	// a go.mod file exists.
	GoModulesFilename string
	// contains filtered or unexported fields
}

Client contains most of the API provided by this package.

func NewClient

func NewClient(fs afero.Fs, workingDir, themesDir string, imports []string) *Client

func (*Client) Collect

func (h *Client) Collect() (ModulesConfig, error)

func (*Client) Get

func (m *Client) Get(args ...string) error

func (*Client) Graph

func (m *Client) Graph(w io.Writer) error

TODO(bep) mod probably filter this against imports? Also check replace. TODO(bep) merge with _vendor + /theme

func (*Client) Init

func (m *Client) Init(path string) error

func (*Client) IsProbablyModule

func (m *Client) IsProbablyModule(path string) bool

func (*Client) Tidy

func (m *Client) Tidy() error

func (*Client) Vendor

func (c *Client) Vendor() error

Like Go, Hugo supports writing the dependencies to a /vendor folder. Unlike Go, we support it for any level. We, by defaults, use the /vendor folder first, if found. To disable, run with

hugo --no-vendor TODO(bep) also on hugo mod

Given a module tree, Hugo will pick the first module for a given path, meaning that if the top-level module is vendored, that will be the full set of dependencies.

type Config

type Config struct {
	// Decode: support :default =>
	// ^assets$|
	IncludeDirs string
}

type Module

type Module interface {

	// Optional config read from the configFilename above.
	Cfg() config.Provider

	// Optional configuration filename (e.g. "/themes/mytheme/config.json").
	// This will be added to the special configuration watch list when in
	// server mode.
	ConfigFilename() string

	// Directory holding files for this module.
	Dir() string

	// Returns whether this is a Go Module.
	IsGoMod() bool

	// In the dependency tree, this is the first module that defines this module
	// as a dependency.
	Owner() Module

	// Returns the path to this module.
	// This will either be the module path, e.g. "github.com/gohugoio/myshortcodes",
	// or the path below your /theme folder, e.g. "mytheme".
	Path() string

	// Returns whether Dir points below the _vendor dir.
	Vendor() bool

	// The module version, "none" if not applicable.
	Version() string
}

type ModuleError

type ModuleError struct {
	Err string // the error itself
}

type Modules

type Modules []Module

type ModulesConfig

type ModulesConfig struct {
	Modules Modules

	// Set if this is a Go modules enabled project.
	GoModulesFilename string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL