diff --git a/waspc/cli/src/Wasp/Cli/Command/Build.hs b/waspc/cli/src/Wasp/Cli/Command/Build.hs
index 8b75b2e7f7..26c83d2fec 100644
--- a/waspc/cli/src/Wasp/Cli/Command/Build.hs
+++ b/waspc/cli/src/Wasp/Cli/Command/Build.hs
@@ -69,7 +69,9 @@ buildIO waspProjectDir buildDir = compileIOWithOptions options waspProjectDir bu
where
options =
CompileOptions
- { externalCodeDirPath = waspProjectDir > Common.extCodeDirInWaspProjectDir,
+ { externalClientCodeDirPath = waspProjectDir > Common.extClientCodeDirInWaspProjectDir,
+ externalServerCodeDirPath = waspProjectDir > Common.extServerCodeDirInWaspProjectDir,
+ externalSharedCodeDirPath = waspProjectDir > Common.extSharedCodeDirInWaspProjectDir,
isBuild = True,
sendMessage = cliSendMessage,
-- Ignore "DB needs migration warnings" during build, as that is not a required step.
diff --git a/waspc/cli/src/Wasp/Cli/Command/Compile.hs b/waspc/cli/src/Wasp/Cli/Command/Compile.hs
index dd92a34330..bb9231ceb4 100644
--- a/waspc/cli/src/Wasp/Cli/Command/Compile.hs
+++ b/waspc/cli/src/Wasp/Cli/Command/Compile.hs
@@ -114,7 +114,9 @@ compileIOWithOptions options waspProjectDir outDir =
defaultCompileOptions :: Path' Abs (Dir WaspProjectDir) -> CompileOptions
defaultCompileOptions waspProjectDir =
CompileOptions
- { externalCodeDirPath = waspProjectDir > Common.extCodeDirInWaspProjectDir,
+ { externalServerCodeDirPath = waspProjectDir > Common.extServerCodeDirInWaspProjectDir,
+ externalClientCodeDirPath = waspProjectDir > Common.extClientCodeDirInWaspProjectDir,
+ externalSharedCodeDirPath = waspProjectDir > Common.extSharedCodeDirInWaspProjectDir,
isBuild = False,
sendMessage = cliSendMessage,
generatorWarningsFilter = id
diff --git a/waspc/cli/src/Wasp/Cli/Command/CreateNewProject.hs b/waspc/cli/src/Wasp/Cli/Command/CreateNewProject.hs
index a6fb057103..d57c2637f1 100644
--- a/waspc/cli/src/Wasp/Cli/Command/CreateNewProject.hs
+++ b/waspc/cli/src/Wasp/Cli/Command/CreateNewProject.hs
@@ -6,18 +6,18 @@ where
import Control.Monad.Except (throwError)
import Control.Monad.IO.Class (liftIO)
import Data.List (intercalate)
-import StrongPath (Abs, Dir, File', Path', Rel, reldir, relfile, (>))
-import qualified StrongPath as SP
-import System.Directory (createDirectory, getCurrentDirectory)
-import qualified System.Directory
+import Path.IO (copyDirRecur, doesDirExist)
+import StrongPath (Abs, Dir, Path, Path', System, fromAbsFile, parseAbsDir, reldir, relfile, (>))
+import StrongPath.Path (toPathAbsDir)
+import System.Directory (getCurrentDirectory)
import qualified System.FilePath as FP
import Text.Printf (printf)
import Wasp.Analyzer.Parser (isValidWaspIdentifier)
-import Wasp.AppSpec.ExternalCode (SourceExternalCodeDir)
import Wasp.Cli.Command (Command, CommandError (..))
import qualified Wasp.Cli.Command.Common as Command.Common
-import qualified Wasp.Cli.Common as Common
-import qualified Wasp.Data
+import Wasp.Common (WaspProjectDir)
+import qualified Wasp.Common as Common (WaspProjectDir)
+import qualified Wasp.Data as Data
import Wasp.Util (indent, kebabToCamelCase)
import qualified Wasp.Util.Terminal as Term
import qualified Wasp.Version as WV
@@ -27,14 +27,30 @@ data ProjectInfo = ProjectInfo
_appName :: String
}
+createNewProject :: String -> Command ()
+createNewProject projectNameCandidate = do
+ projectInfo <- parseProjectInfo projectNameCandidate
+ createWaspProjectDir projectInfo
+ liftIO $ printGettingStartedInstructions $ _projectName projectInfo
+ where
+ printGettingStartedInstructions :: String -> IO ()
+ printGettingStartedInstructions projectName = do
+ putStrLn $ Term.applyStyles [Term.Green] ("Created new Wasp app in ./" ++ projectName ++ " directory!")
+ putStrLn "To run it, do:"
+ putStrLn ""
+ putStrLn $ Term.applyStyles [Term.Bold] (" cd " ++ projectName)
+ putStrLn $ Term.applyStyles [Term.Bold] " wasp start"
+ putStrLn ""
+ putStrLn Command.Common.alphaWarningMessage
+
-- Takes a project name String
-- Returns either the ProjectInfo type that contains both the Project name
-- and the App name (which might be the same), or an error describing why the name is invalid
-parseProjectInfo :: String -> Either String ProjectInfo
+parseProjectInfo :: String -> Command ProjectInfo
parseProjectInfo name
- | isValidWaspIdentifier appName = Right (ProjectInfo name appName)
+ | isValidWaspIdentifier appName = return $ ProjectInfo name appName
| otherwise =
- Left $
+ throwProjectCreationError $
intercalate
"\n"
[ "The project's name is not in the valid format!",
@@ -45,81 +61,36 @@ parseProjectInfo name
where
appName = kebabToCamelCase name
-createNewProject :: String -> Command ()
-createNewProject name =
- case parseProjectInfo name of
- Right projectInfo -> createNewProject' projectInfo
- Left parsedError ->
- throwError $
- CommandError "Project creation failed" parsedError
-
-createNewProject' :: ProjectInfo -> Command ()
-createNewProject' (ProjectInfo projectName appName) = do
+createWaspProjectDir :: ProjectInfo -> Command ()
+createWaspProjectDir projectInfo = do
+ absWaspProjectDir <- getAbsoluteWaspProjectDir projectInfo
+ dirExists <- doesDirExist $ toPathAbsDir absWaspProjectDir
+ if dirExists
+ then throwProjectCreationError $ show absWaspProjectDir ++ " is an existing directory"
+ else liftIO $ do
+ initializeProjectFromSkeleton absWaspProjectDir
+ writeMainWaspFile absWaspProjectDir projectInfo
+
+getAbsoluteWaspProjectDir :: ProjectInfo -> Command (Path System Abs (Dir WaspProjectDir))
+getAbsoluteWaspProjectDir (ProjectInfo projectName _) = do
absCwd <- liftIO getCurrentDirectory
- waspProjectDir <- case SP.parseAbsDir $ absCwd FP.> projectName of
- Left err ->
- throwError $
- CommandError
- "Project creation failed"
- ( "Failed to parse absolute path to wasp project dir: "
- ++ show err
- )
+ case parseAbsDir $ absCwd FP.> projectName of
Right sp -> return sp
- liftIO $ do
- createDirectorySP waspProjectDir
- writeFileSP (waspProjectDir > mainWaspFileInWaspProjectDir) mainWaspFileContent
- writeFileSP (waspProjectDir > gitignoreFileInWaspProjectDir) gitignoreFileContent
- writeFileSP
- (waspProjectDir > Common.dotWaspRootFileInWaspProjectDir)
- "File marking the root of Wasp project."
-
- let extCodeDir = waspProjectDir > Common.extCodeDirInWaspProjectDir
- liftIO $ do
- createDirectorySP extCodeDir
- dataDir <- Wasp.Data.getAbsDataDirPath
-
- let copyTemplateFile' = copyTemplateFile dataDir extCodeDir
-
- writeFileSP (extCodeDir > waspignoreFileInExtCodeDir) waspignoreFileContent
-
- copyTemplateFile'
- [relfile|new/ext/MainPage.js|]
- mainPageJsFileInExtCodeDir
-
- copyTemplateFile'
- [relfile|new/ext/Main.css|]
- mainCssFileInExtCodeDir
-
- copyTemplateFile'
- [relfile|new/ext/waspLogo.png|]
- waspLogoFileInExtCodeDir
-
- liftIO $ do
- putStrLn $ Term.applyStyles [Term.Green] ("Created new Wasp app in ./" ++ projectName ++ " directory!")
- putStrLn "To run it, do:"
- putStrLn ""
- putStrLn $ Term.applyStyles [Term.Bold] (" cd " ++ projectName)
- putStrLn $ Term.applyStyles [Term.Bold] " wasp start"
- putStrLn ""
- putStrLn Command.Common.alphaWarningMessage
+ Left err ->
+ throwProjectCreationError $
+ "Failed to parse absolute path to wasp project dir: " ++ show err
+
+-- Copies prepared files to the new project directory.
+initializeProjectFromSkeleton :: Path' Abs (Dir Common.WaspProjectDir) -> IO ()
+initializeProjectFromSkeleton absWaspProjectDir = do
+ dataDir <- Data.getAbsDataDirPath
+ let absSkeletonDir = dataDir > [reldir|Cli/templates/new|]
+ copyDirRecur (toPathAbsDir absSkeletonDir) (toPathAbsDir absWaspProjectDir)
+
+writeMainWaspFile :: Path System Abs (Dir WaspProjectDir) -> ProjectInfo -> IO ()
+writeMainWaspFile waspProjectDir (ProjectInfo projectName appName) = writeFile absMainWaspFile mainWaspFileContent
where
- copyTemplateFile ::
- Path' Abs (Dir Wasp.Data.DataDir) ->
- Path' Abs (Dir SourceExternalCodeDir) ->
- Path' (Rel Common.CliTemplatesDir) File' ->
- Path' (Rel SourceExternalCodeDir) File' ->
- IO ()
- copyTemplateFile dataDir extCodeDir srcTmplFile dstExtDirFile =
- System.Directory.copyFile
- (SP.fromAbsFile (dataDir > cliTemplatesDirInDataDir > srcTmplFile))
- (SP.fromAbsFile (extCodeDir > dstExtDirFile))
-
- cliTemplatesDirInDataDir :: Path' (Rel Wasp.Data.DataDir) (Dir Common.CliTemplatesDir)
- cliTemplatesDirInDataDir = [reldir|Cli/templates|]
-
- mainWaspFileInWaspProjectDir :: Path' (Rel Common.WaspProjectDir) File'
- mainWaspFileInWaspProjectDir = [relfile|main.wasp|]
-
+ absMainWaspFile = fromAbsFile $ waspProjectDir > [relfile|main.wasp|]
mainWaspFileContent =
unlines
[ "app %s {" `printf` appName,
@@ -131,38 +102,9 @@ createNewProject' (ProjectInfo projectName appName) = do
"",
"route RootRoute { path: \"/\", to: MainPage }",
"page MainPage {",
- " component: import Main from \"@ext/MainPage.js\"",
+ " component: import Main from \"@client/MainPage.js\"",
"}"
]
- gitignoreFileInWaspProjectDir :: Path' (Rel Common.WaspProjectDir) File'
- gitignoreFileInWaspProjectDir = [relfile|.gitignore|]
-
- gitignoreFileContent =
- unlines
- [ "/.wasp/",
- "/.env.server",
- "/.env.client"
- ]
-
- waspignoreFileInExtCodeDir :: Path' (Rel SourceExternalCodeDir) File'
- waspignoreFileInExtCodeDir = [relfile|.waspignore|]
-
- waspignoreFileContent =
- unlines
- [ "# Ignore editor tmp files",
- "**/*~",
- "**/#*#"
- ]
-
- mainPageJsFileInExtCodeDir :: Path' (Rel SourceExternalCodeDir) File'
- mainPageJsFileInExtCodeDir = [relfile|MainPage.js|]
-
- mainCssFileInExtCodeDir :: Path' (Rel SourceExternalCodeDir) File'
- mainCssFileInExtCodeDir = [relfile|Main.css|]
-
- waspLogoFileInExtCodeDir :: Path' (Rel SourceExternalCodeDir) File'
- waspLogoFileInExtCodeDir = [relfile|waspLogo.png|]
-
- writeFileSP = writeFile . SP.fromAbsFile
- createDirectorySP = createDirectory . SP.fromAbsDir
+throwProjectCreationError :: String -> Command a
+throwProjectCreationError = throwError . CommandError "Project creation failed"
diff --git a/waspc/cli/src/Wasp/Cli/Command/Deps.hs b/waspc/cli/src/Wasp/Cli/Command/Deps.hs
index 68b3ca94be..ed7d5acd39 100644
--- a/waspc/cli/src/Wasp/Cli/Command/Deps.hs
+++ b/waspc/cli/src/Wasp/Cli/Command/Deps.hs
@@ -5,7 +5,6 @@ where
import Control.Monad.Except (throwError)
import Control.Monad.IO.Class (liftIO)
-import Data.List.NonEmpty (toList)
import Wasp.AppSpec (AppSpec)
import qualified Wasp.AppSpec.App.Dependency as AS.Dependency
import Wasp.Cli.Command (Command, CommandError (..))
@@ -21,14 +20,14 @@ import qualified Wasp.Util.Terminal as Term
deps :: Command ()
deps = do
waspProjectDir <- findWaspProjectRootDirFromCwd
- (_, appSpecOrAnalyzerErrors) <- liftIO $ analyzeWaspProject waspProjectDir (defaultCompileOptions waspProjectDir)
+ appSpecOrAnalyzerErrors <- liftIO $ analyzeWaspProject waspProjectDir (defaultCompileOptions waspProjectDir)
appSpec <-
either
- (throwError . CommandError "Determining dependencies failed due to a compilation error in your Wasp project" . unwords . toList)
+ (throwError . CommandError "Determining dependencies failed due to a compilation error in your Wasp project" . unwords)
return
appSpecOrAnalyzerErrors
- liftIO . putStrLn $ depsMessage appSpec
+ liftIO $ putStrLn $ depsMessage appSpec
depsMessage :: AppSpec -> String
depsMessage appSpec =
diff --git a/waspc/cli/src/Wasp/Cli/Command/Info.hs b/waspc/cli/src/Wasp/Cli/Command/Info.hs
index 92a533ecfa..97b670ffa7 100644
--- a/waspc/cli/src/Wasp/Cli/Command/Info.hs
+++ b/waspc/cli/src/Wasp/Cli/Command/Info.hs
@@ -5,14 +5,14 @@ module Wasp.Cli.Command.Info
)
where
-import Control.Arrow (ArrowChoice (left))
-import Control.Monad.IO.Class (liftIO)
+import Control.Arrow
+import Control.Monad.Except
import StrongPath (Abs, Dir, Path', fromAbsFile, fromRelFile, toFilePath)
import StrongPath.Operations
import System.Directory (doesFileExist, getFileSize)
import qualified Wasp.Analyzer as Analyzer
-import qualified Wasp.AppSpec as AS
import qualified Wasp.AppSpec.App as AS.App
+import qualified Wasp.AppSpec.Core.Decl as AS (Decl, takeDecls)
import Wasp.Cli.Command (Command)
import Wasp.Cli.Command.Common (findWaspProjectRootDirFromCwd)
import Wasp.Cli.Command.Message (cliSendMessageC)
@@ -26,30 +26,23 @@ import Wasp.Util.IO (listDirectoryDeep)
import qualified Wasp.Util.Terminal as Term
info :: Command ()
-info =
- do
- waspDir <- findWaspProjectRootDirFromCwd
- compileInfo <- liftIO $ readCompileInformation waspDir
- projectSize <- liftIO $ readDirectorySizeMB waspDir
- declsOrError <- liftIO $ parseWaspFile waspDir
- case declsOrError of
- Left err -> cliSendMessageC $ Msg.Failure "Info failed" err
- Right decls -> do
- cliSendMessageC $
- Msg.Info $
- unlines
- [ "",
- title "Project information",
- printInfo
- "Name"
- (fst $ head $ AS.takeDecls @AS.App.App decls),
- printInfo
- "Last compile"
- compileInfo,
- printInfo
- "Project size"
- projectSize
- ]
+info = do
+ waspDir <- findWaspProjectRootDirFromCwd
+ compileInfo <- liftIO $ readCompileInformation waspDir
+ projectSize <- liftIO $ readDirectorySizeMB waspDir
+ declsOrError <- liftIO $ parseWaspFile waspDir
+ case declsOrError of
+ Left err -> cliSendMessageC $ Msg.Failure "Info failed" err
+ Right decls -> do
+ cliSendMessageC $
+ Msg.Info $
+ unlines
+ [ "",
+ title "Project information",
+ printInfo "Name" (fst $ head $ AS.takeDecls @AS.App.App decls),
+ printInfo "Last compile" compileInfo,
+ printInfo "Project size" projectSize
+ ]
printInfo :: String -> String -> String
printInfo key value = Term.applyStyles [Term.Cyan] key ++ ": " <> Term.applyStyles [Term.White] value
@@ -70,17 +63,12 @@ readCompileInformation waspDir = do
else return "No compile information found"
parseWaspFile :: Path' Abs (Dir WaspProjectDir) -> IO (Either String [AS.Decl])
-parseWaspFile waspDir = do
- maybeWaspFile <- findWaspFile waspDir
- case maybeWaspFile of
- Nothing -> return (Left "Couldn't find a single *.wasp file.")
- Just waspFile ->
- do
- waspStr <- readFile (toFilePath waspFile)
- return $
- left
- ( ("Couldn't parse .wasp file:\n" <>)
- . showCompilerErrorForTerminal (waspFile, waspStr)
- . Analyzer.getErrorMessageAndCtx
- )
- $ Analyzer.analyze waspStr
+parseWaspFile waspDir = runExceptT $ do
+ waspFile <- ExceptT $ findWaspFile waspDir
+ waspStr <- liftIO $ readFile $ toFilePath waspFile
+ liftEither $ left (annotateErrorForCli waspFile waspStr) $ Analyzer.analyze waspStr
+ where
+ annotateErrorForCli waspFile waspStr =
+ ("Couldn't parse .wasp file:\n" ++)
+ . showCompilerErrorForTerminal (waspFile, waspStr)
+ . Analyzer.getErrorMessageAndCtx
diff --git a/waspc/cli/src/Wasp/Cli/Command/Watch.hs b/waspc/cli/src/Wasp/Cli/Command/Watch.hs
index 33fddb7f00..9dd10bb2c9 100644
--- a/waspc/cli/src/Wasp/Cli/Command/Watch.hs
+++ b/waspc/cli/src/Wasp/Cli/Command/Watch.hs
@@ -39,18 +39,11 @@ watch ::
watch waspProjectDir outDir ongoingCompilationResultMVar = FSN.withManager $ \mgr -> do
currentTime <- getCurrentTime
chan <- newChan
- _ <-
- FSN.watchDirChan
- mgr
- (SP.fromAbsDir waspProjectDir)
- eventFilter
- chan
- _ <-
- FSN.watchTreeChan
- mgr
- (SP.fromAbsDir $ waspProjectDir > Common.extCodeDirInWaspProjectDir)
- eventFilter
- chan
+ _ <- FSN.watchDirChan mgr (SP.fromAbsDir waspProjectDir) eventFilter chan
+ let watchProjectSubdirTree path = FSN.watchTreeChan mgr (SP.fromAbsDir $ waspProjectDir > path) eventFilter chan
+ _ <- watchProjectSubdirTree Common.extClientCodeDirInWaspProjectDir
+ _ <- watchProjectSubdirTree Common.extServerCodeDirInWaspProjectDir
+ _ <- watchProjectSubdirTree Common.extSharedCodeDirInWaspProjectDir
listenForEvents chan currentTime
where
listenForEvents :: Chan FSN.Event -> UTCTime -> IO ()
@@ -87,7 +80,7 @@ watch waspProjectDir outDir ongoingCompilationResultMVar = FSN.withManager $ \mg
waitUntilNoNewEvents chan lastCompileTime secondsToDelay = do
eventOrDelay <- race (readChan chan) (threadDelaySeconds secondsToDelay)
case eventOrDelay of
- Left event -> do
+ Left event ->
unless (isStaleEvent event lastCompileTime) $
-- We have a new event, restart waiting process.
waitUntilNoNewEvents chan lastCompileTime secondsToDelay
diff --git a/waspc/cli/src/Wasp/Cli/Common.hs b/waspc/cli/src/Wasp/Cli/Common.hs
index dc60e6cbbd..cece47fefc 100644
--- a/waspc/cli/src/Wasp/Cli/Common.hs
+++ b/waspc/cli/src/Wasp/Cli/Common.hs
@@ -5,7 +5,9 @@ module Wasp.Cli.Common
dotWaspDirInWaspProjectDir,
dotWaspRootFileInWaspProjectDir,
dotWaspInfoFileInGeneratedCodeDir,
- extCodeDirInWaspProjectDir,
+ extServerCodeDirInWaspProjectDir,
+ extClientCodeDirInWaspProjectDir,
+ extSharedCodeDirInWaspProjectDir,
generatedCodeDirInDotWaspDir,
buildDirInDotWaspDir,
waspSays,
@@ -41,8 +43,14 @@ dotWaspRootFileInWaspProjectDir = [relfile|.wasproot|]
dotWaspInfoFileInGeneratedCodeDir :: Path' (Rel Wasp.Generator.Common.ProjectRootDir) File'
dotWaspInfoFileInGeneratedCodeDir = [relfile|.waspinfo|]
-extCodeDirInWaspProjectDir :: Path' (Rel WaspProjectDir) (Dir SourceExternalCodeDir)
-extCodeDirInWaspProjectDir = [reldir|ext|]
+extServerCodeDirInWaspProjectDir :: Path' (Rel WaspProjectDir) (Dir SourceExternalCodeDir)
+extServerCodeDirInWaspProjectDir = [reldir|src/server|]
+
+extClientCodeDirInWaspProjectDir :: Path' (Rel WaspProjectDir) (Dir SourceExternalCodeDir)
+extClientCodeDirInWaspProjectDir = [reldir|src/client|]
+
+extSharedCodeDirInWaspProjectDir :: Path' (Rel WaspProjectDir) (Dir SourceExternalCodeDir)
+extSharedCodeDirInWaspProjectDir = [reldir|src/shared|]
waspSays :: String -> IO ()
waspSays what = putStrLn $ Term.applyStyles [Term.Yellow] what
diff --git a/waspc/data/Cli/templates/new/.gitignore b/waspc/data/Cli/templates/new/.gitignore
new file mode 100644
index 0000000000..c51177f6dc
--- /dev/null
+++ b/waspc/data/Cli/templates/new/.gitignore
@@ -0,0 +1,3 @@
+/.wasp/
+/.env.server
+/.env.client
diff --git a/waspc/data/Cli/templates/new/.wasproot b/waspc/data/Cli/templates/new/.wasproot
new file mode 100644
index 0000000000..ca2cfdb482
--- /dev/null
+++ b/waspc/data/Cli/templates/new/.wasproot
@@ -0,0 +1 @@
+File marking the root of Wasp project.
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/ext/.waspignore b/waspc/data/Cli/templates/new/src/.waspignore
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/ext/.waspignore
rename to waspc/data/Cli/templates/new/src/.waspignore
diff --git a/waspc/data/Cli/templates/new/src/client/.gitkeep b/waspc/data/Cli/templates/new/src/client/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/data/Cli/templates/new/src/client/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/data/Cli/templates/new/ext/Main.css b/waspc/data/Cli/templates/new/src/client/Main.css
similarity index 100%
rename from waspc/data/Cli/templates/new/ext/Main.css
rename to waspc/data/Cli/templates/new/src/client/Main.css
diff --git a/waspc/data/Cli/templates/new/ext/MainPage.js b/waspc/data/Cli/templates/new/src/client/MainPage.js
similarity index 100%
rename from waspc/data/Cli/templates/new/ext/MainPage.js
rename to waspc/data/Cli/templates/new/src/client/MainPage.js
diff --git a/waspc/data/Cli/templates/new/ext/waspLogo.png b/waspc/data/Cli/templates/new/src/client/waspLogo.png
similarity index 100%
rename from waspc/data/Cli/templates/new/ext/waspLogo.png
rename to waspc/data/Cli/templates/new/src/client/waspLogo.png
diff --git a/waspc/data/Cli/templates/new/src/server/.gitkeep b/waspc/data/Cli/templates/new/src/server/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/data/Cli/templates/new/src/server/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/data/Cli/templates/new/src/shared/.gitkeep b/waspc/data/Cli/templates/new/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/data/Cli/templates/new/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/Tests/WaspJobTest.hs b/waspc/e2e-test/Tests/WaspJobTest.hs
index 6faba23b1c..bb2295fd53 100644
--- a/waspc/e2e-test/Tests/WaspJobTest.hs
+++ b/waspc/e2e-test/Tests/WaspJobTest.hs
@@ -16,7 +16,7 @@ waspJob = do
" job MySpecialJob { \n\
\ executor: PgBoss, \n\
\ perform: { \n\
- \ fn: import { foo } from \"@ext/jobs/bar.js\" \n\
+ \ fn: import { foo } from \"@server/jobs/bar.js\" \n\
\ } \n\
\ } \n"
@@ -31,6 +31,6 @@ waspJob = do
cdIntoCurrentProject,
setDbToPSQL,
appendToWaspFile entityDecl,
- createFile jobFile "./ext/jobs" "bar.js",
+ createFile jobFile "./src/server/jobs" "bar.js",
waspCliCompile
]
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/files.manifest b/waspc/e2e-test/test-outputs/waspBuild-golden/files.manifest
index 617d2bb6d6..fa92ad53d9 100644
--- a/waspc/e2e-test/test-outputs/waspBuild-golden/files.manifest
+++ b/waspc/e2e-test/test-outputs/waspBuild-golden/files.manifest
@@ -11,9 +11,7 @@ waspBuild/.wasp/build/server/src/config.js
waspBuild/.wasp/build/server/src/core/AuthError.js
waspBuild/.wasp/build/server/src/core/HttpError.js
waspBuild/.wasp/build/server/src/dbClient.js
-waspBuild/.wasp/build/server/src/ext-src/Main.css
-waspBuild/.wasp/build/server/src/ext-src/MainPage.js
-waspBuild/.wasp/build/server/src/ext-src/waspLogo.png
+waspBuild/.wasp/build/server/src/ext-src/.gitkeep
waspBuild/.wasp/build/server/src/jobs/core/Job.js
waspBuild/.wasp/build/server/src/jobs/core/SubmittedJob.js
waspBuild/.wasp/build/server/src/jobs/core/allJobs.js
@@ -23,6 +21,7 @@ waspBuild/.wasp/build/server/src/jobs/core/simpleJob.js
waspBuild/.wasp/build/server/src/routes/index.js
waspBuild/.wasp/build/server/src/routes/operations/index.js
waspBuild/.wasp/build/server/src/server.js
+waspBuild/.wasp/build/server/src/shared/.gitkeep
waspBuild/.wasp/build/server/src/utils.js
waspBuild/.wasp/build/web-app/.npmrc
waspBuild/.wasp/build/web-app/README.md
@@ -35,6 +34,7 @@ waspBuild/.wasp/build/web-app/src/actions/core.js
waspBuild/.wasp/build/web-app/src/actions/index.js
waspBuild/.wasp/build/web-app/src/api.js
waspBuild/.wasp/build/web-app/src/config.js
+waspBuild/.wasp/build/web-app/src/ext-src/.gitkeep
waspBuild/.wasp/build/web-app/src/ext-src/Main.css
waspBuild/.wasp/build/web-app/src/ext-src/MainPage.js
waspBuild/.wasp/build/web-app/src/ext-src/waspLogo.png
@@ -48,10 +48,14 @@ waspBuild/.wasp/build/web-app/src/queries/index.js
waspBuild/.wasp/build/web-app/src/queryClient.js
waspBuild/.wasp/build/web-app/src/router.js
waspBuild/.wasp/build/web-app/src/serviceWorker.js
+waspBuild/.wasp/build/web-app/src/shared/.gitkeep
waspBuild/.wasp/build/web-app/src/utils.js
waspBuild/.wasproot
-waspBuild/ext/.waspignore
-waspBuild/ext/Main.css
-waspBuild/ext/MainPage.js
-waspBuild/ext/waspLogo.png
waspBuild/main.wasp
+waspBuild/src/.waspignore
+waspBuild/src/client/.gitkeep
+waspBuild/src/client/Main.css
+waspBuild/src/client/MainPage.js
+waspBuild/src/client/waspLogo.png
+waspBuild/src/server/.gitkeep
+waspBuild/src/shared/.gitkeep
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/.waspchecksums b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/.waspchecksums
index 0107cd4c2d..039c3b6cce 100644
--- a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/.waspchecksums
+++ b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/.waspchecksums
@@ -86,23 +86,9 @@
[
[
"file",
- "server/src/ext-src/Main.css"
+ "server/src/ext-src/.gitkeep"
],
- "1583ce49887ea575e563dab0c7ad6d2e2e3e6a351ed7c2f80c310641b1456417"
- ],
- [
- [
- "file",
- "server/src/ext-src/MainPage.js"
- ],
- "c9ed9b5271f648715373095f43d60a2ab3e47f159c6dd6f3337ed22e5b73e80c"
- ],
- [
- [
- "file",
- "server/src/ext-src/waspLogo.png"
- ],
- "0f05a89eb945d6d7326110e88776e402833b356202b06d0a8bf652e118d3fd2f"
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
],
[
[
@@ -167,6 +153,13 @@
],
"e19bdae598265cbe2457ff1e2d8524aa821666482cb7d21644e290a68daf94a5"
],
+ [
+ [
+ "file",
+ "server/src/shared/.gitkeep"
+ ],
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
+ ],
[
[
"file",
@@ -258,6 +251,13 @@
],
"a30d5ae7c1b317a7132cac93f4b5bffc3daf11f4f07b5e0d977d063810ffdd11"
],
+ [
+ [
+ "file",
+ "web-app/src/ext-src/.gitkeep"
+ ],
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
+ ],
[
[
"file",
@@ -349,6 +349,13 @@
],
"0b097cb6e2c83821630a33de933893bf75de49731b18ce3c25fc5384866fbac0"
],
+ [
+ [
+ "file",
+ "web-app/src/shared/.gitkeep"
+ ],
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
+ ],
[
[
"file",
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/server/src/ext-src/.gitkeep b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/server/src/ext-src/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/server/src/ext-src/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/server/src/shared/.gitkeep b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/server/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/server/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/web-app/src/ext-src/.gitkeep b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/web-app/src/ext-src/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/web-app/src/ext-src/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/web-app/src/shared/.gitkeep b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/web-app/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/web-app/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasproot b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasproot
index 3caa053db5..ca2cfdb482 100644
--- a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasproot
+++ b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasproot
@@ -1 +1 @@
-File marking the root of Wasp project.
\ No newline at end of file
+File marking the root of Wasp project.
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/main.wasp b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/main.wasp
index a2d95169c5..4bbd625756 100644
--- a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/main.wasp
+++ b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/main.wasp
@@ -8,5 +8,5 @@ app waspBuild {
route RootRoute { path: "/", to: MainPage }
page MainPage {
- component: import Main from "@ext/MainPage.js"
+ component: import Main from "@client/MainPage.js"
}
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/ext/.waspignore b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/.waspignore
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/ext/.waspignore
rename to waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/.waspignore
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/client/.gitkeep b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/client/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/client/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/server/src/ext-src/Main.css b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/client/Main.css
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/server/src/ext-src/Main.css
rename to waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/client/Main.css
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/server/src/ext-src/MainPage.js b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/client/MainPage.js
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/server/src/ext-src/MainPage.js
rename to waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/client/MainPage.js
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/server/src/ext-src/waspLogo.png b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/client/waspLogo.png
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/server/src/ext-src/waspLogo.png
rename to waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/client/waspLogo.png
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/server/.gitkeep b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/server/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/server/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/shared/.gitkeep b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/files.manifest b/waspc/e2e-test/test-outputs/waspCompile-golden/files.manifest
index 064eee5e84..fca2497fd6 100644
--- a/waspc/e2e-test/test-outputs/waspCompile-golden/files.manifest
+++ b/waspc/e2e-test/test-outputs/waspCompile-golden/files.manifest
@@ -11,9 +11,7 @@ waspCompile/.wasp/out/server/src/config.js
waspCompile/.wasp/out/server/src/core/AuthError.js
waspCompile/.wasp/out/server/src/core/HttpError.js
waspCompile/.wasp/out/server/src/dbClient.js
-waspCompile/.wasp/out/server/src/ext-src/Main.css
-waspCompile/.wasp/out/server/src/ext-src/MainPage.js
-waspCompile/.wasp/out/server/src/ext-src/waspLogo.png
+waspCompile/.wasp/out/server/src/ext-src/.gitkeep
waspCompile/.wasp/out/server/src/jobs/core/Job.js
waspCompile/.wasp/out/server/src/jobs/core/SubmittedJob.js
waspCompile/.wasp/out/server/src/jobs/core/allJobs.js
@@ -23,6 +21,7 @@ waspCompile/.wasp/out/server/src/jobs/core/simpleJob.js
waspCompile/.wasp/out/server/src/routes/index.js
waspCompile/.wasp/out/server/src/routes/operations/index.js
waspCompile/.wasp/out/server/src/server.js
+waspCompile/.wasp/out/server/src/shared/.gitkeep
waspCompile/.wasp/out/server/src/utils.js
waspCompile/.wasp/out/web-app/.npmrc
waspCompile/.wasp/out/web-app/README.md
@@ -35,6 +34,7 @@ waspCompile/.wasp/out/web-app/src/actions/core.js
waspCompile/.wasp/out/web-app/src/actions/index.js
waspCompile/.wasp/out/web-app/src/api.js
waspCompile/.wasp/out/web-app/src/config.js
+waspCompile/.wasp/out/web-app/src/ext-src/.gitkeep
waspCompile/.wasp/out/web-app/src/ext-src/Main.css
waspCompile/.wasp/out/web-app/src/ext-src/MainPage.js
waspCompile/.wasp/out/web-app/src/ext-src/waspLogo.png
@@ -48,10 +48,14 @@ waspCompile/.wasp/out/web-app/src/queries/index.js
waspCompile/.wasp/out/web-app/src/queryClient.js
waspCompile/.wasp/out/web-app/src/router.js
waspCompile/.wasp/out/web-app/src/serviceWorker.js
+waspCompile/.wasp/out/web-app/src/shared/.gitkeep
waspCompile/.wasp/out/web-app/src/utils.js
waspCompile/.wasproot
-waspCompile/ext/.waspignore
-waspCompile/ext/Main.css
-waspCompile/ext/MainPage.js
-waspCompile/ext/waspLogo.png
waspCompile/main.wasp
+waspCompile/src/.waspignore
+waspCompile/src/client/.gitkeep
+waspCompile/src/client/Main.css
+waspCompile/src/client/MainPage.js
+waspCompile/src/client/waspLogo.png
+waspCompile/src/server/.gitkeep
+waspCompile/src/shared/.gitkeep
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/.waspchecksums b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/.waspchecksums
index d40f933c53..4628b22155 100644
--- a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/.waspchecksums
+++ b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/.waspchecksums
@@ -86,23 +86,9 @@
[
[
"file",
- "server/src/ext-src/Main.css"
+ "server/src/ext-src/.gitkeep"
],
- "1583ce49887ea575e563dab0c7ad6d2e2e3e6a351ed7c2f80c310641b1456417"
- ],
- [
- [
- "file",
- "server/src/ext-src/MainPage.js"
- ],
- "c9ed9b5271f648715373095f43d60a2ab3e47f159c6dd6f3337ed22e5b73e80c"
- ],
- [
- [
- "file",
- "server/src/ext-src/waspLogo.png"
- ],
- "0f05a89eb945d6d7326110e88776e402833b356202b06d0a8bf652e118d3fd2f"
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
],
[
[
@@ -167,6 +153,13 @@
],
"e19bdae598265cbe2457ff1e2d8524aa821666482cb7d21644e290a68daf94a5"
],
+ [
+ [
+ "file",
+ "server/src/shared/.gitkeep"
+ ],
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
+ ],
[
[
"file",
@@ -258,6 +251,13 @@
],
"a30d5ae7c1b317a7132cac93f4b5bffc3daf11f4f07b5e0d977d063810ffdd11"
],
+ [
+ [
+ "file",
+ "web-app/src/ext-src/.gitkeep"
+ ],
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
+ ],
[
[
"file",
@@ -349,6 +349,13 @@
],
"0b097cb6e2c83821630a33de933893bf75de49731b18ce3c25fc5384866fbac0"
],
+ [
+ [
+ "file",
+ "web-app/src/shared/.gitkeep"
+ ],
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
+ ],
[
[
"file",
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/server/src/ext-src/.gitkeep b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/server/src/ext-src/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/server/src/ext-src/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/server/src/shared/.gitkeep b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/server/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/server/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/web-app/src/ext-src/.gitkeep b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/web-app/src/ext-src/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/web-app/src/ext-src/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/web-app/src/shared/.gitkeep b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/web-app/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/web-app/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasproot b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasproot
index 3caa053db5..ca2cfdb482 100644
--- a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasproot
+++ b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasproot
@@ -1 +1 @@
-File marking the root of Wasp project.
\ No newline at end of file
+File marking the root of Wasp project.
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/main.wasp b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/main.wasp
index fe8dec46a0..e1f9b611e7 100644
--- a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/main.wasp
+++ b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/main.wasp
@@ -7,5 +7,5 @@ app waspCompile {
route RootRoute { path: "/", to: MainPage }
page MainPage {
- component: import Main from "@ext/MainPage.js"
+ component: import Main from "@client/MainPage.js"
}
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/ext/.waspignore b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/.waspignore
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspJob-golden/waspJob/ext/.waspignore
rename to waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/.waspignore
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/client/.gitkeep b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/client/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/client/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/ext/Main.css b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/client/Main.css
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/ext/Main.css
rename to waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/client/Main.css
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/ext/MainPage.js b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/client/MainPage.js
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/ext/MainPage.js
rename to waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/client/MainPage.js
diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/ext/waspLogo.png b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/client/waspLogo.png
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/ext/waspLogo.png
rename to waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/client/waspLogo.png
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/server/.gitkeep b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/server/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/server/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/shared/.gitkeep b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/files.manifest b/waspc/e2e-test/test-outputs/waspJob-golden/files.manifest
index e908fed6ee..56dbc8c783 100644
--- a/waspc/e2e-test/test-outputs/waspJob-golden/files.manifest
+++ b/waspc/e2e-test/test-outputs/waspJob-golden/files.manifest
@@ -11,10 +11,8 @@ waspJob/.wasp/out/server/src/config.js
waspJob/.wasp/out/server/src/core/AuthError.js
waspJob/.wasp/out/server/src/core/HttpError.js
waspJob/.wasp/out/server/src/dbClient.js
-waspJob/.wasp/out/server/src/ext-src/Main.css
-waspJob/.wasp/out/server/src/ext-src/MainPage.js
+waspJob/.wasp/out/server/src/ext-src/.gitkeep
waspJob/.wasp/out/server/src/ext-src/jobs/bar.js
-waspJob/.wasp/out/server/src/ext-src/waspLogo.png
waspJob/.wasp/out/server/src/jobs/MySpecialJob.js
waspJob/.wasp/out/server/src/jobs/core/Job.js
waspJob/.wasp/out/server/src/jobs/core/SubmittedJob.js
@@ -25,6 +23,7 @@ waspJob/.wasp/out/server/src/jobs/core/simpleJob.js
waspJob/.wasp/out/server/src/routes/index.js
waspJob/.wasp/out/server/src/routes/operations/index.js
waspJob/.wasp/out/server/src/server.js
+waspJob/.wasp/out/server/src/shared/.gitkeep
waspJob/.wasp/out/server/src/utils.js
waspJob/.wasp/out/web-app/.npmrc
waspJob/.wasp/out/web-app/README.md
@@ -37,9 +36,9 @@ waspJob/.wasp/out/web-app/src/actions/core.js
waspJob/.wasp/out/web-app/src/actions/index.js
waspJob/.wasp/out/web-app/src/api.js
waspJob/.wasp/out/web-app/src/config.js
+waspJob/.wasp/out/web-app/src/ext-src/.gitkeep
waspJob/.wasp/out/web-app/src/ext-src/Main.css
waspJob/.wasp/out/web-app/src/ext-src/MainPage.js
-waspJob/.wasp/out/web-app/src/ext-src/jobs/bar.js
waspJob/.wasp/out/web-app/src/ext-src/waspLogo.png
waspJob/.wasp/out/web-app/src/index.js
waspJob/.wasp/out/web-app/src/logo.png
@@ -51,11 +50,15 @@ waspJob/.wasp/out/web-app/src/queries/index.js
waspJob/.wasp/out/web-app/src/queryClient.js
waspJob/.wasp/out/web-app/src/router.js
waspJob/.wasp/out/web-app/src/serviceWorker.js
+waspJob/.wasp/out/web-app/src/shared/.gitkeep
waspJob/.wasp/out/web-app/src/utils.js
waspJob/.wasproot
-waspJob/ext/.waspignore
-waspJob/ext/Main.css
-waspJob/ext/MainPage.js
-waspJob/ext/jobs/bar.js
-waspJob/ext/waspLogo.png
waspJob/main.wasp
+waspJob/src/.waspignore
+waspJob/src/client/.gitkeep
+waspJob/src/client/Main.css
+waspJob/src/client/MainPage.js
+waspJob/src/client/waspLogo.png
+waspJob/src/server/.gitkeep
+waspJob/src/server/jobs/bar.js
+waspJob/src/shared/.gitkeep
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/.waspchecksums b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/.waspchecksums
index a62ee0eb35..1a1fdc2383 100644
--- a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/.waspchecksums
+++ b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/.waspchecksums
@@ -86,16 +86,9 @@
[
[
"file",
- "server/src/ext-src/Main.css"
+ "server/src/ext-src/.gitkeep"
],
- "1583ce49887ea575e563dab0c7ad6d2e2e3e6a351ed7c2f80c310641b1456417"
- ],
- [
- [
- "file",
- "server/src/ext-src/MainPage.js"
- ],
- "c9ed9b5271f648715373095f43d60a2ab3e47f159c6dd6f3337ed22e5b73e80c"
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
],
[
[
@@ -104,13 +97,6 @@
],
"2e126f35b3a3e9a289e0dcfd8707fe903c6a053e0cf85899fb5f686d77dd3eb5"
],
- [
- [
- "file",
- "server/src/ext-src/waspLogo.png"
- ],
- "0f05a89eb945d6d7326110e88776e402833b356202b06d0a8bf652e118d3fd2f"
- ],
[
[
"file",
@@ -181,6 +167,13 @@
],
"6287f825b427f4a4ada5cc5a99c2d0a3379a7c59cea474653e22129df7d2ad39"
],
+ [
+ [
+ "file",
+ "server/src/shared/.gitkeep"
+ ],
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
+ ],
[
[
"file",
@@ -275,23 +268,23 @@
[
[
"file",
- "web-app/src/ext-src/Main.css"
+ "web-app/src/ext-src/.gitkeep"
],
- "1583ce49887ea575e563dab0c7ad6d2e2e3e6a351ed7c2f80c310641b1456417"
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
],
[
[
"file",
- "web-app/src/ext-src/MainPage.js"
+ "web-app/src/ext-src/Main.css"
],
- "c9ed9b5271f648715373095f43d60a2ab3e47f159c6dd6f3337ed22e5b73e80c"
+ "1583ce49887ea575e563dab0c7ad6d2e2e3e6a351ed7c2f80c310641b1456417"
],
[
[
"file",
- "web-app/src/ext-src/jobs/bar.js"
+ "web-app/src/ext-src/MainPage.js"
],
- "2e126f35b3a3e9a289e0dcfd8707fe903c6a053e0cf85899fb5f686d77dd3eb5"
+ "c9ed9b5271f648715373095f43d60a2ab3e47f159c6dd6f3337ed22e5b73e80c"
],
[
[
@@ -370,6 +363,13 @@
],
"0b097cb6e2c83821630a33de933893bf75de49731b18ce3c25fc5384866fbac0"
],
+ [
+ [
+ "file",
+ "web-app/src/shared/.gitkeep"
+ ],
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
+ ],
[
[
"file",
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/server/src/ext-src/.gitkeep b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/server/src/ext-src/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/server/src/ext-src/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/server/src/shared/.gitkeep b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/server/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/server/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/web-app/src/ext-src/.gitkeep b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/web-app/src/ext-src/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/web-app/src/ext-src/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/web-app/src/shared/.gitkeep b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/web-app/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/web-app/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasproot b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasproot
index 3caa053db5..ca2cfdb482 100644
--- a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasproot
+++ b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasproot
@@ -1 +1 @@
-File marking the root of Wasp project.
\ No newline at end of file
+File marking the root of Wasp project.
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/ext/Main.css b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/ext/Main.css
deleted file mode 100644
index b6e7ed3f13..0000000000
--- a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/ext/Main.css
+++ /dev/null
@@ -1,89 +0,0 @@
-* {
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- box-sizing: border-box;
-}
-
-body {
- margin: 0;
- padding: 0;
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
- "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
- sans-serif;
-}
-
-.container {
- min-height: 100vh;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-main {
- padding: 5rem 0;
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-main p {
- font-size: 1.2rem;
-}
-
-.logo {
- margin-bottom: 2rem;
-}
-
-.logo img {
- max-height: 200px;
-}
-
-.welcome-title {
- font-weight: 500;
-}
-
-.welcome-subtitle {
- font-weight: 400;
- margin-bottom: 3rem;
-}
-
-.buttons {
- display: flex;
- flex-direction: row;
-}
-
-.buttons .button:not(:last-child) {
- margin-right: 0.5rem;
-}
-
-.button {
- border-radius: 3px;
- font-size: 1.2rem;
- padding: 1rem 2rem;
- text-align: center;
- font-weight: 700;
- text-decoration: none;
-}
-
-.button-filled {
- border: 2px solid #bf9900;
- background-color: #bf9900;
- color: #f4f4f4;
-}
-
-.button-outline {
- border: 2px solid #8a9cff;
- color: #8a9cff;
- background-color: none;
-}
-
-code {
- border-radius: 5px;
- padding: 0.2rem;
- background: #efefef;
- font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
- Bitstream Vera Sans Mono, Courier New, monospace;
-}
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/ext/MainPage.js b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/ext/MainPage.js
deleted file mode 100644
index 529a4f2860..0000000000
--- a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/ext/MainPage.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import React from 'react'
-import waspLogo from './waspLogo.png'
-import './Main.css'
-
-const MainPage = () => {
- return (
-
-
-
-
-
-
- Welcome to Wasp - you just started a new app!
-
- This is page MainPage
located at route /
.
- Open ext/MainPage.js
to edit it.
-
-
-
-
-
- )
-}
-export default MainPage
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/ext/jobs/bar.js b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/ext/jobs/bar.js
deleted file mode 100644
index f742d64747..0000000000
--- a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/ext/jobs/bar.js
+++ /dev/null
@@ -1,4 +0,0 @@
- export const foo = async (args) => {
- return 1
- }
-
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/ext/waspLogo.png b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/ext/waspLogo.png
deleted file mode 100644
index d39a9443a8..0000000000
Binary files a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/ext/waspLogo.png and /dev/null differ
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/main.wasp b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/main.wasp
index da739c9615..346854dd04 100644
--- a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/main.wasp
+++ b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/main.wasp
@@ -8,12 +8,12 @@ app waspJob {
route RootRoute { path: "/", to: MainPage }
page MainPage {
- component: import Main from "@ext/MainPage.js"
+ component: import Main from "@client/MainPage.js"
}
job MySpecialJob {
executor: PgBoss,
perform: {
- fn: import { foo } from "@ext/jobs/bar.js"
+ fn: import { foo } from "@server/jobs/bar.js"
}
}
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/ext/.waspignore b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/.waspignore
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/ext/.waspignore
rename to waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/.waspignore
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/client/.gitkeep b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/client/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/client/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/server/src/ext-src/Main.css b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/client/Main.css
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/server/src/ext-src/Main.css
rename to waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/client/Main.css
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/server/src/ext-src/MainPage.js b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/client/MainPage.js
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/server/src/ext-src/MainPage.js
rename to waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/client/MainPage.js
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/server/src/ext-src/waspLogo.png b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/client/waspLogo.png
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/server/src/ext-src/waspLogo.png
rename to waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/client/waspLogo.png
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/server/.gitkeep b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/server/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/server/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/web-app/src/ext-src/jobs/bar.js b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/server/jobs/bar.js
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/web-app/src/ext-src/jobs/bar.js
rename to waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/server/jobs/bar.js
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/shared/.gitkeep b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/files.manifest b/waspc/e2e-test/test-outputs/waspMigrate-golden/files.manifest
index c463556c5e..d36a82b0c4 100644
--- a/waspc/e2e-test/test-outputs/waspMigrate-golden/files.manifest
+++ b/waspc/e2e-test/test-outputs/waspMigrate-golden/files.manifest
@@ -16,9 +16,7 @@ waspMigrate/.wasp/out/server/src/config.js
waspMigrate/.wasp/out/server/src/core/AuthError.js
waspMigrate/.wasp/out/server/src/core/HttpError.js
waspMigrate/.wasp/out/server/src/dbClient.js
-waspMigrate/.wasp/out/server/src/ext-src/Main.css
-waspMigrate/.wasp/out/server/src/ext-src/MainPage.js
-waspMigrate/.wasp/out/server/src/ext-src/waspLogo.png
+waspMigrate/.wasp/out/server/src/ext-src/.gitkeep
waspMigrate/.wasp/out/server/src/jobs/core/Job.js
waspMigrate/.wasp/out/server/src/jobs/core/SubmittedJob.js
waspMigrate/.wasp/out/server/src/jobs/core/allJobs.js
@@ -28,6 +26,7 @@ waspMigrate/.wasp/out/server/src/jobs/core/simpleJob.js
waspMigrate/.wasp/out/server/src/routes/index.js
waspMigrate/.wasp/out/server/src/routes/operations/index.js
waspMigrate/.wasp/out/server/src/server.js
+waspMigrate/.wasp/out/server/src/shared/.gitkeep
waspMigrate/.wasp/out/server/src/utils.js
waspMigrate/.wasp/out/web-app/.npmrc
waspMigrate/.wasp/out/web-app/README.md
@@ -40,6 +39,7 @@ waspMigrate/.wasp/out/web-app/src/actions/core.js
waspMigrate/.wasp/out/web-app/src/actions/index.js
waspMigrate/.wasp/out/web-app/src/api.js
waspMigrate/.wasp/out/web-app/src/config.js
+waspMigrate/.wasp/out/web-app/src/ext-src/.gitkeep
waspMigrate/.wasp/out/web-app/src/ext-src/Main.css
waspMigrate/.wasp/out/web-app/src/ext-src/MainPage.js
waspMigrate/.wasp/out/web-app/src/ext-src/waspLogo.png
@@ -53,12 +53,16 @@ waspMigrate/.wasp/out/web-app/src/queries/index.js
waspMigrate/.wasp/out/web-app/src/queryClient.js
waspMigrate/.wasp/out/web-app/src/router.js
waspMigrate/.wasp/out/web-app/src/serviceWorker.js
+waspMigrate/.wasp/out/web-app/src/shared/.gitkeep
waspMigrate/.wasp/out/web-app/src/utils.js
waspMigrate/.wasproot
-waspMigrate/ext/.waspignore
-waspMigrate/ext/Main.css
-waspMigrate/ext/MainPage.js
-waspMigrate/ext/waspLogo.png
waspMigrate/main.wasp
waspMigrate/migrations/migration_lock.toml
waspMigrate/migrations/no-date-foo/migration.sql
+waspMigrate/src/.waspignore
+waspMigrate/src/client/.gitkeep
+waspMigrate/src/client/Main.css
+waspMigrate/src/client/MainPage.js
+waspMigrate/src/client/waspLogo.png
+waspMigrate/src/server/.gitkeep
+waspMigrate/src/shared/.gitkeep
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/.waspchecksums b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/.waspchecksums
index e03c33048d..119df4e70e 100644
--- a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/.waspchecksums
+++ b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/.waspchecksums
@@ -86,23 +86,9 @@
[
[
"file",
- "server/src/ext-src/Main.css"
+ "server/src/ext-src/.gitkeep"
],
- "1583ce49887ea575e563dab0c7ad6d2e2e3e6a351ed7c2f80c310641b1456417"
- ],
- [
- [
- "file",
- "server/src/ext-src/MainPage.js"
- ],
- "c9ed9b5271f648715373095f43d60a2ab3e47f159c6dd6f3337ed22e5b73e80c"
- ],
- [
- [
- "file",
- "server/src/ext-src/waspLogo.png"
- ],
- "0f05a89eb945d6d7326110e88776e402833b356202b06d0a8bf652e118d3fd2f"
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
],
[
[
@@ -167,6 +153,13 @@
],
"e19bdae598265cbe2457ff1e2d8524aa821666482cb7d21644e290a68daf94a5"
],
+ [
+ [
+ "file",
+ "server/src/shared/.gitkeep"
+ ],
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
+ ],
[
[
"file",
@@ -258,6 +251,13 @@
],
"a30d5ae7c1b317a7132cac93f4b5bffc3daf11f4f07b5e0d977d063810ffdd11"
],
+ [
+ [
+ "file",
+ "web-app/src/ext-src/.gitkeep"
+ ],
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
+ ],
[
[
"file",
@@ -349,6 +349,13 @@
],
"0b097cb6e2c83821630a33de933893bf75de49731b18ce3c25fc5384866fbac0"
],
+ [
+ [
+ "file",
+ "web-app/src/shared/.gitkeep"
+ ],
+ "3c93961ee5013ddc0149b57c9eb7b469aea5f3cb197429bded0d20498a267b06"
+ ],
[
[
"file",
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/ext-src/.gitkeep b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/ext-src/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/ext-src/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/ext-src/Main.css b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/ext-src/Main.css
deleted file mode 100644
index b6e7ed3f13..0000000000
--- a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/ext-src/Main.css
+++ /dev/null
@@ -1,89 +0,0 @@
-* {
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- box-sizing: border-box;
-}
-
-body {
- margin: 0;
- padding: 0;
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
- "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
- sans-serif;
-}
-
-.container {
- min-height: 100vh;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-main {
- padding: 5rem 0;
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-main p {
- font-size: 1.2rem;
-}
-
-.logo {
- margin-bottom: 2rem;
-}
-
-.logo img {
- max-height: 200px;
-}
-
-.welcome-title {
- font-weight: 500;
-}
-
-.welcome-subtitle {
- font-weight: 400;
- margin-bottom: 3rem;
-}
-
-.buttons {
- display: flex;
- flex-direction: row;
-}
-
-.buttons .button:not(:last-child) {
- margin-right: 0.5rem;
-}
-
-.button {
- border-radius: 3px;
- font-size: 1.2rem;
- padding: 1rem 2rem;
- text-align: center;
- font-weight: 700;
- text-decoration: none;
-}
-
-.button-filled {
- border: 2px solid #bf9900;
- background-color: #bf9900;
- color: #f4f4f4;
-}
-
-.button-outline {
- border: 2px solid #8a9cff;
- color: #8a9cff;
- background-color: none;
-}
-
-code {
- border-radius: 5px;
- padding: 0.2rem;
- background: #efefef;
- font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
- Bitstream Vera Sans Mono, Courier New, monospace;
-}
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/ext-src/MainPage.js b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/ext-src/MainPage.js
deleted file mode 100644
index 529a4f2860..0000000000
--- a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/ext-src/MainPage.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import React from 'react'
-import waspLogo from './waspLogo.png'
-import './Main.css'
-
-const MainPage = () => {
- return (
-
-
-
-
-
-
- Welcome to Wasp - you just started a new app!
-
- This is page MainPage
located at route /
.
- Open ext/MainPage.js
to edit it.
-
-
-
-
-
- )
-}
-export default MainPage
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/ext-src/waspLogo.png b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/ext-src/waspLogo.png
deleted file mode 100644
index d39a9443a8..0000000000
Binary files a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/ext-src/waspLogo.png and /dev/null differ
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/shared/.gitkeep b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/server/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/web-app/src/ext-src/.gitkeep b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/web-app/src/ext-src/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/web-app/src/ext-src/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/web-app/src/shared/.gitkeep b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/web-app/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/web-app/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasproot b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasproot
index 3caa053db5..ca2cfdb482 100644
--- a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasproot
+++ b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasproot
@@ -1 +1 @@
-File marking the root of Wasp project.
\ No newline at end of file
+File marking the root of Wasp project.
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/ext/Main.css b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/ext/Main.css
deleted file mode 100644
index b6e7ed3f13..0000000000
--- a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/ext/Main.css
+++ /dev/null
@@ -1,89 +0,0 @@
-* {
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- box-sizing: border-box;
-}
-
-body {
- margin: 0;
- padding: 0;
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
- "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
- sans-serif;
-}
-
-.container {
- min-height: 100vh;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-main {
- padding: 5rem 0;
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-main p {
- font-size: 1.2rem;
-}
-
-.logo {
- margin-bottom: 2rem;
-}
-
-.logo img {
- max-height: 200px;
-}
-
-.welcome-title {
- font-weight: 500;
-}
-
-.welcome-subtitle {
- font-weight: 400;
- margin-bottom: 3rem;
-}
-
-.buttons {
- display: flex;
- flex-direction: row;
-}
-
-.buttons .button:not(:last-child) {
- margin-right: 0.5rem;
-}
-
-.button {
- border-radius: 3px;
- font-size: 1.2rem;
- padding: 1rem 2rem;
- text-align: center;
- font-weight: 700;
- text-decoration: none;
-}
-
-.button-filled {
- border: 2px solid #bf9900;
- background-color: #bf9900;
- color: #f4f4f4;
-}
-
-.button-outline {
- border: 2px solid #8a9cff;
- color: #8a9cff;
- background-color: none;
-}
-
-code {
- border-radius: 5px;
- padding: 0.2rem;
- background: #efefef;
- font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
- Bitstream Vera Sans Mono, Courier New, monospace;
-}
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/ext/MainPage.js b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/ext/MainPage.js
deleted file mode 100644
index 529a4f2860..0000000000
--- a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/ext/MainPage.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import React from 'react'
-import waspLogo from './waspLogo.png'
-import './Main.css'
-
-const MainPage = () => {
- return (
-
-
-
-
-
-
- Welcome to Wasp - you just started a new app!
-
- This is page MainPage
located at route /
.
- Open ext/MainPage.js
to edit it.
-
-
-
-
-
- )
-}
-export default MainPage
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/ext/waspLogo.png b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/ext/waspLogo.png
deleted file mode 100644
index d39a9443a8..0000000000
Binary files a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/ext/waspLogo.png and /dev/null differ
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/main.wasp b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/main.wasp
index 2a91066116..b5de396e50 100644
--- a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/main.wasp
+++ b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/main.wasp
@@ -7,7 +7,7 @@ app waspMigrate {
route RootRoute { path: "/", to: MainPage }
page MainPage {
- component: import Main from "@ext/MainPage.js"
+ component: import Main from "@client/MainPage.js"
}
entity Task {=psl
id Int @id @default(autoincrement())
diff --git a/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/ext/.waspignore b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/.waspignore
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspNew-golden/waspNew/ext/.waspignore
rename to waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/.waspignore
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/client/.gitkeep b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/client/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/client/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/ext/Main.css b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/client/Main.css
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/ext/Main.css
rename to waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/client/Main.css
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/ext/MainPage.js b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/client/MainPage.js
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/ext/MainPage.js
rename to waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/client/MainPage.js
diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/ext/waspLogo.png b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/client/waspLogo.png
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/ext/waspLogo.png
rename to waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/client/waspLogo.png
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/server/.gitkeep b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/server/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/server/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/shared/.gitkeep b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspNew-golden/files.manifest b/waspc/e2e-test/test-outputs/waspNew-golden/files.manifest
index d20fb91970..0955538620 100644
--- a/waspc/e2e-test/test-outputs/waspNew-golden/files.manifest
+++ b/waspc/e2e-test/test-outputs/waspNew-golden/files.manifest
@@ -1,6 +1,9 @@
waspNew/.wasproot
-waspNew/ext/.waspignore
-waspNew/ext/Main.css
-waspNew/ext/MainPage.js
-waspNew/ext/waspLogo.png
waspNew/main.wasp
+waspNew/src/.waspignore
+waspNew/src/client/.gitkeep
+waspNew/src/client/Main.css
+waspNew/src/client/MainPage.js
+waspNew/src/client/waspLogo.png
+waspNew/src/server/.gitkeep
+waspNew/src/shared/.gitkeep
diff --git a/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/.wasproot b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/.wasproot
index 3caa053db5..ca2cfdb482 100644
--- a/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/.wasproot
+++ b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/.wasproot
@@ -1 +1 @@
-File marking the root of Wasp project.
\ No newline at end of file
+File marking the root of Wasp project.
diff --git a/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/ext/Main.css b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/ext/Main.css
deleted file mode 100644
index b6e7ed3f13..0000000000
--- a/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/ext/Main.css
+++ /dev/null
@@ -1,89 +0,0 @@
-* {
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- box-sizing: border-box;
-}
-
-body {
- margin: 0;
- padding: 0;
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
- "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
- sans-serif;
-}
-
-.container {
- min-height: 100vh;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-main {
- padding: 5rem 0;
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-main p {
- font-size: 1.2rem;
-}
-
-.logo {
- margin-bottom: 2rem;
-}
-
-.logo img {
- max-height: 200px;
-}
-
-.welcome-title {
- font-weight: 500;
-}
-
-.welcome-subtitle {
- font-weight: 400;
- margin-bottom: 3rem;
-}
-
-.buttons {
- display: flex;
- flex-direction: row;
-}
-
-.buttons .button:not(:last-child) {
- margin-right: 0.5rem;
-}
-
-.button {
- border-radius: 3px;
- font-size: 1.2rem;
- padding: 1rem 2rem;
- text-align: center;
- font-weight: 700;
- text-decoration: none;
-}
-
-.button-filled {
- border: 2px solid #bf9900;
- background-color: #bf9900;
- color: #f4f4f4;
-}
-
-.button-outline {
- border: 2px solid #8a9cff;
- color: #8a9cff;
- background-color: none;
-}
-
-code {
- border-radius: 5px;
- padding: 0.2rem;
- background: #efefef;
- font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
- Bitstream Vera Sans Mono, Courier New, monospace;
-}
diff --git a/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/ext/MainPage.js b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/ext/MainPage.js
deleted file mode 100644
index 529a4f2860..0000000000
--- a/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/ext/MainPage.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import React from 'react'
-import waspLogo from './waspLogo.png'
-import './Main.css'
-
-const MainPage = () => {
- return (
-
-
-
-
-
-
- Welcome to Wasp - you just started a new app!
-
- This is page MainPage
located at route /
.
- Open ext/MainPage.js
to edit it.
-
-
-
-
-
- )
-}
-export default MainPage
diff --git a/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/ext/waspLogo.png b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/ext/waspLogo.png
deleted file mode 100644
index d39a9443a8..0000000000
Binary files a/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/ext/waspLogo.png and /dev/null differ
diff --git a/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/main.wasp b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/main.wasp
index 711459104f..ce5e5d9ead 100644
--- a/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/main.wasp
+++ b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/main.wasp
@@ -7,5 +7,5 @@ app waspNew {
route RootRoute { path: "/", to: MainPage }
page MainPage {
- component: import Main from "@ext/MainPage.js"
+ component: import Main from "@client/MainPage.js"
}
diff --git a/waspc/examples/todoApp/ext/.waspignore b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/.waspignore
similarity index 100%
rename from waspc/examples/todoApp/ext/.waspignore
rename to waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/.waspignore
diff --git a/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/client/.gitkeep b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/client/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/client/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/server/src/ext-src/Main.css b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/client/Main.css
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/server/src/ext-src/Main.css
rename to waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/client/Main.css
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/server/src/ext-src/MainPage.js b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/client/MainPage.js
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/server/src/ext-src/MainPage.js
rename to waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/client/MainPage.js
diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/server/src/ext-src/waspLogo.png b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/client/waspLogo.png
similarity index 100%
rename from waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/server/src/ext-src/waspLogo.png
rename to waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/client/waspLogo.png
diff --git a/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/server/.gitkeep b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/server/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/server/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/shared/.gitkeep b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/e2e-test/test-outputs/waspNew-golden/waspNew/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/examples/todoApp/.gitignore b/waspc/examples/todoApp/.gitignore
index d319a97e82..c51177f6dc 100644
--- a/waspc/examples/todoApp/.gitignore
+++ b/waspc/examples/todoApp/.gitignore
@@ -1,4 +1,3 @@
/.wasp/
-.env
-.env.server
-.env.client
\ No newline at end of file
+/.env.server
+/.env.client
diff --git a/waspc/examples/todoApp/.wasproot b/waspc/examples/todoApp/.wasproot
index 3caa053db5..ca2cfdb482 100644
--- a/waspc/examples/todoApp/.wasproot
+++ b/waspc/examples/todoApp/.wasproot
@@ -1 +1 @@
-File marking the root of Wasp project.
\ No newline at end of file
+File marking the root of Wasp project.
diff --git a/waspc/examples/todoApp/src/.waspignore b/waspc/examples/todoApp/src/.waspignore
new file mode 100644
index 0000000000..1c432f30d9
--- /dev/null
+++ b/waspc/examples/todoApp/src/.waspignore
@@ -0,0 +1,3 @@
+# Ignore editor tmp files
+**/*~
+**/#*#
diff --git a/waspc/examples/todoApp/src/client/.gitkeep b/waspc/examples/todoApp/src/client/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/examples/todoApp/src/client/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/examples/todoApp/ext/Main.css b/waspc/examples/todoApp/src/client/Main.css
similarity index 100%
rename from waspc/examples/todoApp/ext/Main.css
rename to waspc/examples/todoApp/src/client/Main.css
diff --git a/waspc/examples/todoApp/ext/Todo.js b/waspc/examples/todoApp/src/client/Todo.js
similarity index 100%
rename from waspc/examples/todoApp/ext/Todo.js
rename to waspc/examples/todoApp/src/client/Todo.js
diff --git a/waspc/examples/todoApp/ext/clientSetup.js b/waspc/examples/todoApp/src/client/clientSetup.js
similarity index 66%
rename from waspc/examples/todoApp/ext/clientSetup.js
rename to waspc/examples/todoApp/src/client/clientSetup.js
index d966d22d5e..827b0afad1 100644
--- a/waspc/examples/todoApp/ext/clientSetup.js
+++ b/waspc/examples/todoApp/src/client/clientSetup.js
@@ -1,3 +1,6 @@
+import { sayHi } from '../shared/util'
+
export default function setup() {
console.log("This was called from the client setup function")
+ sayHi()
}
diff --git a/waspc/examples/todoApp/ext/pages/About.js b/waspc/examples/todoApp/src/client/pages/About.js
similarity index 100%
rename from waspc/examples/todoApp/ext/pages/About.js
rename to waspc/examples/todoApp/src/client/pages/About.js
diff --git a/waspc/examples/todoApp/ext/pages/Main.js b/waspc/examples/todoApp/src/client/pages/Main.js
similarity index 100%
rename from waspc/examples/todoApp/ext/pages/Main.js
rename to waspc/examples/todoApp/src/client/pages/Main.js
diff --git a/waspc/examples/todoApp/ext/pages/ProfilePage.js b/waspc/examples/todoApp/src/client/pages/ProfilePage.js
similarity index 100%
rename from waspc/examples/todoApp/ext/pages/ProfilePage.js
rename to waspc/examples/todoApp/src/client/pages/ProfilePage.js
diff --git a/waspc/examples/todoApp/ext/pages/Task.js b/waspc/examples/todoApp/src/client/pages/Task.js
similarity index 100%
rename from waspc/examples/todoApp/ext/pages/Task.js
rename to waspc/examples/todoApp/src/client/pages/Task.js
diff --git a/waspc/examples/todoApp/ext/pages/auth/Login.js b/waspc/examples/todoApp/src/client/pages/auth/Login.js
similarity index 100%
rename from waspc/examples/todoApp/ext/pages/auth/Login.js
rename to waspc/examples/todoApp/src/client/pages/auth/Login.js
diff --git a/waspc/examples/todoApp/ext/pages/auth/Signup.js b/waspc/examples/todoApp/src/client/pages/auth/Signup.js
similarity index 100%
rename from waspc/examples/todoApp/ext/pages/auth/Signup.js
rename to waspc/examples/todoApp/src/client/pages/auth/Signup.js
diff --git a/waspc/examples/todoApp/src/server/.gitkeep b/waspc/examples/todoApp/src/server/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/examples/todoApp/src/server/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/examples/todoApp/ext/actions.js b/waspc/examples/todoApp/src/server/actions.js
similarity index 100%
rename from waspc/examples/todoApp/ext/actions.js
rename to waspc/examples/todoApp/src/server/actions.js
diff --git a/waspc/examples/todoApp/ext/auth/google.js b/waspc/examples/todoApp/src/server/auth/google.js
similarity index 100%
rename from waspc/examples/todoApp/ext/auth/google.js
rename to waspc/examples/todoApp/src/server/auth/google.js
diff --git a/waspc/examples/todoApp/ext/jobs/bar.js b/waspc/examples/todoApp/src/server/jobs/bar.js
similarity index 100%
rename from waspc/examples/todoApp/ext/jobs/bar.js
rename to waspc/examples/todoApp/src/server/jobs/bar.js
diff --git a/waspc/examples/todoApp/ext/queries.js b/waspc/examples/todoApp/src/server/queries.js
similarity index 100%
rename from waspc/examples/todoApp/ext/queries.js
rename to waspc/examples/todoApp/src/server/queries.js
diff --git a/waspc/examples/todoApp/ext/serverSetup.js b/waspc/examples/todoApp/src/server/serverSetup.js
similarity index 93%
rename from waspc/examples/todoApp/ext/serverSetup.js
rename to waspc/examples/todoApp/src/server/serverSetup.js
index 9aecb64551..5eabe9b961 100644
--- a/waspc/examples/todoApp/ext/serverSetup.js
+++ b/waspc/examples/todoApp/src/server/serverSetup.js
@@ -1,10 +1,12 @@
import { mySpecialJob } from '@wasp/jobs/mySpecialJob.js'
+import { sayHi } from '../shared/util.js'
let someResource = undefined
export const getSomeResource = () => someResource
const setup = async () => {
+ sayHi()
await new Promise(resolve => setTimeout(resolve, 2000))
someResource = 'This resource is now set up.'
console.log('Custom server setup done!')
diff --git a/waspc/examples/todoApp/src/shared/.gitkeep b/waspc/examples/todoApp/src/shared/.gitkeep
new file mode 100644
index 0000000000..878bca16e5
--- /dev/null
+++ b/waspc/examples/todoApp/src/shared/.gitkeep
@@ -0,0 +1 @@
+This file forces Git to commit an empty directory.
diff --git a/waspc/examples/todoApp/src/shared/util.js b/waspc/examples/todoApp/src/shared/util.js
new file mode 100644
index 0000000000..76de186600
--- /dev/null
+++ b/waspc/examples/todoApp/src/shared/util.js
@@ -0,0 +1,3 @@
+export function sayHi() {
+ console.log("This is coming from shared function.")
+}
diff --git a/waspc/examples/todoApp/todoApp.wasp b/waspc/examples/todoApp/todoApp.wasp
index 0198da848b..deff2d1a3f 100644
--- a/waspc/examples/todoApp/todoApp.wasp
+++ b/waspc/examples/todoApp/todoApp.wasp
@@ -14,18 +14,18 @@ app todoApp {
methods: {
usernameAndPassword: {},
// google: {
- // configFn: import { config } from "@ext/auth/google.js",
- // getUserFieldsFn: import { getUserFields } from "@ext/auth/google.js"
+ // configFn: import { config } from "@server/auth/google.js",
+ // getUserFieldsFn: import { getUserFields } from "@server/auth/google.js"
// }
},
onAuthFailedRedirectTo: "/login",
onAuthSucceededRedirectTo: "/profile"
},
server: {
- setupFn: import setup from "@ext/serverSetup.js"
+ setupFn: import setup from "@server/serverSetup.js"
},
client: {
- setupFn: import setup from "@ext/clientSetup.js"
+ setupFn: import setup from "@client/clientSetup.js"
},
db: {
system: PostgreSQL
@@ -60,29 +60,29 @@ psl=}
route SignupRoute { path: "/signup", to: SignupPage }
page SignupPage {
- component: import Signup from "@ext/pages/auth/Signup"
+ component: import Signup from "@client/pages/auth/Signup"
}
route LoginRoute { path: "/login", to: LoginPage }
page LoginPage {
- component: import Login from "@ext/pages/auth/Login"
+ component: import Login from "@client/pages/auth/Login"
}
route HomeRoute { path: "/", to: MainPage }
page MainPage {
authRequired: true,
- component: import Main from "@ext/pages/Main"
+ component: import Main from "@client/pages/Main"
}
route AboutRoute { path: "/about", to: AboutPage }
page AboutPage {
- component: import About from "@ext/pages/About"
+ component: import About from "@client/pages/About"
}
route ProfileRoute { path: "/profile", to: ProfilePage }
page ProfilePage {
authRequired: true,
- component: import { ProfilePage } from "@ext/pages/ProfilePage"
+ component: import { ProfilePage } from "@client/pages/ProfilePage"
}
// Page for viewing a specific task
@@ -90,53 +90,53 @@ page ProfilePage {
route TaskRoute { path: "/task/:id", to: TaskPage }
page TaskPage {
authRequired: true,
- component: import Task from "@ext/pages/Task"
+ component: import Task from "@client/pages/Task"
}
// --------- Queries --------- //
query getTasks {
- fn: import { getTasks } from "@ext/queries.js",
+ fn: import { getTasks } from "@server/queries.js",
entities: [Task]
}
query getNumTasks {
- fn: import { getNumTasks } from "@ext/queries.js",
+ fn: import { getNumTasks } from "@server/queries.js",
entities: [Task],
auth: false
}
query getTask {
- fn: import { getTask } from "@ext/queries.js",
+ fn: import { getTask } from "@server/queries.js",
entities: [Task]
}
// --------- Actions --------- //
action createTask {
- fn: import { createTask } from "@ext/actions.js",
+ fn: import { createTask } from "@server/actions.js",
entities: [Task]
}
action updateTaskIsDone {
- fn: import { updateTaskIsDone } from "@ext/actions.js",
+ fn: import { updateTaskIsDone } from "@server/actions.js",
entities: [Task]
}
action deleteCompletedTasks {
- fn: import { deleteCompletedTasks } from "@ext/actions.js",
+ fn: import { deleteCompletedTasks } from "@server/actions.js",
entities: [Task]
}
action toggleAllTasks {
- fn: import { toggleAllTasks } from "@ext/actions.js",
+ fn: import { toggleAllTasks } from "@server/actions.js",
entities: [Task]
}
job mySpecialJob {
executor: PgBoss,
perform: {
- fn: import { foo } from "@ext/jobs/bar.js",
+ fn: import { foo } from "@server/jobs/bar.js",
executorOptions: {
pgBoss: {=json { "retryLimit": 1 } json=}
}
@@ -147,7 +147,7 @@ job mySpecialJob {
job mySpecialScheduledJob {
executor: PgBoss,
perform: {
- fn: import { foo } from "@ext/jobs/bar.js"
+ fn: import { foo } from "@server/jobs/bar.js"
},
schedule: {
cron: "0 * * * *",
diff --git a/waspc/src/Wasp/Analyzer/Evaluator/Evaluation/TypedExpr/Combinators.hs b/waspc/src/Wasp/Analyzer/Evaluator/Evaluation/TypedExpr/Combinators.hs
index 5bdbbeca06..e0da203357 100644
--- a/waspc/src/Wasp/Analyzer/Evaluator/Evaluation/TypedExpr/Combinators.hs
+++ b/waspc/src/Wasp/Analyzer/Evaluator/Evaluation/TypedExpr/Combinators.hs
@@ -17,6 +17,7 @@ module Wasp.Analyzer.Evaluator.Evaluation.TypedExpr.Combinators
)
where
+import Control.Applicative ((<|>))
import Control.Arrow (left)
import qualified Data.Aeson as Aeson
import qualified Data.ByteString.Lazy.UTF8 as ByteStringLazyUTF8
@@ -155,24 +156,26 @@ tuple4 eval1 eval2 eval3 eval4 = evaluation $ \(typeDefs, bindings) -> withCtx $
-- | An evaluation that expects an "ExtImport".
extImport :: TypedExprEvaluation AppSpec.ExtImport.ExtImport
extImport = evaluation' . withCtx $ \ctx -> \case
- TypedAST.ExtImport name extFileFP ->
+ TypedAST.ExtImport name extImportPath ->
-- NOTE(martin): This parsing here could instead be done in Parser.
-- I don't have a very good reason for doing it here instead of Parser, except
-- for being somewhat simpler to implement.
-- So we might want to move it to Parser at some point in the future, if we
-- figure out that is better (it sounds/feels like it could be).
- case stripPrefix extPrefix extFileFP of
+ case stripImportPrefix extImportPath of
Just relFileFP -> case SP.parseRelFileP relFileFP of
- Left err -> Left $ ER.mkEvaluationError ctx $ ER.ParseError $ ER.EvaluationParseError $ show err
+ Left err -> mkParseError ctx $ show err
Right relFileSP -> pure $ AppSpec.ExtImport.ExtImport name relFileSP
Nothing ->
- Left $
- ER.mkEvaluationError ctx $
- ER.ParseError $
- ER.EvaluationParseError $ "Path in external import must start with \"" ++ extPrefix ++ "\"!"
+ mkParseError
+ ctx
+ $ "Path in external import must start with \"" ++ serverPrefix ++ "\"" ++ " or \"" ++ clientPrefix ++ "\"!"
expr -> Left $ ER.mkEvaluationError ctx $ ER.ExpectedType T.ExtImportType (TypedAST.exprType expr)
where
- extPrefix = "@ext/"
+ mkParseError ctx msg = Left $ ER.mkEvaluationError ctx $ ER.ParseError $ ER.EvaluationParseError msg
+ stripImportPrefix importPath = stripPrefix serverPrefix importPath <|> stripPrefix clientPrefix importPath
+ serverPrefix = "@server/"
+ clientPrefix = "@client/"
-- | An evaluation that expects a "JSON".
json :: TypedExprEvaluation AppSpec.JSON.JSON
diff --git a/waspc/src/Wasp/AppSpec.hs b/waspc/src/Wasp/AppSpec.hs
index 187835fe14..0a8cdf60a3 100644
--- a/waspc/src/Wasp/AppSpec.hs
+++ b/waspc/src/Wasp/AppSpec.hs
@@ -42,11 +42,13 @@ data AppSpec = AppSpec
decls :: [Decl],
-- | Absolute path to the directory containing the wasp project.
waspProjectDir :: Path' Abs (Dir WaspProjectDir),
- -- | List of external code files (they are referenced/used by the declarations).
- externalCodeFiles :: [ExternalCode.File],
+ -- | List of external server code files (they are referenced/used in the declarations).
+ externalServerFiles :: [ExternalCode.File],
+ -- | List of external client code files (they are referenced/used in the declarations).
+ externalClientFiles :: [ExternalCode.File],
+ -- | List of files with external code shared between the server and the client.
+ externalSharedFiles :: [ExternalCode.File],
-- | Absolute path to the directory in wasp project source that contains external code files.
- externalCodeDirPath :: !(Path' Abs (Dir ExternalCode.SourceExternalCodeDir)),
- -- | Absolute path to the directory in wasp project source that contains database migrations.
migrationsDir :: Maybe (Path' Abs (Dir DbMigrationsDir)),
-- | Absolute path to the .env.server file in wasp project source. It contains env variables to be
-- provided to the server only during the development.
diff --git a/waspc/src/Wasp/CompileOptions.hs b/waspc/src/Wasp/CompileOptions.hs
index 3624c24183..d0174cd9b7 100644
--- a/waspc/src/Wasp/CompileOptions.hs
+++ b/waspc/src/Wasp/CompileOptions.hs
@@ -12,7 +12,9 @@ import Wasp.Message (SendMessage)
-- It would be easier to pass around if it is part of Wasp data. But is it semantically correct?
-- Maybe it is, even more than this!
data CompileOptions = CompileOptions
- { externalCodeDirPath :: !(Path' Abs (Dir SourceExternalCodeDir)),
+ { externalServerCodeDirPath :: !(Path' Abs (Dir SourceExternalCodeDir)),
+ externalClientCodeDirPath :: !(Path' Abs (Dir SourceExternalCodeDir)),
+ externalSharedCodeDirPath :: !(Path' Abs (Dir SourceExternalCodeDir)),
isBuild :: !Bool,
-- We give the compiler the ability to send messages. The code that
-- invokes the compiler (such as the CLI) can then implement a way
diff --git a/waspc/src/Wasp/Generator/JsImport.hs b/waspc/src/Wasp/Generator/JsImport.hs
index 260ed878c3..a4e1dfdaf2 100644
--- a/waspc/src/Wasp/Generator/JsImport.hs
+++ b/waspc/src/Wasp/Generator/JsImport.hs
@@ -10,7 +10,7 @@ import Wasp.Generator.ExternalCodeGenerator.Common (GeneratedExternalCodeDir)
getJsImportDetailsForExtFnImport ::
-- | Path to generated external code directory, relative to the directory in which file doing the importing is.
- Path Posix (Rel (Dir a)) (Dir GeneratedExternalCodeDir) ->
+ Path Posix (Rel a) (Dir GeneratedExternalCodeDir) ->
AS.ExtImport.ExtImport ->
-- | (importIdentifier, importStmt)
-- - importIdentifier -> Identifier via which you can access ext js function after you import it with importStmt.
diff --git a/waspc/src/Wasp/Generator/ServerGenerator.hs b/waspc/src/Wasp/Generator/ServerGenerator.hs
index 1f92117ce8..57e2e089d8 100644
--- a/waspc/src/Wasp/Generator/ServerGenerator.hs
+++ b/waspc/src/Wasp/Generator/ServerGenerator.hs
@@ -22,8 +22,8 @@ import StrongPath
Path',
Posix,
Rel,
+ relDirToPosix,
reldir,
- reldirP,
relfile,
(>),
)
@@ -47,7 +47,7 @@ import qualified Wasp.Generator.NpmDependencies as N
import Wasp.Generator.ServerGenerator.AuthG (genAuth)
import qualified Wasp.Generator.ServerGenerator.Common as C
import Wasp.Generator.ServerGenerator.ConfigG (genConfigFile)
-import qualified Wasp.Generator.ServerGenerator.ExternalCodeGenerator as ServerExternalCodeGenerator
+import Wasp.Generator.ServerGenerator.ExternalCodeGenerator (extServerCodeDirInServerSrcDir, extServerCodeGeneratorStrategy, extSharedCodeGeneratorStrategy)
import Wasp.Generator.ServerGenerator.JobGenerator (depsRequiredByJobs, genJobExecutors, genJobs)
import Wasp.Generator.ServerGenerator.OperationsG (genOperations)
import Wasp.Generator.ServerGenerator.OperationsRoutesG (genOperationsRoutes)
@@ -62,7 +62,8 @@ genServer spec =
genGitignore
]
<++> genSrcDir spec
- <++> genExternalCodeDir ServerExternalCodeGenerator.generatorStrategy (AS.externalCodeFiles spec)
+ <++> genExternalCodeDir extServerCodeGeneratorStrategy (AS.externalServerFiles spec)
+ <++> genExternalCodeDir extSharedCodeGeneratorStrategy (AS.externalSharedFiles spec)
<++> genDotEnv spec
<++> genJobs spec
<++> genJobExecutors
@@ -205,13 +206,12 @@ genServerJs spec =
)
where
maybeSetupJsFunction = AS.App.Server.setupFn =<< AS.App.server (snd $ getApp spec)
- maybeSetupJsFnImportDetails = getJsImportDetailsForExtFnImport relPosixPathFromSrcDirToExtSrcDir <$> maybeSetupJsFunction
+ maybeSetupJsFnImportDetails = getJsImportDetailsForExtFnImport extServerCodeDirInServerSrcDirP <$> maybeSetupJsFunction
(maybeSetupJsFnImportIdentifier, maybeSetupJsFnImportStmt) =
(fst <$> maybeSetupJsFnImportDetails, snd <$> maybeSetupJsFnImportDetails)
--- | TODO: Make this not hardcoded!
-relPosixPathFromSrcDirToExtSrcDir :: Path Posix (Rel (Dir C.ServerSrcDir)) (Dir GeneratedExternalCodeDir)
-relPosixPathFromSrcDirToExtSrcDir = [reldirP|./ext-src|]
+extServerCodeDirInServerSrcDirP :: Path Posix (Rel C.ServerSrcDir) (Dir GeneratedExternalCodeDir)
+extServerCodeDirInServerSrcDirP = fromJust $ relDirToPosix extServerCodeDirInServerSrcDir
genRoutesDir :: AppSpec -> Generator [FileDraft]
genRoutesDir spec =
diff --git a/waspc/src/Wasp/Generator/ServerGenerator/AuthG.hs b/waspc/src/Wasp/Generator/ServerGenerator/AuthG.hs
index c3a10fb783..e83040820b 100644
--- a/waspc/src/Wasp/Generator/ServerGenerator/AuthG.hs
+++ b/waspc/src/Wasp/Generator/ServerGenerator/AuthG.hs
@@ -4,7 +4,7 @@ module Wasp.Generator.ServerGenerator.AuthG
where
import Data.Aeson (object, (.=))
-import Data.Maybe (fromMaybe, isJust)
+import Data.Maybe (fromJust, fromMaybe, isJust)
import StrongPath
( Dir,
File',
@@ -28,6 +28,7 @@ import Wasp.Generator.FileDraft (FileDraft)
import Wasp.Generator.JsImport (getJsImportDetailsForExtFnImport)
import Wasp.Generator.Monad (Generator)
import qualified Wasp.Generator.ServerGenerator.Common as C
+import Wasp.Generator.ServerGenerator.ExternalCodeGenerator (extServerCodeDirInServerSrcDir)
import Wasp.Util ((<++>))
import qualified Wasp.Util as Util
@@ -209,9 +210,8 @@ genGoogleConfigJs auth = return $ C.mkTmplFdWithDstAndData tmplFile dstFile (Jus
maybeOnSignInFnImportDetails = getJsImportDetailsForExtFnImport relPosixPathFromGoogleAuthDirToExtSrcDir <$> maybeGetUserFieldsFn
(maybeOnSignInFnImportIdentifier, maybeOnSignInFnImportStmt) = (fst <$> maybeOnSignInFnImportDetails, snd <$> maybeOnSignInFnImportDetails)
--- | TODO: Make this not hardcoded!
relPosixPathFromGoogleAuthDirToExtSrcDir :: Path Posix (Rel (Dir C.ServerSrcDir)) (Dir GeneratedExternalCodeDir)
-relPosixPathFromGoogleAuthDirToExtSrcDir = [reldirP|../../../../ext-src|]
+relPosixPathFromGoogleAuthDirToExtSrcDir = [reldirP|../../../../|] > fromJust (SP.relDirToPosix extServerCodeDirInServerSrcDir)
getOnAuthSucceededRedirectToOrDefault :: AS.Auth.Auth -> String
getOnAuthSucceededRedirectToOrDefault auth = fromMaybe "/" (AS.Auth.onAuthSucceededRedirectTo auth)
diff --git a/waspc/src/Wasp/Generator/ServerGenerator/ExternalCodeGenerator.hs b/waspc/src/Wasp/Generator/ServerGenerator/ExternalCodeGenerator.hs
index c72ef6debb..a146410b2b 100644
--- a/waspc/src/Wasp/Generator/ServerGenerator/ExternalCodeGenerator.hs
+++ b/waspc/src/Wasp/Generator/ServerGenerator/ExternalCodeGenerator.hs
@@ -1,6 +1,7 @@
module Wasp.Generator.ServerGenerator.ExternalCodeGenerator
- ( extCodeDirInServerSrcDir,
- generatorStrategy,
+ ( extServerCodeGeneratorStrategy,
+ extServerCodeDirInServerSrcDir,
+ extSharedCodeGeneratorStrategy,
)
where
@@ -10,12 +11,24 @@ import Wasp.Generator.ExternalCodeGenerator.Common (ExternalCodeGeneratorStrateg
import Wasp.Generator.ExternalCodeGenerator.Js (resolveJsFileWaspImportsForExtCodeDir)
import qualified Wasp.Generator.ServerGenerator.Common as C
--- | Relative path to directory where external code will be generated.
-extCodeDirInServerSrcDir :: Path' (Rel C.ServerSrcDir) (Dir GeneratedExternalCodeDir)
-extCodeDirInServerSrcDir = [reldir|ext-src|]
+extServerCodeGeneratorStrategy :: ExternalCodeGeneratorStrategy
+extServerCodeGeneratorStrategy = mkExtCodeGeneratorStrategy extServerCodeDirInServerSrcDir
-generatorStrategy :: ExternalCodeGeneratorStrategy
-generatorStrategy =
+extSharedCodeGeneratorStrategy :: ExternalCodeGeneratorStrategy
+extSharedCodeGeneratorStrategy = mkExtCodeGeneratorStrategy extSharedCodeDirInServerSrcDir
+
+-- | Relative path to the directory where external server code will be generated.
+-- Relative to the server src dir.
+extServerCodeDirInServerSrcDir :: Path' (Rel C.ServerSrcDir) (Dir GeneratedExternalCodeDir)
+extServerCodeDirInServerSrcDir = [reldir|ext-src|]
+
+-- | Relative path to the directory where external shared code will be generated.
+-- Relative to the server src dir.
+extSharedCodeDirInServerSrcDir :: Path' (Rel C.ServerSrcDir) (Dir GeneratedExternalCodeDir)
+extSharedCodeDirInServerSrcDir = [reldir|shared|]
+
+mkExtCodeGeneratorStrategy :: Path' (Rel C.ServerSrcDir) (Dir GeneratedExternalCodeDir) -> ExternalCodeGeneratorStrategy
+mkExtCodeGeneratorStrategy extCodeDirInServerSrcDir =
ExternalCodeGeneratorStrategy
{ _resolveJsFileWaspImports = resolveJsFileWaspImportsForExtCodeDir (SP.castRel extCodeDirInServerSrcDir),
_extCodeDirInProjectRootDir =
diff --git a/waspc/src/Wasp/Generator/ServerGenerator/JobGenerator.hs b/waspc/src/Wasp/Generator/ServerGenerator/JobGenerator.hs
index b1abae19d9..8288ec812d 100644
--- a/waspc/src/Wasp/Generator/ServerGenerator/JobGenerator.hs
+++ b/waspc/src/Wasp/Generator/ServerGenerator/JobGenerator.hs
@@ -43,6 +43,7 @@ import Wasp.Generator.ServerGenerator.Common
srcDirInServerTemplatesDir,
)
import qualified Wasp.Generator.ServerGenerator.Common as C
+import Wasp.Generator.ServerGenerator.ExternalCodeGenerator (extServerCodeDirInServerSrcDir)
import qualified Wasp.SemanticVersion as SV
genJobs :: AppSpec -> Generator [FileDraft]
@@ -107,9 +108,8 @@ genAllJobImports spec =
[ "name" .= jobName
]
--- | TODO: Make this not hardcoded!
-relPosixPathFromJobFileToExtSrcDir :: Path Posix (Rel (Dir ServerSrcDir)) (Dir GeneratedExternalCodeDir)
-relPosixPathFromJobFileToExtSrcDir = [reldirP|../ext-src|]
+relPosixPathFromJobFileToExtSrcDir :: Path Posix (Rel ServerSrcDir) (Dir GeneratedExternalCodeDir)
+relPosixPathFromJobFileToExtSrcDir = [reldirP|../|] SP.> fromJust (SP.relDirToPosix extServerCodeDirInServerSrcDir)
genJobExecutors :: Generator [FileDraft]
genJobExecutors = return $ jobExecutorFds ++ jobExecutorHelperFds
diff --git a/waspc/src/Wasp/Generator/ServerGenerator/OperationsG.hs b/waspc/src/Wasp/Generator/ServerGenerator/OperationsG.hs
index 09f04bba7c..af9f1101c5 100644
--- a/waspc/src/Wasp/Generator/ServerGenerator/OperationsG.hs
+++ b/waspc/src/Wasp/Generator/ServerGenerator/OperationsG.hs
@@ -11,7 +11,7 @@ where
import Data.Aeson (object, (.=))
import qualified Data.Aeson as Aeson
import Data.Maybe (fromJust)
-import StrongPath (Dir, Dir', File', Path, Path', Posix, Rel, reldir, reldirP, relfile, (>))
+import StrongPath (Dir, Dir', File', Path, Path', Posix, Rel, relDirToPosix, reldir, reldirP, relfile, (>))
import qualified StrongPath as SP
import Wasp.AppSpec (AppSpec)
import qualified Wasp.AppSpec as AS
@@ -23,6 +23,7 @@ import Wasp.Generator.FileDraft (FileDraft)
import Wasp.Generator.JsImport (getJsImportDetailsForExtFnImport)
import Wasp.Generator.Monad (Generator)
import qualified Wasp.Generator.ServerGenerator.Common as C
+import Wasp.Generator.ServerGenerator.ExternalCodeGenerator (extServerCodeDirInServerSrcDir)
import Wasp.Util ((<++>))
genOperations :: AppSpec -> Generator [FileDraft]
@@ -70,9 +71,9 @@ operationFileInSrcDir :: AS.Operation.Operation -> Path' (Rel C.ServerSrcDir) Fi
operationFileInSrcDir (AS.Operation.QueryOp name _) = queryFileInSrcDir name
operationFileInSrcDir (AS.Operation.ActionOp name _) = actionFileInSrcDir name
--- | TODO: Make this not hardcoded!
relPosixPathFromOperationFileToExtSrcDir :: Path Posix (Rel Dir') (Dir GeneratedExternalCodeDir)
-relPosixPathFromOperationFileToExtSrcDir = [reldirP|../ext-src/|]
+relPosixPathFromOperationFileToExtSrcDir =
+ [reldirP|../|] > fromJust (relDirToPosix extServerCodeDirInServerSrcDir)
operationTmplData :: AS.Operation.Operation -> Aeson.Value
operationTmplData operation =
diff --git a/waspc/src/Wasp/Generator/WebAppGenerator.hs b/waspc/src/Wasp/Generator/WebAppGenerator.hs
index c1d80de000..f9272acc6c 100644
--- a/waspc/src/Wasp/Generator/WebAppGenerator.hs
+++ b/waspc/src/Wasp/Generator/WebAppGenerator.hs
@@ -6,7 +6,7 @@ where
import Data.Aeson (object, (.=))
import Data.List (intercalate)
-import Data.Maybe (fromMaybe, isJust)
+import Data.Maybe (fromJust, fromMaybe, isJust)
import StrongPath
( Dir,
File',
@@ -14,10 +14,10 @@ import StrongPath
Path',
Posix,
Rel,
+ relDirToPosix,
relfile,
(>),
)
-import StrongPath.TH (reldirP)
import Wasp.AppSpec (AppSpec)
import qualified Wasp.AppSpec as AS
import qualified Wasp.AppSpec.App as AS.App
@@ -35,7 +35,7 @@ import Wasp.Generator.Monad (Generator)
import qualified Wasp.Generator.NpmDependencies as N
import Wasp.Generator.WebAppGenerator.AuthG (genAuth)
import qualified Wasp.Generator.WebAppGenerator.Common as C
-import qualified Wasp.Generator.WebAppGenerator.ExternalCodeGenerator as WebAppExternalCodeGenerator
+import Wasp.Generator.WebAppGenerator.ExternalCodeGenerator (extClientCodeDirInWebAppSrcDir, extClientCodeGeneratorStrategy, extSharedCodeGeneratorStrategy)
import Wasp.Generator.WebAppGenerator.OperationsGenerator (genOperations)
import Wasp.Generator.WebAppGenerator.RouterGenerator (genRouter)
import Wasp.Util ((<++>))
@@ -51,7 +51,8 @@ genWebApp spec = do
]
<++> genPublicDir spec
<++> genSrcDir spec
- <++> genExternalCodeDir WebAppExternalCodeGenerator.generatorStrategy (AS.externalCodeFiles spec)
+ <++> genExternalCodeDir extClientCodeGeneratorStrategy (AS.externalClientFiles spec)
+ <++> genExternalCodeDir extSharedCodeGeneratorStrategy (AS.externalSharedFiles spec)
<++> genDotEnv spec
genDotEnv :: AppSpec -> Generator [FileDraft]
@@ -211,9 +212,9 @@ genIndexJs spec =
)
where
maybeSetupJsFunction = AS.App.Client.setupFn =<< AS.App.client (snd $ getApp spec)
- maybeSetupJsFnImportDetails = getJsImportDetailsForExtFnImport relPosixPathFromSrcDirToExtSrcDir <$> maybeSetupJsFunction
+ maybeSetupJsFnImportDetails = getJsImportDetailsForExtFnImport extClientCodeDirInWebAppSrcDirP <$> maybeSetupJsFunction
(maybeSetupJsFnImportIdentifier, maybeSetupJsFnImportStmt) =
(fst <$> maybeSetupJsFnImportDetails, snd <$> maybeSetupJsFnImportDetails)
-relPosixPathFromSrcDirToExtSrcDir :: Path Posix (Rel (Dir C.WebAppSrcDir)) (Dir GeneratedExternalCodeDir)
-relPosixPathFromSrcDirToExtSrcDir = [reldirP|./ext-src|]
+extClientCodeDirInWebAppSrcDirP :: Path Posix (Rel C.WebAppSrcDir) (Dir GeneratedExternalCodeDir)
+extClientCodeDirInWebAppSrcDirP = fromJust $ relDirToPosix extClientCodeDirInWebAppSrcDir
diff --git a/waspc/src/Wasp/Generator/WebAppGenerator/ExternalCodeGenerator.hs b/waspc/src/Wasp/Generator/WebAppGenerator/ExternalCodeGenerator.hs
index 5f8ee5ac58..f23ef787c2 100644
--- a/waspc/src/Wasp/Generator/WebAppGenerator/ExternalCodeGenerator.hs
+++ b/waspc/src/Wasp/Generator/WebAppGenerator/ExternalCodeGenerator.hs
@@ -1,6 +1,7 @@
module Wasp.Generator.WebAppGenerator.ExternalCodeGenerator
- ( extCodeDirInWebAppSrcDir,
- generatorStrategy,
+ ( extClientCodeGeneratorStrategy,
+ extSharedCodeGeneratorStrategy,
+ extClientCodeDirInWebAppSrcDir,
)
where
@@ -10,13 +11,24 @@ import Wasp.Generator.ExternalCodeGenerator.Common (ExternalCodeGeneratorStrateg
import Wasp.Generator.ExternalCodeGenerator.Js (resolveJsFileWaspImportsForExtCodeDir)
import qualified Wasp.Generator.WebAppGenerator.Common as C
--- | Relative path to directory where external code will be generated.
+extClientCodeGeneratorStrategy :: ExternalCodeGeneratorStrategy
+extClientCodeGeneratorStrategy = mkExtCodeGeneratorStrategy extClientCodeDirInWebAppSrcDir
+
+extSharedCodeGeneratorStrategy :: ExternalCodeGeneratorStrategy
+extSharedCodeGeneratorStrategy = mkExtCodeGeneratorStrategy extSharedCodeDirInWebAppSrcDir
+
+-- | Relative path to the directory where external client code will be generated.
+-- Relative to web app src dir.
+extClientCodeDirInWebAppSrcDir :: Path' (Rel C.WebAppSrcDir) (Dir GeneratedExternalCodeDir)
+extClientCodeDirInWebAppSrcDir = [reldir|ext-src|]
+
+-- | Relative path to the directory where external shared code will be generated.
-- Relative to web app src dir.
-extCodeDirInWebAppSrcDir :: Path' (Rel C.WebAppSrcDir) (Dir GeneratedExternalCodeDir)
-extCodeDirInWebAppSrcDir = [reldir|ext-src|]
+extSharedCodeDirInWebAppSrcDir :: Path' (Rel C.WebAppSrcDir) (Dir GeneratedExternalCodeDir)
+extSharedCodeDirInWebAppSrcDir = [reldir|shared|]
-generatorStrategy :: ExternalCodeGeneratorStrategy
-generatorStrategy =
+mkExtCodeGeneratorStrategy :: Path' (Rel C.WebAppSrcDir) (Dir GeneratedExternalCodeDir) -> ExternalCodeGeneratorStrategy
+mkExtCodeGeneratorStrategy extCodeDirInWebAppSrcDir =
ExternalCodeGeneratorStrategy
{ _resolveJsFileWaspImports = resolveJsFileWaspImportsForExtCodeDir (SP.castRel extCodeDirInWebAppSrcDir),
_extCodeDirInProjectRootDir =
diff --git a/waspc/src/Wasp/Generator/WebAppGenerator/RouterGenerator.hs b/waspc/src/Wasp/Generator/WebAppGenerator/RouterGenerator.hs
index 013a659686..f70a4185c6 100644
--- a/waspc/src/Wasp/Generator/WebAppGenerator/RouterGenerator.hs
+++ b/waspc/src/Wasp/Generator/WebAppGenerator/RouterGenerator.hs
@@ -23,6 +23,7 @@ import Wasp.Generator.FileDraft (FileDraft)
import Wasp.Generator.Monad (Generator)
import Wasp.Generator.WebAppGenerator.Common (asTmplFile, asWebAppSrcFile)
import qualified Wasp.Generator.WebAppGenerator.Common as C
+import Wasp.Generator.WebAppGenerator.ExternalCodeGenerator (extClientCodeDirInWebAppSrcDir)
data RouterTemplateData = RouterTemplateData
{ _routes :: ![RouteTemplateData],
@@ -135,8 +136,7 @@ createPageTemplateData page =
AS.ExtImport.ExtImportField identifier -> "{ " ++ mkNamedImportExpr identifier pageName ++ " }"
}
where
- relPathToExtSrcDir :: FilePath
- relPathToExtSrcDir = "./ext-src/"
+ relPathToExtSrcDir = "./" FP.> SP.toFilePath extClientCodeDirInWebAppSrcDir
pageName :: String
pageName = fst page
diff --git a/waspc/src/Wasp/Lib.hs b/waspc/src/Wasp/Lib.hs
index 9c6ec9ba29..581aa94a31 100644
--- a/waspc/src/Wasp/Lib.hs
+++ b/waspc/src/Wasp/Lib.hs
@@ -10,19 +10,20 @@ module Wasp.Lib
)
where
-import Control.Arrow (left)
+import Control.Arrow
+import Control.Monad.Except
import Control.Monad.Extra (whenMaybeM)
import Data.List (find, isSuffixOf)
-import Data.List.NonEmpty (NonEmpty, fromList, toList)
+import Data.List.NonEmpty (toList)
+import Data.Maybe (maybeToList)
import Data.Text (Text)
import qualified Data.Text.IO as T.IO
-import StrongPath (Abs, Dir, File', Path', relfile)
-import qualified StrongPath as SP
+import StrongPath (Abs, Dir, File', Path', Rel, fromAbsDir, fromAbsFile, relfile, toFilePath, (>))
import System.Directory (doesDirectoryExist, doesFileExist)
import qualified Wasp.Analyzer as Analyzer
import Wasp.Analyzer.AnalyzeError (getErrorMessageAndCtx)
import qualified Wasp.AppSpec as AS
-import qualified Wasp.AppSpec.Valid as ASV
+import Wasp.AppSpec.Valid (validateAppSpec)
import Wasp.Common (DbMigrationsDir, WaspProjectDir, dbMigrationsDirInWaspProjectDir)
import Wasp.CompileOptions (CompileOptions (generatorWarningsFilter), sendMessage)
import qualified Wasp.CompileOptions as CompileOptions
@@ -35,6 +36,7 @@ import qualified Wasp.Generator.ConfigFile as G.CF
import qualified Wasp.Generator.DockerGenerator as DockerGenerator
import Wasp.Generator.ServerGenerator.Common (dotEnvServer)
import Wasp.Generator.WebAppGenerator.Common (dotEnvClient)
+import Wasp.Util (maybeToEither)
import qualified Wasp.Util.IO as Util.IO
type CompileError = String
@@ -47,78 +49,90 @@ compile ::
CompileOptions ->
IO ([CompileWarning], [CompileError])
compile waspDir outDir options = do
- (analyzerWarnings, appSpecOrAnalyzerErrors) <- analyzeWaspProject waspDir options
- compilerWarningsAndErrors <- case appSpecOrAnalyzerErrors of
- Left analyzerErrors -> return ([], toList analyzerErrors)
- Right appSpec ->
- case ASV.validateAppSpec appSpec of
- [] -> do
- (generatorWarnings, generatorErrors) <- Generator.writeWebAppCode appSpec outDir (sendMessage options)
- return (map show $ generatorWarningsFilter options generatorWarnings, map show generatorErrors)
- validationErrors -> do
- return ([], map show validationErrors)
- return $ (analyzerWarnings, []) <> compilerWarningsAndErrors
+ compileWarningsAndErrors <-
+ analyzeWaspProject waspDir options >>= \case
+ Left analyzerErrors -> return ([], analyzerErrors)
+ Right appSpec -> generateCode appSpec outDir options
+ dotEnvWarnings <- maybeToList <$> warnIfDotEnvPresent waspDir
+ return $ (dotEnvWarnings, []) <> compileWarningsAndErrors
analyzeWaspProject ::
Path' Abs (Dir WaspProjectDir) ->
CompileOptions ->
- IO ([CompileWarning], Either (NonEmpty CompileError) AS.AppSpec)
-analyzeWaspProject waspDir options = do
- maybeWaspFilePath <- findWaspFile waspDir
- appSpecOrAnalyzerErrors <- case maybeWaspFilePath of
- Nothing -> return $ Left $ fromList ["Couldn't find a single *.wasp file."]
- Just waspFilePath -> do
- waspFileContent <- readFile (SP.fromAbsFile waspFilePath)
- case Analyzer.analyze waspFileContent of
- Left analyzeError ->
- return $
- Left $
- fromList
- [ showCompilerErrorForTerminal
- (waspFilePath, waspFileContent)
- (getErrorMessageAndCtx analyzeError)
- ]
- Right decls -> do
- externalCodeFiles <-
- ExternalCode.readFiles (CompileOptions.externalCodeDirPath options)
- maybeDotEnvServerFile <- findDotEnvServer waspDir
- maybeDotEnvClientFile <- findDotEnvClient waspDir
- maybeMigrationsDir <- findMigrationsDir waspDir
- maybeUserDockerfileContents <- loadUserDockerfileContents waspDir
- configFiles <- CF.discoverConfigFiles waspDir G.CF.configFileRelocationMap
- return $
- Right
- AS.AppSpec
- { AS.decls = decls,
- AS.waspProjectDir = waspDir,
- AS.externalCodeFiles = externalCodeFiles,
- AS.externalCodeDirPath = CompileOptions.externalCodeDirPath options,
- AS.migrationsDir = maybeMigrationsDir,
- AS.dotEnvServerFile = maybeDotEnvServerFile,
- AS.dotEnvClientFile = maybeDotEnvClientFile,
- AS.isBuild = CompileOptions.isBuild options,
- AS.userDockerfileContents = maybeUserDockerfileContents,
- AS.configFiles = configFiles
- }
- analyzerWarnings <- warnIfDotEnvPresent waspDir
- return (analyzerWarnings, appSpecOrAnalyzerErrors)
+ IO (Either [CompileError] AS.AppSpec)
+analyzeWaspProject waspDir options = runExceptT $ do
+ waspFilePath <- ExceptT $ left pure <$> findWaspFile waspDir
+ declarations <- ExceptT $ left pure <$> analyzeWaspFileContent waspFilePath
+ ExceptT $ constructAppSpec waspDir options declarations
+
+generateCode ::
+ AS.AppSpec ->
+ Path' Abs (Dir ProjectRootDir) ->
+ CompileOptions ->
+ IO ([CompileError], [CompileWarning])
+generateCode appSpec outDir options = do
+ (generatorWarnings, generatorErrors) <- Generator.writeWebAppCode appSpec outDir (sendMessage options)
+ let filteredWarnings = generatorWarningsFilter options generatorWarnings
+ return (show <$> filteredWarnings, show <$> generatorErrors)
-- | Checks the wasp directory for potential problems, and issues warnings if any are found.
-warnIfDotEnvPresent :: Path' Abs (Dir WaspProjectDir) -> IO [CompileWarning]
-warnIfDotEnvPresent waspDir = do
- maybeDotEnvFile <- findDotEnv waspDir
- case maybeDotEnvFile of
- Nothing -> return []
- Just _ -> return ["Wasp .env files should be named .env.server or .env.client, depending on their use."]
-
-findWaspFile :: Path' Abs (Dir WaspProjectDir) -> IO (Maybe (Path' Abs File'))
+warnIfDotEnvPresent :: Path' Abs (Dir WaspProjectDir) -> IO (Maybe CompileWarning)
+warnIfDotEnvPresent waspDir = (warningMessage <$) <$> findDotEnv waspDir
+ where
+ warningMessage = "Wasp .env files should be named .env.server or .env.client, depending on their use."
+
+analyzeWaspFileContent :: Path' Abs File' -> IO (Either CompileError [AS.Decl])
+analyzeWaspFileContent waspFilePath = do
+ waspFileContent <- readFile (fromAbsFile waspFilePath)
+ let declsOrAnalyzeError = Analyzer.analyze waspFileContent
+ return $
+ left
+ (showCompilerErrorForTerminal (waspFilePath, waspFileContent) . getErrorMessageAndCtx)
+ declsOrAnalyzeError
+
+constructAppSpec ::
+ Path' Abs (Dir WaspProjectDir) ->
+ CompileOptions ->
+ [AS.Decl] ->
+ IO (Either [CompileError] AS.AppSpec)
+constructAppSpec waspDir options decls = do
+ externalServerCodeFiles <-
+ ExternalCode.readFiles (CompileOptions.externalServerCodeDirPath options)
+ externalClientCodeFiles <-
+ ExternalCode.readFiles (CompileOptions.externalClientCodeDirPath options)
+ externalSharedCodeFiles <-
+ ExternalCode.readFiles (CompileOptions.externalSharedCodeDirPath options)
+ maybeDotEnvServerFile <- findDotEnvServer waspDir
+ maybeDotEnvClientFile <- findDotEnvClient waspDir
+ maybeMigrationsDir <- findMigrationsDir waspDir
+ maybeUserDockerfileContents <- loadUserDockerfileContents waspDir
+ configFiles <- CF.discoverConfigFiles waspDir G.CF.configFileRelocationMap
+ let appSpec =
+ AS.AppSpec
+ { AS.decls = decls,
+ AS.waspProjectDir = waspDir,
+ AS.externalClientFiles = externalClientCodeFiles,
+ AS.externalServerFiles = externalServerCodeFiles,
+ AS.externalSharedFiles = externalSharedCodeFiles,
+ AS.migrationsDir = maybeMigrationsDir,
+ AS.dotEnvServerFile = maybeDotEnvServerFile,
+ AS.dotEnvClientFile = maybeDotEnvClientFile,
+ AS.isBuild = CompileOptions.isBuild options,
+ AS.userDockerfileContents = maybeUserDockerfileContents,
+ AS.configFiles = configFiles
+ }
+ return $ case validateAppSpec appSpec of
+ [] -> Right appSpec
+ validationErrors -> Left $ map show validationErrors
+
+findWaspFile :: Path' Abs (Dir WaspProjectDir) -> IO (Either String (Path' Abs File'))
findWaspFile waspDir = do
files <- fst <$> Util.IO.listDirectory waspDir
- return $ (waspDir SP.>) <$> find isWaspFile files
+ return $ maybeToEither "Couldn't find a single *.wasp file." $ (waspDir >) <$> find isWaspFile files
where
isWaspFile path =
- ".wasp" `isSuffixOf` SP.toFilePath path
- && (length (SP.toFilePath path) > length (".wasp" :: String))
+ ".wasp" `isSuffixOf` toFilePath path
+ && (length (toFilePath path) > length (".wasp" :: String))
findDotEnvServer :: Path' Abs (Dir WaspProjectDir) -> IO (Maybe (Path' Abs File'))
findDotEnvServer waspDir = findFileInWaspProjectDir waspDir dotEnvServer
@@ -131,31 +145,31 @@ findDotEnv waspDir = findFileInWaspProjectDir waspDir [relfile|.env|]
findFileInWaspProjectDir ::
Path' Abs (Dir WaspProjectDir) ->
- Path' (SP.Rel WaspProjectDir) File' ->
+ Path' (Rel WaspProjectDir) File' ->
IO (Maybe (Path' Abs File'))
findFileInWaspProjectDir waspDir file = do
- let fileAbsFp = waspDir SP.> file
- fileExists <- doesFileExist $ SP.toFilePath fileAbsFp
+ let fileAbsFp = waspDir > file
+ fileExists <- doesFileExist $ toFilePath fileAbsFp
return $ if fileExists then Just fileAbsFp else Nothing
findMigrationsDir ::
Path' Abs (Dir WaspProjectDir) ->
IO (Maybe (Path' Abs (Dir DbMigrationsDir)))
findMigrationsDir waspDir = do
- let migrationsAbsPath = waspDir SP.> dbMigrationsDirInWaspProjectDir
- migrationsExists <- doesDirectoryExist $ SP.fromAbsDir migrationsAbsPath
+ let migrationsAbsPath = waspDir > dbMigrationsDirInWaspProjectDir
+ migrationsExists <- doesDirectoryExist $ fromAbsDir migrationsAbsPath
return $ if migrationsExists then Just migrationsAbsPath else Nothing
loadUserDockerfileContents :: Path' Abs (Dir WaspProjectDir) -> IO (Maybe Text)
loadUserDockerfileContents waspDir = do
- let dockerfileAbsPath = SP.toFilePath $ waspDir SP.> [relfile|Dockerfile|]
+ let dockerfileAbsPath = toFilePath $ waspDir > [relfile|Dockerfile|]
whenMaybeM (doesFileExist dockerfileAbsPath) $ T.IO.readFile dockerfileAbsPath
compileAndRenderDockerfile :: Path' Abs (Dir WaspProjectDir) -> CompileOptions -> IO (Either [CompileError] Text)
compileAndRenderDockerfile waspDir compileOptions = do
- (_, appSpecOrAnalyzerErrors) <- analyzeWaspProject waspDir compileOptions
+ appSpecOrAnalyzerErrors <- analyzeWaspProject waspDir compileOptions
case appSpecOrAnalyzerErrors of
- Left errors -> return . Left . toList $ errors
+ Left errors -> return $ Left errors
Right appSpec -> do
dockerfileOrGeneratorErrors <- DockerGenerator.compileAndRenderDockerfile appSpec
return $ left (map show . toList) dockerfileOrGeneratorErrors
diff --git a/waspc/src/Wasp/Util.hs b/waspc/src/Wasp/Util.hs
index 48168b9de6..b9b2179ed7 100644
--- a/waspc/src/Wasp/Util.hs
+++ b/waspc/src/Wasp/Util.hs
@@ -29,6 +29,7 @@ module Wasp.Util
orIfNothing,
orIfNothingM,
kebabToCamelCase,
+ maybeToEither,
)
where
@@ -211,3 +212,6 @@ orIfNothing = flip fromMaybe
orIfNothingM :: (Monad m) => m (Maybe a) -> m a -> m a
orIfNothingM = flip fromMaybeM
+
+maybeToEither :: a -> Maybe b -> Either a b
+maybeToEither leftValue = maybe (Left leftValue) Right
diff --git a/waspc/test/Analyzer/EvaluatorTest.hs b/waspc/test/Analyzer/EvaluatorTest.hs
index 62994f1010..7829c59f51 100644
--- a/waspc/test/Analyzer/EvaluatorTest.hs
+++ b/waspc/test/Analyzer/EvaluatorTest.hs
@@ -199,7 +199,7 @@ spec_Evaluator = do
let typeDefs = TD.addDeclType @Special $ TD.empty
let source =
[ "special Test {",
- " imps: [import { field } from \"@ext/main.js\", import main from \"@ext/main.js\"],",
+ " imps: [import { field } from \"@server/main.js\", import main from \"@server/main.js\"],",
" json: {=json { \"key\": 1 } json=}",
"}"
]
diff --git a/waspc/test/Analyzer/Parser/ConcreteParserTest.hs b/waspc/test/Analyzer/Parser/ConcreteParserTest.hs
index 42975544b8..0b71a9bfb5 100644
--- a/waspc/test/Analyzer/Parser/ConcreteParserTest.hs
+++ b/waspc/test/Analyzer/Parser/ConcreteParserTest.hs
@@ -41,15 +41,15 @@ spec_ParseCSTExpression = do
parseCSTExpression [token T.KwFalse "false"]
`shouldBeWithDiff` ([], [node BoolFalse 5 []])
it "Parses external imports" $ do
- parseCSTExpression [token T.KwImport "import", token T.Identifier "main", token T.KwFrom "from", token T.String "\"@ext/main.js\""]
+ parseCSTExpression [token T.KwImport "import", token T.Identifier "main", token T.KwFrom "from", token T.String "\"@server/main.js\""]
`shouldBeWithDiff` ( [],
[ node
ExtImport
- 28
+ 31
[ node (Token T.KwImport) 6 [],
node ExtImportModule 4 [],
node (Token T.KwFrom) 4 [],
- node ExtImportPath 14 []
+ node ExtImportPath 17 []
]
]
)
diff --git a/waspc/test/AnalyzerTest.hs b/waspc/test/AnalyzerTest.hs
index 4a152d17c1..9b960b0092 100644
--- a/waspc/test/AnalyzerTest.hs
+++ b/waspc/test/AnalyzerTest.hs
@@ -54,10 +54,10 @@ spec_Analyzer = do
" (\"redux\", \"^4.0.5\")",
" ],",
" server: {",
- " setupFn: import { setupServer } from \"@ext/bar.js\"",
+ " setupFn: import { setupServer } from \"@server/bar.js\"",
" },",
" client: {",
- " setupFn: import { setupClient } from \"@ext/baz.js\"",
+ " setupFn: import { setupClient } from \"@client/baz.js\"",
" },",
" db: {",
" system: PostgreSQL",
@@ -69,23 +69,23 @@ spec_Analyzer = do
"psl=}",
"",
"page HomePage {",
- " component: import Home from \"@ext/pages/Main\"",
+ " component: import Home from \"@client/pages/Main\"",
"}",
"",
"page ProfilePage {",
- " component: import { profilePage } from \"@ext/pages/Profile\",",
+ " component: import { profilePage } from \"@client/pages/Profile\",",
" authRequired: true",
"}",
"",
"route HomeRoute { path: \"/\", to: HomePage }",
"",
"query getUsers {",
- " fn: import { getAllUsers } from \"@ext/foo.js\",",
+ " fn: import { getAllUsers } from \"@server/foo.js\",",
" entities: [User]",
"}",
"",
"action updateUser {",
- " fn: import { updateUser } from \"@ext/foo.js\",",
+ " fn: import { updateUser } from \"@server/foo.js\",",
" entities: [User],",
" auth: true",
"}",
@@ -93,7 +93,7 @@ spec_Analyzer = do
"job BackgroundJob {",
" executor: PgBoss,",
" perform: {",
- " fn: import { backgroundJob } from \"@ext/jobs/baz.js\",",
+ " fn: import { backgroundJob } from \"@server/jobs/baz.js\",",
" executorOptions: {",
" pgBoss: {=json { \"retryLimit\": 1 } json=}",
" }",
@@ -291,7 +291,7 @@ spec_Analyzer = do
let source =
unlines
[ "route HomeRoute { path: \"/\", to: HomePage }",
- "page HomePage { component: import Home from \"@ext/HomePage.js\" }"
+ "page HomePage { component: import Home from \"@client/HomePage.js\" }"
]
isRight (analyze source) `shouldBe` True
diff --git a/waspc/test/AppSpec/ValidTest.hs b/waspc/test/AppSpec/ValidTest.hs
index 1c62490d98..f6d5c58c61 100644
--- a/waspc/test/AppSpec/ValidTest.hs
+++ b/waspc/test/AppSpec/ValidTest.hs
@@ -193,8 +193,9 @@ spec_AppSpecValid = do
AS.AppSpec
{ AS.decls = [basicAppDecl],
AS.waspProjectDir = systemSPRoot SP.> [SP.reldir|test/|],
- AS.externalCodeDirPath = systemSPRoot SP.> [SP.reldir|test/src|],
- AS.externalCodeFiles = [],
+ AS.externalClientFiles = [],
+ AS.externalServerFiles = [],
+ AS.externalSharedFiles = [],
AS.isBuild = False,
AS.migrationsDir = Nothing,
AS.dotEnvServerFile = Nothing,
diff --git a/waspc/test/Generator/WebAppGeneratorTest.hs b/waspc/test/Generator/WebAppGeneratorTest.hs
index ed2eafd22e..956e471964 100644
--- a/waspc/test/Generator/WebAppGeneratorTest.hs
+++ b/waspc/test/Generator/WebAppGeneratorTest.hs
@@ -1,6 +1,6 @@
module Generator.WebAppGeneratorTest where
-import Fixtures (systemSPRoot)
+import Fixtures
import qualified StrongPath as SP
import System.FilePath ((>))
import Test.Tasty.Hspec
@@ -43,8 +43,9 @@ spec_WebAppGenerator = do
}
],
AS.waspProjectDir = systemSPRoot SP.> [SP.reldir|test/|],
- AS.externalCodeDirPath = systemSPRoot SP.> [SP.reldir|test/src|],
- AS.externalCodeFiles = [],
+ AS.externalClientFiles = [],
+ AS.externalServerFiles = [],
+ AS.externalSharedFiles = [],
AS.isBuild = False,
AS.migrationsDir = Nothing,
AS.dotEnvServerFile = Nothing,
diff --git a/waspc/waspc.cabal b/waspc/waspc.cabal
index 5f3b8bb27a..c41e22b2d3 100644
--- a/waspc/waspc.cabal
+++ b/waspc/waspc.cabal
@@ -43,6 +43,12 @@ data-files:
Cli/templates/**/*.css
Cli/templates/**/*.js
Cli/templates/**/*.png
+ Cli/templates/new/.gitignore
+ Cli/templates/new/.wasproot
+ Cli/templates/new/src/.waspignore
+ Cli/templates/new/src/client/.gitkeep
+ Cli/templates/new/src/server/.gitkeep
+ Cli/templates/new/src/shared/.gitkeep
data-dir: data/
source-repository head