Skip to content

Commit bcf3cd4

Browse files
authored
Don't ask to run spago init when config file cannot be found (#1152)
1 parent 6fe57d8 commit bcf3cd4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

core/src/Config.purs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,5 +481,7 @@ readConfig :: forall a. FilePath -> Spago (LogEnv a) (Either String { doc :: Yam
481481
readConfig path = do
482482
logDebug $ "Reading config from " <> path
483483
FS.exists path >>= case _ of
484-
false -> pure (Left $ "Did not find " <> path <> " file.")
484+
false -> pure $ Left $ case path of
485+
"spago.yaml" -> "Did not find " <> path <> " Run `spago init` to initialise a new project."
486+
_ -> "Did not find " <> path
485487
true -> liftAff $ FS.readYamlDocFile configCodec path

src/Spago/Config.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ readWorkspace { maybeSelectedPackage, pureBuild } = do
155155
-- First try to read the config in the root. It _has_ to contain a workspace
156156
-- configuration, or we fail early.
157157
{ workspace, package: maybePackage, workspaceDoc } <- Core.readConfig "spago.yaml" >>= case _ of
158-
Left err -> die [ "Couldn't parse Spago config, error:\n " <> err, "Run `spago init` to initialise a new project." ]
158+
Left err -> die [ "Couldn't parse Spago config, error:\n " <> err, "The configuration file help can be found here https://github.com/purescript/spago#the-configuration-file" ]
159159
Right { yaml: { workspace: Nothing } } -> die
160160
[ "Your spago.yaml doesn't contain a workspace section."
161161
, "See the relevant documentation here: https://github.com/purescript/spago#the-workspace"

0 commit comments

Comments
 (0)