We now run compile and install each time the wasp file changes

This commit is contained in:
Martijn Faassen 2022-02-07 12:54:40 +01:00
parent 988929fbdc
commit 55d9bd1ef1

View File

@ -13,10 +13,11 @@ import StrongPath (Abs, Dir, Path', (</>))
import qualified StrongPath as SP
import qualified System.FSNotify as FSN
import qualified System.FilePath as FP
import Wasp.Cli.Command.Compile (compileIO)
import Wasp.Cli.Common (waspSays, waspScreams)
import Wasp.Cli.Command (runCommand)
import Wasp.Cli.Command.CompileAndSetup (compileAndSetup)
import Wasp.Cli.Common (waspSays)
import qualified Wasp.Cli.Common as Common
import Wasp.Cli.Terminal (asWaspFailureMessage, asWaspStartMessage, asWaspSuccessMessage)
import Wasp.Cli.Terminal (asWaspStartMessage)
import qualified Wasp.Lib
-- TODO: Another possible problem: on re-generation, wasp re-generates a lot of files, even those that should not
@ -80,11 +81,7 @@ watch waspProjectDir outDir = FSN.withManager $ \mgr -> do
recompile :: IO ()
recompile = do
waspSays $ asWaspStartMessage "Recompiling on file change..."
compilationResult <- compileIO waspProjectDir outDir
case compilationResult of
Left err -> waspScreams $ asWaspFailureMessage "Recompilation on file change failed:" ++ err
Right () -> waspSays $ asWaspSuccessMessage "Recompilation on file change succeeded."
return ()
runCommand $ compileAndSetup waspProjectDir outDir
-- TODO: This is a hardcoded approach to ignoring most of the common tmp files that editors
-- create next to the source code. Bad thing here is that users can't modify this,