From 084a3cefb51f16c96a09671e6d3b98cae4e06ca7 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Thu, 2 Jul 2020 19:20:03 +0300 Subject: [PATCH] Sort directory contents #1684 --- yesod-static/ChangeLog.md | 6 ++++++ yesod-static/Yesod/EmbeddedStatic/Generators.hs | 3 ++- yesod-static/yesod-static.cabal | 10 ++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/yesod-static/ChangeLog.md b/yesod-static/ChangeLog.md index f275cb39..c00c008c 100644 --- a/yesod-static/ChangeLog.md +++ b/yesod-static/ChangeLog.md @@ -1,3 +1,9 @@ +# ChangeLog for yesod-static + +## 1.6.1.0 + +* Support reproducible embedded file order [#1684](https://github.com/yesodweb/yesod/issues/1684#issuecomment-652562514) + ## 1.6.0.2 * Remove unnecessary deriving of Typeable diff --git a/yesod-static/Yesod/EmbeddedStatic/Generators.hs b/yesod-static/Yesod/EmbeddedStatic/Generators.hs index b5c760e1..8d7d9ae0 100644 --- a/yesod-static/Yesod/EmbeddedStatic/Generators.hs +++ b/yesod-static/Yesod/EmbeddedStatic/Generators.hs @@ -49,6 +49,7 @@ import qualified System.Process as Proc import System.Exit (ExitCode (ExitSuccess)) import Control.Concurrent.Async (Concurrently (..)) import System.IO (hClose) +import Data.List (sort) import Yesod.EmbeddedStatic.Types @@ -80,7 +81,7 @@ getRecursiveContents :: Location -- ^ The directory to search -> FilePath -- ^ The prefix to add to the filenames -> IO [(Location,FilePath)] getRecursiveContents prefix topdir = do - names <- getDirectoryContents topdir + names <- sort <$> getDirectoryContents topdir let properNames = filter (`notElem` [".", ".."]) names paths <- forM properNames $ \name -> do let path = topdir name diff --git a/yesod-static/yesod-static.cabal b/yesod-static/yesod-static.cabal index 2673ece1..233aae73 100644 --- a/yesod-static/yesod-static.cabal +++ b/yesod-static/yesod-static.cabal @@ -1,5 +1,5 @@ name: yesod-static -version: 1.6.0.2 +version: 1.6.1.0 license: MIT license-file: LICENSE author: Michael Snoyman @@ -7,7 +7,7 @@ maintainer: Michael Snoyman , Greg Weber = 1.8 +cabal-version: >= 1.10 build-type: Simple homepage: http://www.yesodweb.com/ description: API docs and the README are available at @@ -26,6 +26,7 @@ extra-source-files: README.md library + default-language: Haskell2010 build-depends: base >= 4.10 && < 5 , async , attoparsec >= 0.10 @@ -66,9 +67,10 @@ library Yesod.EmbeddedStatic.Css.Util ghc-options: -Wall - extensions: TemplateHaskell + other-extensions: TemplateHaskell test-suite tests + default-language: Haskell2010 hs-source-dirs: ., test main-is: tests.hs type: exitcode-stdio-1.0 @@ -118,7 +120,7 @@ test-suite tests , rio ghc-options: -Wall -threaded - extensions: TemplateHaskell + other-extensions: TemplateHaskell source-repository head type: git