Skip to content

Commit

Permalink
Port from codec-argonaut to codec-json (#1227)
Browse files Browse the repository at this point in the history
  • Loading branch information
f-f authored Jun 9, 2024
1 parent ebc06aa commit d4e7dbb
Show file tree
Hide file tree
Showing 49 changed files with 839 additions and 642 deletions.
14 changes: 9 additions & 5 deletions bin/spago.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,24 @@ package:
dependencies:
- aff
- arrays
- codec-argonaut
- console
- js-date
- avar
- codec-json
- control
- foldable-traversable
- lists
- node-fs
- maybe
- node-path
- node-process
- now
- optparse
- ordered-collections
- prelude
- record
- refs
- registry-lib
- spago
- spago-core
- strings
- transformers
- unsafe-coerce
bundle:
module: Main
Expand Down
13 changes: 9 additions & 4 deletions bin/src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Control.Monad.Reader as Reader
import Data.Array as Array
import Data.Array.NonEmpty as NEA
import Data.Array.NonEmpty as NonEmptyArray
import Data.Codec.Argonaut.Common as CA.Common
import Data.Codec.JSON.Common as CJ.Common
import Data.Foldable as Foldable
import Data.List as List
import Data.Maybe as Maybe
Expand Down Expand Up @@ -52,6 +52,7 @@ import Spago.Generated.BuildInfo as BuildInfo
import Spago.Git as Git
import Spago.Json as Json
import Spago.Log (LogVerbosity(..))
import Spago.Log as Log
import Spago.Paths as Paths
import Spago.Purs as Purs
import Spago.Registry as Registry
Expand Down Expand Up @@ -535,10 +536,14 @@ main = do
void $ runSpago env (Sources.run { json: args.json })
Init args@{ useSolver } -> do
-- Figure out the package name from the current dir
let candidateName = fromMaybe (String.take 50 $ Path.basename Paths.cwd) args.name
let candidateName = fromMaybe (String.take 150 $ Path.basename Paths.cwd) args.name
logDebug [ show Paths.cwd, show candidateName ]
packageName <- case PackageName.parse (PackageName.stripPureScriptPrefix candidateName) of
Left err -> die [ "Could not figure out a name for the new package. Error:", show err ]
Left err -> die
[ toDoc "Could not figure out a name for the new package. Error:"
, Log.break
, Log.indent2 $ toDoc err
]
Right p -> pure p
setVersion <- for args.setVersion $ parseLenientVersion >>> case _ of
Left err -> die [ "Could not parse provided set version. Error:", show err ]
Expand Down Expand Up @@ -831,7 +836,7 @@ mkTestEnv testArgs { dependencies, purs } = do
Just { head, tail } -> pure $ map mkSelectedTest $ NonEmptyArray.cons' head tail
Nothing -> die "No package found to test."

logDebug $ "Selected packages to test: " <> Json.stringifyJson (CA.Common.nonEmptyArray PackageName.codec) (map _.selected.package.name selectedPackages)
logDebug $ "Selected packages to test: " <> Json.stringifyJson (CJ.Common.nonEmptyArray PackageName.codec) (map _.selected.package.name selectedPackages)

let newWorkspace = workspace { buildOptions { output = testArgs.output <|> workspace.buildOptions.output } }
let testEnv = { logOptions, workspace: newWorkspace, selectedPackages, node, dependencies, purs }
Expand Down
8 changes: 6 additions & 2 deletions core/spago.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ package:
strict: true
dependencies:
- aff
- argonaut-core
- arrays
- bifunctors
- codec-argonaut
- codec
- codec-json
- console
- control
- datetime
Expand All @@ -19,19 +19,23 @@ package:
- foldable-traversable
- functions
- identity
- integers
- json
- lists
- maybe
- newtype
- node-buffer
- node-fs
- node-path
- node-process
- now
- ordered-collections
- partial
- prelude
- profunctor
- refs
- registry-lib
- strings
- stringutils
- transformers
- tuples
Loading

0 comments on commit d4e7dbb

Please sign in to comment.