Skip to content

Commit

Permalink
Small fixes in the generator (#2269)
Browse files Browse the repository at this point in the history
  • Loading branch information
sodic authored Sep 27, 2024
1 parent 3b69284 commit 0dbd797
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions waspc/src/Wasp/Generator/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
7 changes: 2 additions & 5 deletions waspc/src/Wasp/Generator/SdkGenerator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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|],
Expand Down
4 changes: 2 additions & 2 deletions waspc/src/Wasp/Generator/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down

0 comments on commit 0dbd797

Please sign in to comment.