mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
@@ -26,9 +26,10 @@ import (
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
||||
"github.com/gobwas/glob"
|
||||
hglob "github.com/gohugoio/hugo/hugofs/glob"
|
||||
|
||||
"github.com/gobwas/glob"
|
||||
|
||||
"github.com/gohugoio/hugo/hugofs"
|
||||
|
||||
"github.com/gohugoio/hugo/hugofs/files"
|
||||
@@ -100,10 +101,16 @@ func NewClient(cfg ClientConfig) *Client {
|
||||
logger = loggers.NewWarningLogger()
|
||||
}
|
||||
|
||||
var noVendor glob.Glob
|
||||
if cfg.ModuleConfig.NoVendor != "" {
|
||||
noVendor, _ = hglob.GetGlob(hglob.NormalizePath(cfg.ModuleConfig.NoVendor))
|
||||
}
|
||||
|
||||
return &Client{
|
||||
fs: fs,
|
||||
ccfg: cfg,
|
||||
logger: logger,
|
||||
noVendor: noVendor,
|
||||
moduleConfig: mcfg,
|
||||
environ: env,
|
||||
GoModulesFilename: goModFilename}
|
||||
@@ -114,6 +121,8 @@ type Client struct {
|
||||
fs afero.Fs
|
||||
logger *loggers.Logger
|
||||
|
||||
noVendor glob.Glob
|
||||
|
||||
ccfg ClientConfig
|
||||
|
||||
// The top level module config
|
||||
@@ -220,6 +229,10 @@ func (c *Client) Vendor() error {
|
||||
continue
|
||||
}
|
||||
|
||||
if !c.shouldVendor(t.Path()) {
|
||||
continue
|
||||
}
|
||||
|
||||
if !t.IsGoMod() && !t.Vendor() {
|
||||
// We currently do not vendor components living in the
|
||||
// theme directory, see https://github.com/gohugoio/hugo/issues/5993
|
||||
@@ -596,6 +609,10 @@ func (c *Client) tidy(mods Modules, goModOnly bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) shouldVendor(path string) bool {
|
||||
return c.noVendor == nil || !c.noVendor.Match(path)
|
||||
}
|
||||
|
||||
// ClientConfig configures the module Client.
|
||||
type ClientConfig struct {
|
||||
Fs afero.Fs
|
||||
|
Reference in New Issue
Block a user