import Distribution.Simple
import System.Process

main = do
  hooks <- buildJS simpleUserHooks
  defaultMainWithHooks hooks

buildJS hooks = do
  let originalpreBuild = preBuild hooks  
  return $ hooks {
    preBuild = \args flags -> do
      let npmbuild = proc "sh" ["./scripts/buildjs.sh"]
      (_, _, _, buildHandle) <- createProcess npmbuild
      waitForProcess buildHandle
      originalpreBuild args flags
  }

import Distribution.Simple
import System.Process

main = do
  hooks <- buildJS simpleUserHooks
  defaultMainWithHooks hooks

buildJS hooks = do
  let originalPostBuild = postBuild hooks
  return $ hooks {
    postBuild = \args flags pkgDesc localBuildInfo  -> do
      let npmbuild = proc "sh" ["./scripts/buildjs.sh"]
      (_, _, _, buildHandle) <- createProcess npmbuild
      waitForProcess buildHandle
      originalPostBuild args flags pkgDesc localBuildInfo
  }

Switch to post build for JS build (speeds up build cycle)
Switch to post build for JS build (speeds up build cycle)
