mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-11-23 01:54:37 +03:00
Fixed migrations not being copied on 'wasp build'.
This commit is contained in:
parent
cd015d59e8
commit
6abcf496c4
@ -1,4 +1,4 @@
|
||||
import React, from 'react'
|
||||
import React from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
import LoginForm from '@wasp/auth/forms/Login'
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, from 'react'
|
||||
import React from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
import SignupForm from '@wasp/auth/forms/Signup'
|
||||
|
@ -4,13 +4,15 @@ module Command.Compile
|
||||
, compileIOWithOptions
|
||||
) where
|
||||
|
||||
import Control.Monad.Except (throwError)
|
||||
import Control.Monad.IO.Class (liftIO)
|
||||
import Control.Monad.Except (throwError)
|
||||
|
||||
import Command (Command, CommandError (..))
|
||||
import Command.Common (findWaspProjectRootDirFromCwd,
|
||||
findWaspFile,
|
||||
waspSaysC)
|
||||
import Command (Command, CommandError (..))
|
||||
import Command.Common (findWaspFile,
|
||||
findWaspProjectRootDirFromCwd,
|
||||
waspSaysC)
|
||||
import Command.Db.Migrate (copyDbMigrationsDir, MigrationDirCopyDirection(..))
|
||||
|
||||
import qualified Common
|
||||
import CompileOptions (CompileOptions (..))
|
||||
import qualified Lib
|
||||
@ -46,7 +48,16 @@ compileIOWithOptions :: CompileOptions
|
||||
-> Path Abs (Dir Lib.ProjectRootDir)
|
||||
-> IO (Either String ())
|
||||
compileIOWithOptions options waspProjectDir outDir = do
|
||||
-- TODO: Use ExceptT monad here, for short circuiting.
|
||||
maybeWaspFile <- findWaspFile waspProjectDir
|
||||
case maybeWaspFile of
|
||||
Nothing -> return $ Left "No *.wasp file present in the root of Wasp project."
|
||||
Just waspFile -> Lib.compile waspFile outDir options
|
||||
Just waspFile -> do
|
||||
compileResult <- Lib.compile waspFile outDir options
|
||||
case compileResult of
|
||||
Left err -> return $ Left err
|
||||
Right () -> do
|
||||
copyMigrationResult <- copyDbMigrationsDir CopyMigDirDown waspProjectDir outDir
|
||||
case copyMigrationResult of
|
||||
Just err -> return $ Left $ "Copying migration folder failed: " ++ err
|
||||
Nothing -> return $ Right ()
|
||||
|
@ -1,6 +1,8 @@
|
||||
module Command.Db.Migrate
|
||||
( migrateSave
|
||||
, migrateUp
|
||||
, copyDbMigrationsDir
|
||||
, MigrationDirCopyDirection(..)
|
||||
) where
|
||||
|
||||
import Control.Monad.Catch (catch)
|
||||
@ -122,11 +124,11 @@ copyDbMigrationsDir copyDirection waspProjectDir genProjectRootDir = do
|
||||
else dbMigrationsDirInGenProjectDirAbs
|
||||
|
||||
doesSrcDirExist <- PathIO.doesDirExist (SP.toPathAbsDir src)
|
||||
if doesSrcDirExist == True then
|
||||
((PathIO.copyDirRecur (SP.toPathAbsDir src)
|
||||
(SP.toPathAbsDir target)) >> return Nothing)
|
||||
`catch` (\e -> return $ Just $ show (e :: P.PathException))
|
||||
`catch` (\e -> return $ Just $ show (e :: IOError))
|
||||
|
||||
if doesSrcDirExist
|
||||
then ((PathIO.copyDirRecur (SP.toPathAbsDir src)
|
||||
(SP.toPathAbsDir target))
|
||||
>> return Nothing)
|
||||
`catch` (\e -> return $ Just $ show (e :: P.PathException))
|
||||
`catch` (\e -> return $ Just $ show (e :: IOError))
|
||||
else return Nothing
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user