diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-12-06 12:09:41 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-12-06 13:37:08 +0100 |
commit | d8efe085ca8a8bd342bd45cda1d7c8a5f51cc791 (patch) | |
tree | 4949f56f0eb4d7dc5e18d9d8aed9291de739579c /common | |
parent | f5b5b71c60ed5a2b429095a4ea6c1f2eb3f2044a (diff) |
Add dart-sass-embedded version info to hugo env -v
```
~ ❯❯❯ hugo env -v | grep dart
github.com/bep/godartsass="v0.16.0"
github.com/sass/dart-sass-embedded/compiler="1.56.1"
github.com/sass/dart-sass-embedded/implementation="1.56.1"
github.com/sass/dart-sass-embedded/protocol="1.1.0"
```
Diffstat (limited to 'common')
-rw-r--r-- | common/hugo/hugo.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go index 0a79576f3..f463e261d 100644 --- a/common/hugo/hugo.go +++ b/common/hugo/hugo.go @@ -24,6 +24,8 @@ import ( "sync" "time" + "github.com/bep/godartsass" + "github.com/gohugoio/hugo/common/hexec" "github.com/gohugoio/hugo/hugofs/files" "github.com/spf13/afero" @@ -202,6 +204,16 @@ func GetDependencyList() []string { ) } + if dartSass := dartSassVersion(); dartSass.ProtocolVersion != "" { + const dartSassPath = "github.com/sass/dart-sass-embedded" + deps = append(deps, + formatDep(dartSassPath+"/protocol", dartSass.ProtocolVersion), + formatDep(dartSassPath+"/compiler", dartSass.CompilerVersion), + formatDep(dartSassPath+"/implementation", dartSass.ImplementationVersion), + ) + + } + bi := getBuildInfo() if bi == nil { return deps @@ -249,3 +261,13 @@ type Dependency struct { // Replaced by this dependency. Replace *Dependency } + +func dartSassVersion() godartsass.DartSassVersion { + // This is also duplicated in the dartsass package. + const dartSassEmbeddedBinaryName = "dart-sass-embedded" + if !hexec.InPath(dartSassEmbeddedBinaryName) { + return godartsass.DartSassVersion{} + } + v, _ := godartsass.Version(dartSassEmbeddedBinaryName) + return v +} |