2016-02-02 12:35:39 +03:00
|
|
|
import Distribution.Simple
|
2017-03-17 23:00:06 +03:00
|
|
|
import System.Process
|
2017-08-19 18:13:24 +03:00
|
|
|
import System.Environment (lookupEnv)
|
2017-03-17 23:00:06 +03:00
|
|
|
|
|
|
|
main = do
|
2017-08-19 18:13:24 +03:00
|
|
|
js <- lookupEnv "NO_JS"
|
|
|
|
case js of
|
|
|
|
Just "true" -> defaultMain
|
|
|
|
_ -> do
|
|
|
|
hooks <- buildJS simpleUserHooks
|
|
|
|
defaultMainWithHooks hooks
|
2017-03-17 23:00:06 +03:00
|
|
|
|
|
|
|
buildJS hooks = do
|
2017-07-03 17:50:54 +03:00
|
|
|
let originalPostBuild = postBuild hooks
|
2017-03-17 23:00:06 +03:00
|
|
|
return $ hooks {
|
2017-07-03 17:50:54 +03:00
|
|
|
postBuild = \args flags pkgDesc localBuildInfo -> do
|
2017-03-17 23:00:06 +03:00
|
|
|
let npmbuild = proc "sh" ["./scripts/buildjs.sh"]
|
|
|
|
(_, _, _, buildHandle) <- createProcess npmbuild
|
|
|
|
waitForProcess buildHandle
|
2017-07-03 17:50:54 +03:00
|
|
|
originalPostBuild args flags pkgDesc localBuildInfo
|
2017-03-17 23:00:06 +03:00
|
|
|
}
|