purescript / spago

🍝 PureScript package manager and build tool
BSD 3-Clause "New" or "Revised" License
793 stars 132 forks source link

--config option doesnt accept absolute path #472

Closed srghma closed 1 year ago

srghma commented 5 years ago

if you do

YOUR_PROJECT_DIR_FULLPATH=$HOME/example
YOUR_PROJECT_DIR_RELATIVE_PATH=example
cd $SOME_OTHER_DIR

then

$ spago --config $YOUR_PROJECT_DIR_FULLPATH/spago.dhall list-packages --filter transitive --json
spago:
Error: Invalid input

(input):1:3:
  |
1 | .//home/srghma/projects/spago2nix/spago.dhall
  |   ^
unexpected '/'
expecting expression or whitespace

and

$ spago --config $YOUR_PROJECT_DIR_RELATIVE_PATH/spago.dhall list-packages --filter transitive --json
↳ ./packages.dhall

Error: Missing file ./packages.dhall

21│     ./packages.dhall

21:5

real example

[nix-shell:~/projects]$ spago --config $HOME/projects/spago2nix/spago.dhall list-packages --filter transitive --json
spago:
Error: Invalid input

(input):1:3:
  |
1 | .//home/srghma/projects/spago2nix/spago.dhall
  |   ^
unexpected '/'
expecting expression or whitespace

[nix-shell:~/projects]$ spago --config spago2nix/spago.dhall list-packages --filter transitive --json
spago:
↳ ./packages.dhall

Error: Missing file ./packages.dhall

21│     ./packages.dhall

21:5

[nix-shell:~/projects]$

the second error Missing file ./packages.dhall is a bit different, I believe that path should be derived from spago.dhall packages option

{-
Welcome to a Spago project!
You can edit this file as you like.
-}
{ sources =
    [ "src/**/*.purs", "test/**/*.purs" ]
, name =
    "my-project"
, dependencies =
    [ "console"
    , "generics-rep"
    , "kishimen"
    , "node-fs-aff"
    , "parallel"
    , "prelude"
    , "simple-json-utils"
    , "sunde"
    , "validation"
    ]
, packages =
    ./packages.dhall
}
f-f commented 5 years ago

Hi @srghma! I can reproduce the first problem you reported, and it's a bug in this line: https://github.com/spacchetti/spago/blob/8ce19ea5648f8bd65d6db88428bac56e66cf2560/src/Spago/Config.hs#L115

The way we should fix it is that we should call makeAbsolute on the config path, either here or when we read it in

I cannot replicate the second problem you report, could you share a repo with instructions on how to replicate this? Also a gist or a series of commands could work

srghma commented 5 years ago

I cannot replicate the second problem you report, could you share a repo with instructions on how to replicate this? Also a gist or a series of commands could work

I have created separate issue https://github.com/spacchetti/spago/issues/478

f-f commented 1 year ago

The new Spago does not allow for pointing to a configuration anymore, see the new docs on monorepo support