Skip to content

Commit

Permalink
skip ? if it's leading query string (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
et1975 authored Oct 17, 2023
1 parent 9123c79 commit 497067b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ paket add Fable.Elmish.UrlParser

## Building

With .NET Core SDK v6 and fake tool:
With .NET Core SDK v6:
> `fotnet fsi build.fsx`
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.0.2
* Skip query's "?" (#25)

## 1.0.1
* Support empty params query

Expand Down
30 changes: 4 additions & 26 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env -S dotnet fsi
#r "nuget: Fake.Core.Target"
#r "nuget: Fake.IO.FileSystem"
#r "nuget: Fake.DotNet.Cli"
#r "nuget: Fake.Core.Target"
Expand Down Expand Up @@ -34,8 +33,6 @@ System.Environment.GetCommandLineArgs()
|> Context.RuntimeContext.Fake
|> Context.setExecutionContext

let withWorkDir = DotNet.Options.withWorkingDirectory

Target.create "Clean" (fun _ ->
Shell.cleanDir "src/obj"
Shell.cleanDir "src/bin"
Expand All @@ -45,23 +42,12 @@ Target.create "Clean" (fun _ ->

Target.create "Restore" (fun _ ->
projects
|> Seq.iter (fun s ->
let dir = Path.GetDirectoryName s
DotNet.restore (fun a -> a.WithCommon (withWorkDir dir)) s
)
|> Seq.iter (Path.GetDirectoryName >> DotNet.restore id)
)

Target.create "Build" (fun _ ->
projects
|> Seq.iter (fun s ->
let dir = Path.GetDirectoryName s
DotNet.build (fun a ->
a.WithCommon
(fun c ->
let c = c |> withWorkDir dir
{c with CustomParams = Some "/p:SourceLinkCreate=true"}))
s
)
|> Seq.iter (Path.GetDirectoryName >> DotNet.build id)
)

Target.create "Test" (fun _ ->
Expand Down Expand Up @@ -92,19 +78,11 @@ Target.create "Meta" (fun _ ->

Target.create "Package" (fun _ ->
projects
|> Seq.iter (fun s ->
let dir = Path.GetDirectoryName s
DotNet.pack (fun a ->
a.WithCommon (withWorkDir dir)
) s
)
|> Seq.iter (Path.GetDirectoryName >> DotNet.pack id)
)

Target.create "PublishNuget" (fun _ ->
let exec dir =
DotNet.exec (fun a ->
a.WithCommon (withWorkDir dir)
)
let exec dir = DotNet.exec (DotNet.Options.withWorkingDirectory dir)

let args = sprintf "push Fable.Elmish.UrlParser.%s.nupkg -s nuget.org -k %s" (string release.SemVer) (Environment.environVar "nugetkey")
let result = exec "src/bin/Release" "nuget" args
Expand Down
3 changes: 2 additions & 1 deletion src/parser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ let internal toKeyValuePair (segment: string) =
let parseParams (querystring: string) =
if System.String.IsNullOrEmpty querystring then Map.empty
else
querystring.Split('&')
let querystring' = if querystring.StartsWith("?") then querystring.Substring(1) else querystring
querystring'.Split('&')
|> Seq.map toKeyValuePair
|> Seq.choose id
|> Map.ofSeq
Expand Down

0 comments on commit 497067b

Please sign in to comment.