on 6a96e21 help sign in
elk/builder/src/Stuff/Paths.hs
99 lines 1.6 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 , moduleDocs
11 , temp
12 )
13 where
16import Control.Monad.Trans (liftIO)
17import qualified System.Directory as Dir
18import System.FilePath ((</>), (<.>))
20import qualified Elm.Compiler as Compiler
21import qualified Elm.Compiler.Module as Module
22import qualified Elm.Package as Pkg
23import qualified Reporting.Task as Task
27-- PATHS
30stuff :: FilePath
31stuff =
32 "elm-stuff" </> Pkg.versionToString Compiler.version
35docs :: FilePath
36docs =
37 stuff </> "docs.json"
40solution :: FilePath
41solution =
42 stuff </> "solution.dat"
45summary :: FilePath
46summary =
47 stuff </> "summary.dat"
50prepublishDir :: FilePath
51prepublishDir =
52 stuff </> "prepublish"
56-- REMOVE STUFF
59removeStuff :: FilePath -> Task.Task_ e ()
60removeStuff root =
61 liftIO $
62 do let dir = root </> "elm-stuff"
63 exists <- Dir.doesDirectoryExist dir
64 if exists
65 then Dir.removeDirectoryRecursive dir
66 else return ()
70-- ELMI and ELMO
73elmi :: FilePath -> Module.Raw -> FilePath
74elmi root name =
75 toArtifactPath root name "elmi"
78elmo :: FilePath -> Module.Raw -> FilePath
79elmo root name =
80 toArtifactPath root name "elmo"
83moduleDocs :: FilePath -> Module.Raw -> FilePath
84moduleDocs root name =
85 toArtifactPath root name "json"
88toArtifactPath :: FilePath -> Module.Raw -> String -> FilePath
89toArtifactPath root name ext =
90 root </> stuff </> Module.nameToHyphenPath name <.> ext
94-- TEMP
97temp :: FilePath
98temp =
99 stuff </> "temp.js"