on 63fa090 help sign in
elk/builder/src/Stuff/Paths.hs
93 lines 1.5 kB history raw
1{-# OPTIONS_GHC -Wall #-}
2module Stuff.Paths
3 ( docs
4 , solution
5 , summary
6 , prepublishDir
7 , removeStuff
8 , elmi
9 , elmo
10 , temp
11 )
12 where
15import Control.Monad.Trans (liftIO)
16import qualified System.Directory as Dir
17import System.FilePath ((</>), (<.>))
19import qualified Elm.Compiler as Compiler
20import qualified Elm.Compiler.Module as Module
21import qualified Elm.Package as Pkg
22import qualified Reporting.Task as Task
26-- PATHS
29stuff :: FilePath
30stuff =
31 "elm-stuff" </> Pkg.versionToString Compiler.version
34docs :: FilePath
35docs =
36 stuff </> "docs.json"
39solution :: FilePath
40solution =
41 stuff </> "solution.dat"
44summary :: FilePath
45summary =
46 stuff </> "summary.dat"
49prepublishDir :: FilePath
50prepublishDir =
51 stuff </> "prepublish"
55-- REMOVE STUFF
58removeStuff :: FilePath -> Task.Task_ e ()
59removeStuff root =
60 liftIO $
61 do let dir = root </> "elm-stuff"
62 exists <- Dir.doesDirectoryExist dir
63 if exists
64 then Dir.removeDirectoryRecursive dir
65 else return ()
69-- ELMI and ELMO
72elmi :: FilePath -> Module.Raw -> FilePath
73elmi root name =
74 toArtifactPath root name "elmi"
77elmo :: FilePath -> Module.Raw -> FilePath
78elmo root name =
79 toArtifactPath root name "elmo"
82toArtifactPath :: FilePath -> Module.Raw -> String -> FilePath
83toArtifactPath root name ext =
84 root </> stuff </> Module.nameToHyphenPath name <.> ext
88-- TEMP
91temp :: FilePath
92temp =
93 stuff </> "temp.js"