mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-11-26 22:36:01 +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 { Link } from 'react-router-dom'
|
||||||
|
|
||||||
import LoginForm from '@wasp/auth/forms/Login'
|
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 { Link } from 'react-router-dom'
|
||||||
|
|
||||||
import SignupForm from '@wasp/auth/forms/Signup'
|
import SignupForm from '@wasp/auth/forms/Signup'
|
||||||
|
@ -4,13 +4,15 @@ module Command.Compile
|
|||||||
, compileIOWithOptions
|
, compileIOWithOptions
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Control.Monad.Except (throwError)
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
import Control.Monad.Except (throwError)
|
|
||||||
|
|
||||||
import Command (Command, CommandError (..))
|
import Command (Command, CommandError (..))
|
||||||
import Command.Common (findWaspProjectRootDirFromCwd,
|
import Command.Common (findWaspFile,
|
||||||
findWaspFile,
|
findWaspProjectRootDirFromCwd,
|
||||||
waspSaysC)
|
waspSaysC)
|
||||||
|
import Command.Db.Migrate (copyDbMigrationsDir, MigrationDirCopyDirection(..))
|
||||||
|
|
||||||
import qualified Common
|
import qualified Common
|
||||||
import CompileOptions (CompileOptions (..))
|
import CompileOptions (CompileOptions (..))
|
||||||
import qualified Lib
|
import qualified Lib
|
||||||
@ -46,7 +48,16 @@ compileIOWithOptions :: CompileOptions
|
|||||||
-> Path Abs (Dir Lib.ProjectRootDir)
|
-> Path Abs (Dir Lib.ProjectRootDir)
|
||||||
-> IO (Either String ())
|
-> IO (Either String ())
|
||||||
compileIOWithOptions options waspProjectDir outDir = do
|
compileIOWithOptions options waspProjectDir outDir = do
|
||||||
|
-- TODO: Use ExceptT monad here, for short circuiting.
|
||||||
maybeWaspFile <- findWaspFile waspProjectDir
|
maybeWaspFile <- findWaspFile waspProjectDir
|
||||||
case maybeWaspFile of
|
case maybeWaspFile of
|
||||||
Nothing -> return $ Left "No *.wasp file present in the root of Wasp project."
|
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
|
module Command.Db.Migrate
|
||||||
( migrateSave
|
( migrateSave
|
||||||
, migrateUp
|
, migrateUp
|
||||||
|
, copyDbMigrationsDir
|
||||||
|
, MigrationDirCopyDirection(..)
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad.Catch (catch)
|
import Control.Monad.Catch (catch)
|
||||||
@ -122,11 +124,11 @@ copyDbMigrationsDir copyDirection waspProjectDir genProjectRootDir = do
|
|||||||
else dbMigrationsDirInGenProjectDirAbs
|
else dbMigrationsDirInGenProjectDirAbs
|
||||||
|
|
||||||
doesSrcDirExist <- PathIO.doesDirExist (SP.toPathAbsDir src)
|
doesSrcDirExist <- PathIO.doesDirExist (SP.toPathAbsDir src)
|
||||||
if doesSrcDirExist == True then
|
if doesSrcDirExist
|
||||||
((PathIO.copyDirRecur (SP.toPathAbsDir src)
|
then ((PathIO.copyDirRecur (SP.toPathAbsDir src)
|
||||||
(SP.toPathAbsDir target)) >> return Nothing)
|
(SP.toPathAbsDir target))
|
||||||
`catch` (\e -> return $ Just $ show (e :: P.PathException))
|
>> return Nothing)
|
||||||
`catch` (\e -> return $ Just $ show (e :: IOError))
|
`catch` (\e -> return $ Just $ show (e :: P.PathException))
|
||||||
|
`catch` (\e -> return $ Just $ show (e :: IOError))
|
||||||
else return Nothing
|
else return Nothing
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user