]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
common/hugo: Deprecate extended and extended_withdeploy editions
authorJoe Mooring <joe.mooring@veriphor.com>
Mon, 6 Apr 2026 20:07:32 +0000 (13:07 -0700)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 13 Apr 2026 21:18:23 +0000 (23:18 +0200)
Closes #14696

commands/commandeer.go
common/hugo/hugo.go
common/hugo/hugo_test.go
testscripts/commands/hugo__minify_issue13988.txt

index 21a8f24fc1cbb182ce6baa5d3b17db79bc010f01..44ecda9fcb1477ff9452e576987b4993b2009c9e 100644 (file)
@@ -39,6 +39,7 @@ import (
 
        "github.com/gohugoio/hugo/common/hstrings"
        "github.com/gohugoio/hugo/common/htime"
+       "github.com/gohugoio/hugo/common/hugo"
        "github.com/gohugoio/hugo/common/loggers"
        "github.com/gohugoio/hugo/common/paths"
        "github.com/gohugoio/hugo/common/types"
@@ -454,6 +455,7 @@ func (r *rootCommand) PreRun(cd, runner *simplecobra.Commandeer) error {
        }
        // Set up the global logger early to allow info deprecations during config load.
        loggers.SetGlobalLogger(r.logger)
+       hugo.WarnDeprecatedEdition()
 
        r.changesFromBuild = make(chan []identity.Identity, 10)
 
index fbb1e53a44751c5f63e0369145053d21ab42745f..2c42b2b3f92c2a504e04b6537c03f47e79f8ae77 100644 (file)
@@ -304,6 +304,18 @@ func IsDartSassGeV2() bool {
        return !strings.Contains(DartSassBinaryName, "embedded")
 }
 
+// WarnDeprecatedEdition emits a deprecation warning if the running binary is
+// the extended or extended_withdeploy edition.
+func WarnDeprecatedEdition() {
+       if IsExtended {
+               if IsWithdeploy {
+                       Deprecate("the extended_withdeploy edition of the Hugo executable", "Use the withdeploy edition instead.", "v0.161.0")
+               } else {
+                       Deprecate("the extended edition of the Hugo executable", "Use the standard edition instead.", "v0.161.0")
+               }
+       }
+}
+
 // Deprecate informs about a deprecation starting at the given version.
 //
 // A deprecation typically needs a simple change in the template, but doing so will make the template incompatible with older versions.
index a572f74d4583252e1803593438d5d7fe3f026875..934a846dd4d13c20771f2a611c6357bcc3b1c260 100644 (file)
 package hugo
 
 import (
+       "bytes"
        "context"
        "testing"
 
        "github.com/bep/logg"
        qt "github.com/frankban/quicktest"
+       "github.com/gohugoio/hugo/common/loggers"
 )
 
 func TestDeprecationLogLevelFromVersion(t *testing.T) {
@@ -59,3 +61,38 @@ func TestGetBuildInfo(t *testing.T) {
                c.Assert(bi.GoVersion, qt.Not(qt.Equals), "")
        }
 }
+
+func TestWarnDeprecatedEdition(t *testing.T) {
+       c := qt.New(t)
+
+       origExtended, origWithdeploy := IsExtended, IsWithdeploy
+       t.Cleanup(func() {
+               IsExtended = origExtended
+               IsWithdeploy = origWithdeploy
+               loggers.SetGlobalLogger(nil)
+       })
+
+       var buf bytes.Buffer
+       loggers.SetGlobalLogger(loggers.New(loggers.Options{Level: logg.LevelInfo, StdErr: &buf}))
+
+       IsExtended = true
+       IsWithdeploy = false
+       WarnDeprecatedEdition()
+       c.Assert(buf.String(), qt.Contains, "the extended edition of the Hugo executable")
+       c.Assert(buf.String(), qt.Contains, "Use the standard edition instead")
+
+       buf.Reset()
+
+       IsExtended = true
+       IsWithdeploy = true
+       WarnDeprecatedEdition()
+       c.Assert(buf.String(), qt.Contains, "the extended_withdeploy edition of the Hugo executable")
+       c.Assert(buf.String(), qt.Contains, "Use the withdeploy edition instead")
+
+       buf.Reset()
+
+       IsExtended = false
+       IsWithdeploy = false
+       WarnDeprecatedEdition()
+       c.Assert(buf.String(), qt.Equals, "")
+}
index 122494ce3c6e2ffb61c1a53755316562e3043dad..d20e746af93f500a01b77dc6c538d6464fa5c5b0 100644 (file)
@@ -1,6 +1,6 @@
 hugo --minify --logLevel=info
 
-! stderr 'deprecated'
+! stderr 'deprecated.*minifyOutput'
 grep '<p>one</p><p>two</p>'  public/index.html
 
 -- hugo.toml --