mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-25 01:52:00 +03:00
Small fixes in the generator (#2269)
This commit is contained in:
parent
3b692843bd
commit
0dbd7975bb
@ -14,7 +14,7 @@ where
|
||||
import Control.Monad.Except (ExceptT, MonadError (throwError), runExceptT)
|
||||
import qualified Control.Monad.Except as MonadExcept
|
||||
import Control.Monad.Identity (Identity (runIdentity))
|
||||
import Control.Monad.State (MonadState, StateT (runStateT), modify)
|
||||
import Control.Monad.State (MonadState, State, modify, runStateT)
|
||||
import Data.List.NonEmpty (NonEmpty, fromList)
|
||||
|
||||
-- | Generator is a monad transformer stack where we abstract away the underlying
|
||||
@ -25,7 +25,7 @@ import Data.List.NonEmpty (NonEmpty, fromList)
|
||||
-- The mechanism to catch errors is only there to assist in collecting more errors, not recover.
|
||||
-- There may optionally be additional errors or non-fatal warnings logged in the State.
|
||||
newtype Generator a = Generator
|
||||
{ _runGenerator :: ExceptT GeneratorError (StateT GeneratorState Identity) a
|
||||
{ _runGenerator :: ExceptT GeneratorError (State GeneratorState) a
|
||||
}
|
||||
deriving
|
||||
( Functor,
|
||||
|
@ -61,9 +61,6 @@ import qualified Wasp.Project.Db as Db
|
||||
import qualified Wasp.SemanticVersion as SV
|
||||
import Wasp.Util ((<++>))
|
||||
|
||||
genSdk :: AppSpec -> Generator [FileDraft]
|
||||
genSdk spec = genSdkReal spec
|
||||
|
||||
buildSdk :: Path' Abs (Dir ProjectRootDir) -> IO (Either String ())
|
||||
buildSdk projectRootDir = do
|
||||
chan <- newChan
|
||||
@ -77,8 +74,8 @@ buildSdk projectRootDir = do
|
||||
where
|
||||
dstDir = projectRootDir </> C.sdkRootDirInProjectRootDir
|
||||
|
||||
genSdkReal :: AppSpec -> Generator [FileDraft]
|
||||
genSdkReal spec =
|
||||
genSdk :: AppSpec -> Generator [FileDraft]
|
||||
genSdk spec =
|
||||
sequence
|
||||
[ genFileCopy [relfile|vite-env.d.ts|],
|
||||
genFileCopy [relfile|prisma-runtime-library.d.ts|],
|
||||
|
@ -22,8 +22,8 @@ runSetup spec projectRootDir sendMessage = do
|
||||
setUpDatabaseResults@(_warnings, _errors@[]) -> do
|
||||
-- todo(filip): Should we consider building SDK as part of code generation?
|
||||
-- todo(filip): Avoid building on each setup if we don't need to.
|
||||
buildsSdkResults <- buildSdk projectRootDir sendMessage
|
||||
return $ setUpDatabaseResults <> buildsSdkResults
|
||||
buildSdkResults <- buildSdk projectRootDir sendMessage
|
||||
return $ setUpDatabaseResults <> buildSdkResults
|
||||
setUpDatabaseResults -> return setUpDatabaseResults
|
||||
Left npmInstallError -> return ([], [npmInstallError])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user