@@ -3,9 +3,9 @@ module Wasp.Generator.WaspLibs
33 )
44where
55
6- import StrongPath ((</>) )
6+ import StrongPath (Path' , Rel , (</>) )
77import qualified Wasp.AppSpec as AS
8- import qualified Wasp.ExternalConfig.Npm.Tarball as Npm.Tarball
8+ import Wasp.Generator
99import Wasp.Generator.FileDraft (FileDraft , createCopyFileDraft )
1010import Wasp.Generator.Monad (Generator , getWaspLibs )
1111import Wasp.Generator.WaspLibs.Common (libsRootDirInGeneratedCodeDir , libsRootDirNextToSdk )
@@ -14,19 +14,20 @@ import qualified Wasp.Generator.WaspLibs.WaspLib as WaspLib
1414genWaspLibs :: AS. AppSpec -> Generator [FileDraft ]
1515genWaspLibs spec = do
1616 waspLibs <- getWaspLibs
17- return [mkLibCopyDraft destDir waspLib | destDir <- destDirs , waspLib <- waspLibs]
17+ return [mkLibCopyDraft libsDestDir waspLib | libsDestDir <- libsDestDirs , waspLib <- waspLibs]
1818 where
19- mkLibCopyDraft destDir waspLib =
19+ mkLibCopyDraft :: Path' (Rel ProjectRootDir ) (Dir LibsRootDir ) -> WaspLib -> FileDraft
20+ mkLibCopyDraft libsDestDir waspLib =
2021 createCopyFileDraft
21- (destDir </> Npm.Tarball. tarballFilenameAsRelFile ( WaspLib. generatedCodeDirTarballFilename waspLib) )
22+ (libsDestDir </> WaspLib. getTarballPathInLibsRootDir waspLib)
2223 (WaspLib. waspDataDirTarballAbsPath waspLib)
2324
2425 -- We need to accomodate the SDK hacks with libs, so we copy the libs
2526 -- differently depending on the context:
2627 -- 1. When running `wasp start` - copy them only to the `.wasp/out` dir
2728 -- 2. When running `wasp build` - copy them to the `.wasp/build` AND
2829 -- `.wasp/out` dir.
29- destDirs =
30+ libsDestDirs =
3031 if AS. isBuild spec
3132 then [libsRootDirInGeneratedCodeDir, libsRootDirNextToSdk]
3233 else [libsRootDirInGeneratedCodeDir]
0 commit comments