@@ -108,15 +108,16 @@ runWatch = do
108108
109109-- | Relative paths to local packages of an obelisk project
110110-- TODO a way to query this
111−getLocalPkgs :: Applicative f => f [FilePath]
112−getLocalPkgs = pure ["backend", "common", "frontend"]
111+getLocalPkgs :: Applicative f => f [(FilePath, Maybe String)]
112+getLocalPkgs = pure [("backend", Nothing), ("common", Nothing), ("frontend", Nothing)]
113113
114114parseCabalPackage
115115 :: (MonadObelisk m)
116116 => FilePath -- ^ package directory
117+ -> Maybe String -- ^ package name, defaults to directory
117118 -> m (Maybe CabalPackageInfo)
118−parseCabalPackage dir = do
119− let cabalFp = dir </> (takeBaseName dir <> ".cabal")
119+parseCabalPackage dir name = do
120+ let cabalFp = dir </> (fromMaybe (takeBaseName dir) name <> ".cabal")
120121 hpackFp = dir </> "package.yaml"
121122 hasCabal <- liftIO $ doesFileExist cabalFp
122123 hasHpack <- liftIO $ doesFileExist hpackFp
@@ -165,17 +166,18 @@ withUTF8FileContentsM fp f = do
165166-- | Create ghci configuration to load the given packages
166167withGhciScript
167168 :: MonadObelisk m
168− => [FilePath] -- ^ List of packages to load into ghci
169+ => [(FilePath, Maybe String)] -- ^ List of packages to load into ghci
169170 -> (FilePath -> m ()) -- ^ Action to run with the path to generated temporory .ghci
170171 -> m ()
171172withGhciScript pkgs f = do
172− (pkgDirErrs, packageInfos) <- fmap partitionEithers $ forM pkgs $ \pkg -> do
173− flip fmap (parseCabalPackage pkg) $ \case
174− Nothing -> Left pkg
173+ (pkgDirErrs, packageInfos) <- fmap partitionEithers $ forM pkgs $ \(dir, name) -> do
174+ flip fmap (parseCabalPackage dir name) $ \case
175+ Nothing -> Left dir
175176 Just packageInfo -> Right packageInfo
176177
178+ let dirs = fmap fst pkgs
177179 when (null packageInfos) $
178− failWith $ T.pack $ "No valid pkgs found in " <> intercalate ", " pkgs
180+ failWith $ T.pack $ "No valid pkgs found in " <> intercalate ", " dirs
179181 unless (null pkgDirErrs) $
180182 putLog Warning $ T.pack $ "Failed to find pkgs in " <> intercalate ", " pkgDirErrs
181183