diff options
author | Bjørn Erik Pedersen <[email protected]> | 2023-07-08 12:25:53 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-07-08 16:08:46 +0200 |
commit | 0f921ace6f897ba63cdcce7a0ef59c9c615920bd (patch) | |
tree | 11c7d1138540e75d8a235539fe62bd568448f010 | |
parent | 6019953769741d3ec0b48aa16b2a6cc06a93f5ba (diff) | |
download | hugo-0f921ace6f897ba63cdcce7a0ef59c9c615920bd.tar.gz hugo-0f921ace6f897ba63cdcce7a0ef59c9c615920bd.zip |
Fix hugo mod vendor for modules with hugo.toml
Fixes #11221
-rw-r--r-- | main_test.go | 1 | ||||
-rw-r--r-- | modules/client.go | 4 | ||||
-rw-r--r-- | testscripts/commands/mod_vendor.txt | 24 |
3 files changed, 28 insertions, 1 deletions
diff --git a/main_test.go b/main_test.go index aae8a0a9e..6274cd9bb 100644 --- a/main_test.go +++ b/main_test.go @@ -50,6 +50,7 @@ func TestUnfinished(t *testing.T) { p := commonTestScriptsParam p.Dir = "testscripts/unfinished" + //p.UpdateScripts = true testscript.Run(t, p) } diff --git a/modules/client.go b/modules/client.go index 5d8daf926..53ce67cb3 100644 --- a/modules/client.go +++ b/modules/client.go @@ -292,8 +292,10 @@ func (c *Client) Vendor() error { } } - // Also include any theme.toml or config.* files in the root. + // Also include any theme.toml or config.* or hugo.* files in the root. configFiles, _ := afero.Glob(c.fs, filepath.Join(dir, "config.*")) + configFiles2, _ := afero.Glob(c.fs, filepath.Join(dir, "hugo.*")) + configFiles = append(configFiles, configFiles2...) configFiles = append(configFiles, filepath.Join(dir, "theme.toml")) for _, configFile := range configFiles { if err := hugio.CopyFile(c.fs, configFile, filepath.Join(vendorDir, t.Path(), filepath.Base(configFile))); err != nil { diff --git a/testscripts/commands/mod_vendor.txt b/testscripts/commands/mod_vendor.txt new file mode 100644 index 000000000..8a77776b3 --- /dev/null +++ b/testscripts/commands/mod_vendor.txt @@ -0,0 +1,24 @@ +dostounix golden/vendor.txt + +hugo mod vendor +cmp _vendor/modules.txt golden/vendor.txt +ls _vendor/github.com/gohugoio/hugo-mod-integrationtests/withconfigtoml +stdout 'config.toml' +ls _vendor/github.com/gohugoio/hugo-mod-integrationtests/withhugotoml +stdout 'hugo.toml' + + +-- hugo.toml -- +title = "Hugo Modules Test" +[module] +[[module.imports]] +path="github.com/gohugoio/hugo-mod-integrationtests/withconfigtoml" +[[module.imports]] +path="github.com/gohugoio/hugo-mod-integrationtests/withhugotoml" +-- go.mod -- +go 1.19 + +module github.com/gohugoio/testmod +-- golden/vendor.txt -- +# github.com/gohugoio/hugo-mod-integrationtests/withconfigtoml v1.0.0 +# github.com/gohugoio/hugo-mod-integrationtests/withhugotoml v1.0.0 |