File tree Expand file tree Collapse file tree 5 files changed +26
-4
lines changed
Expand file tree Collapse file tree 5 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -1438,6 +1438,9 @@ package:
14381438 # The registry will then check if the package version is included
14391439 # in this range.
14401440 - package-with-range : " >=1.1.1 <2.0.0"
1441+ # 4) specify an exact version
1442+ # Shorthand for ">=1.2.3 <1.2.4", pinning to a specific patch version.
1443+ - package-with-exact-version : " 1.2.3"
14411444
14421445 # Optional description for the package
14431446 description : " a useful package"
Original file line number Diff line number Diff line change @@ -324,7 +324,11 @@ spagoRangeCodec = CJ.prismaticCodec "SpagoRange" rangeParse printSpagoRange CJ.s
324324 where
325325 rangeParse str =
326326 if str == " *" then Just widestRange
327- else hush $ Range .parse str
327+ -- First try parsing as a range (e.g. ">=1.0.0 <2.0.0")
328+ else case hush $ Range .parse str of
329+ Just range -> Just range
330+ -- Then try parsing as an exact version (e.g. "1.0.0" -> ">=1.0.0 <1.0.1")
331+ Nothing -> Range .exact <$> hush (Version .parse str)
328332
329333printSpagoRange :: Range -> String
330334printSpagoRange range =
Original file line number Diff line number Diff line change 17721772 },
17731773 "registry-lib": {
17741774 "git": "https://github.com/purescript/registry-dev.git",
1775- "ref": "fc203a9e2a0b96a90ace20dc6958c157cbbca16b ",
1775+ "ref": "43194a1f079ed1e0b8e17c5d9a0e9c213ed40f49 ",
17761776 "subdir": "lib"
17771777 },
17781778 "search-trie": {
34363436 "registry-lib": {
34373437 "type": "git",
34383438 "url": "https://github.com/purescript/registry-dev.git",
3439- "rev": "fc203a9e2a0b96a90ace20dc6958c157cbbca16b ",
3439+ "rev": "43194a1f079ed1e0b8e17c5d9a0e9c213ed40f49 ",
34403440 "subdir": "lib",
34413441 "dependencies": [
34423442 "aff",
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ workspace:
8888 extraPackages :
8989 registry-lib :
9090 git : https://github.com/purescript/registry-dev.git
91- ref : fc203a9e2a0b96a90ace20dc6958c157cbbca16b
91+ ref : 43194a1f079ed1e0b8e17c5d9a0e9c213ed40f49
9292 subdir : lib
9393 html-parser-halogen :
9494 dependencies :
Original file line number Diff line number Diff line change @@ -3,10 +3,12 @@ module Test.Spago.Config where
33import Test.Prelude
44
55import Codec.JSON.DecodeError as CJ
6+ import Data.Map as Map
67import Data.String as String
78import Registry.License as License
89import Registry.Location (Location (..))
910import Registry.PackageName as PackageName
11+ import Registry.Range as Range
1012import Registry.Version as Version
1113import Spago.Core.Config (SetAddress (..))
1214import Spago.Core.Config as C
@@ -35,6 +37,19 @@ spec =
3537 <> " \n\n\n -------\n Actual:\n -------\n "
3638 <> Yaml .stringifyYaml C .configCodec parsed
3739
40+ Spec .it " parses exact version ranges (e.g. '1.0.0' -> '>=1.0.0 <1.0.1')" do
41+ let
42+ yaml = """
43+ package:
44+ name: test
45+ dependencies:
46+ - prelude: "6.0.1"
47+ """
48+ parsed = unsafeFromRight $ Yaml .parseYaml C .configCodec yaml
49+ C.Dependencies deps = (unsafeFromJust parsed.package).dependencies
50+ actual = Map .lookup (mkPackageName " prelude" ) deps <#> map Range .print
51+ actual `Assert.shouldEqual` Just (Just " >=6.0.1 <6.0.2" )
52+
3853 Spec .it " reports errors" do
3954 Yaml .parseYaml C .configCodec invalidLicenseYaml `shouldFailWith`
4055 ( " $.package.publish.license: Could not decode PackageConfig:"
You can’t perform that action at this time.
0 commit comments