hakyll-typescript 0.0.1.0 → 0.0.2.0
raw patch · 4 files changed
+23/−26 lines, 4 filesdep +hakyll-processdep −typed-processdep ~hakyllPVP ok
version bump matches the API change (PVP)
Dependencies added: hakyll-process
Dependencies removed: typed-process
Dependency ranges changed: hakyll
API changes (from Hackage documentation)
Files
- CHANGELOG.md +9/−0
- README.md +3/−1
- hakyll-typescript.cabal +6/−6
- src/Hakyll/Typescript/TS.hs +5/−19
CHANGELOG.md view
@@ -5,6 +5,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Haskell Package Versioning Policy](https://pvp.haskell.org/). +## [0.2.0] - 2020-11-02+### Added++- Using [hakyll-process](https://hackage.haskell.org/package/hakyll-process) to call the ts compiler.++### Changed++- Widened `hakyll` version bounds.+ ## [0.1.0] - 2019-09-29 ### Added
README.md view
@@ -1,5 +1,7 @@ # hakyll-typescript +[](http://hackage.haskell.org/package/hakyll-typescript)+ A simple [`hakyll`](http://hackage.haskell.org/package/hakyll) typescript compiler for typescript and javascript resources. Uses [`hjsmin`](http://hackage.haskell.org/package/hjsmin) for compression.@@ -16,7 +18,7 @@ import Hakyll.Typescript.TS main = hakyll $ do- -- Matches any file inside a the directory ./scripts+ -- Matches any file inside the directory ./scripts match "scripts/**" $ do route $ setExtension "js" -- compiles all typescript and javascript to the js target
hakyll-typescript.cabal view
@@ -1,5 +1,5 @@ name: hakyll-typescript-version: 0.0.1.0+version: 0.0.2.0 synopsis: Typescript and javascript hakyll compilers. description: Provides typescript to javascript hakyll compilers and a js minifying hakyll compiler. This is a simple wrapper@@ -23,11 +23,11 @@ exposed-modules: Hakyll.Typescript.JS , Hakyll.Typescript.TS other-modules: Hakyll.Typescript.Internal- build-depends: base >= 4.7 && < 5- , bytestring >= 0.10.8.2 && < 0.11- , hakyll >= 4.12.4.0 && < 4.13- , hjsmin >= 0.2.0.2 && < 0.3 - , typed-process >= 0.2.3.0 && < 0.3+ build-depends: base >= 4.7 && < 5+ , bytestring >= 0.10.8.2 && < 0.11+ , hakyll >= 4.12.0.0 && < 4.14+ , hakyll-process >= 0.0.2.0 && < 0.0.3+ , hjsmin >= 0.2.0.2 && < 0.3 default-language: Haskell2010 test-suite test-hakyll-typescript
src/Hakyll/Typescript/TS.hs view
@@ -30,10 +30,9 @@ where import Data.ByteString.Lazy.Char8 (ByteString)-import GHC.Conc (atomically) import Hakyll.Core.Item import Hakyll.Core.Compiler-import System.Process.Typed+import Hakyll.Process (execName, execCompilerWith, ExecutableArg(..), CompilerOut(CStdOut)) import Hakyll.Typescript.Internal @@ -76,21 +75,8 @@ -- |Compiles the typescript 'Hakyll.Core.Item.Item' to javascript. -- Passes the provided 'TSArgs' to the typescript compiler. tsCompilerWith :: TSArgs -> Compiler (Item ByteString)-tsCompilerWith args = do+tsCompilerWith args = execCompilerWith (execName "tsc") allArgs CStdOut+ where -- this won't work on Windows, but that's probably fine- let defaultArgs = ["--outFile", "/dev/stdout"]- tsPath <- getResourceFilePath- let fullArgs = defaultArgs <> args <> [tsPath]- jsBody <- unsafeCompiler $ tsc fullArgs- -- just using this to get at the item- oldTsBody <- getResourceString- pure $ itemSetBody jsBody oldTsBody--tsc :: TSArgs -> IO ByteString-tsc args = withProcess procConf waitJsOutput where- procConf = setStdout byteStringOutput . proc "tsc" $ args- waitJsOutput process = do- let stmJs = getStdout process- js <- atomically stmJs- checkExitCode process- pure js+ defaultArgs = [ProcArg "--outFile", ProcArg "/dev/stdout"]+ allArgs = defaultArgs <> fmap ProcArg args <> [HakFilePath]