From ebfc23aaa9e84276630ad077a6aa8d85afc66f78 Mon Sep 17 00:00:00 2001 From: Constantin Tews Date: Wed, 15 Nov 2023 16:18:28 +0100 Subject: [PATCH 1/2] Update to .NET8. --- .config/dotnet-tools.json | 4 +- Arguments.fs | 1 - Commands/ChatCommands.fs | 2 +- Commands/DeviceCommands.fs | 4 +- Commands/PushCommands.fs | 4 +- Commands/SubscriptionCommands.fs | 2 +- Commands/SystemCommands.fs | 2 +- HttpService.fs | 4 +- Program.fs | 2 +- Serialization.fs | 3 +- paket.dependencies | 2 +- paket.lock | 102 ++++++++++++++----------------- pushbullet-cli.fsproj | 4 +- 13 files changed, 64 insertions(+), 72 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 221ac57..41785ce 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,13 +3,13 @@ "isRoot": true, "tools": { "paket": { - "version": "7.2.1", + "version": "8.0.0", "commands": [ "paket" ] }, "fantomas": { - "version": "6.0.2", + "version": "6.2.3", "commands": [ "fantomas" ] diff --git a/Arguments.fs b/Arguments.fs index a756127..54f6e65 100644 --- a/Arguments.fs +++ b/Arguments.fs @@ -105,7 +105,6 @@ module Arguments = | Sms _ -> CliArguments_Sms.ResourceString - | PushInfo _ -> CliArguments_PushInfo.ResourceString | Push _ -> CliArguments_Push.ResourceString | Link _ -> CliArguments_Link.ResourceString diff --git a/Commands/ChatCommands.fs b/Commands/ChatCommands.fs index 9894ec7..8c9d899 100644 --- a/Commands/ChatCommands.fs +++ b/Commands/ChatCommands.fs @@ -19,7 +19,7 @@ module ChatCommands = let list () = HttpService.GetListRequest Chats |> ChatListResponse.Parse - |> fun r -> r.Chats + |> _.Chats |> Array.map (fun c -> ChatListOutput.FormattedString( c.Iden, diff --git a/Commands/DeviceCommands.fs b/Commands/DeviceCommands.fs index 4508e83..dbe70a8 100644 --- a/Commands/DeviceCommands.fs +++ b/Commands/DeviceCommands.fs @@ -20,7 +20,7 @@ module DeviceCommands = let list () = HttpService.GetListRequest Devices |> DeviceListResponse.Parse - |> fun r -> r.Devices + |> _.Devices |> Array.indexed |> Array.map (fun (i, e) -> DeviceListOutput.FormattedString(i, e.Iden, e.Nickname)) |> String.concat Environment.NewLine @@ -42,7 +42,7 @@ module DeviceCommands = let getDeviceId (GetDeviceCommand index) = HttpService.GetListRequest Devices |> DeviceListResponse.Parse - |> fun r -> r.Devices + |> _.Devices |> fun a -> a |> Array.tryItem index |> function | Some v -> v.Iden diff --git a/Commands/PushCommands.fs b/Commands/PushCommands.fs index e532463..938ca08 100644 --- a/Commands/PushCommands.fs +++ b/Commands/PushCommands.fs @@ -38,9 +38,9 @@ module PushCommands = else ListTextPushOutput.FormattedString(p.Iden, p.Created.ofUnixTimeToDateTime, p.Type, p.Title, p.Body) - HttpService.GetRequest Pushes [ ("limit", limit); ("active", true) ] + HttpService.GetRequest Pushes [ ("limit", $"{limit}"); ("active", $"{true}") ] |> PushListResponse.Parse - |> fun r -> r.Pushes + |> _.Pushes |> Array.map formatPush |> String.concat Environment.NewLine diff --git a/Commands/SubscriptionCommands.fs b/Commands/SubscriptionCommands.fs index e34920d..01c95c0 100644 --- a/Commands/SubscriptionCommands.fs +++ b/Commands/SubscriptionCommands.fs @@ -21,7 +21,7 @@ module SubscriptionCommands = let list () = HttpService.GetListRequest Subscriptions |> SubscriptionListResponse.Parse - |> fun r -> r.Subscriptions + |> _.Subscriptions |> Array.map (fun s -> ListSubscriptionOutput.FormattedString(s.Channel.Tag, s.Channel.Name, s.Channel.Description)) |> String.concat Environment.NewLine diff --git a/Commands/SystemCommands.fs b/Commands/SystemCommands.fs index 03dab11..a59262f 100644 --- a/Commands/SystemCommands.fs +++ b/Commands/SystemCommands.fs @@ -45,7 +45,7 @@ module SystemCommands = let listGrants () = HttpService.GetListRequest "grants" |> GrantListResponse.Parse - |> fun r -> r.Grants + |> _.Grants |> Array.map (fun grant -> ListGrantsOutput.FormattedString( grant.Iden, diff --git a/HttpService.fs b/HttpService.fs index bfbc52c..79f60ec 100644 --- a/HttpService.fs +++ b/HttpService.fs @@ -25,7 +25,7 @@ module HttpService = let private formatException (stream: Stream) = new StreamReader(stream) - |> fun r -> r.ReadToEnd() + |> _.ReadToEnd() |> ErrorResponse.Parse |> fun e -> $"{e.ErrorCode}: {e.Error.Message} {e.Error.Cat}" @@ -63,7 +63,7 @@ module HttpService = |> Ok | Choice2Of2 e -> e |> Response.toStream |> formatException |> Error - let GetRequest (path: string) (query': (string * obj) list) : string = + let GetRequest (path: string) (query': (string * string) list) : string = http { GET $"{BaseUrl}/{path}" query query' diff --git a/Program.fs b/Program.fs index f603efd..4bb7adc 100644 --- a/Program.fs +++ b/Program.fs @@ -101,7 +101,7 @@ module Program = |> SubscriptionCommands.DeleteSubscriptionCommand |> SubscriptionCommands.delete | [ DeleteArgs.Sms s ] -> s |> MessageCommands.DeleteMessageCommand |> MessageCommands.delete - | [ DeleteArgs.Key _ ] -> SystemCommands.deleteKey () + | [ DeleteArgs.Key ] -> SystemCommands.deleteKey () | _ -> subCommand.Parser.PrintUsage() | [ Clip arg ] -> arg |> PushCommands.PushClipCommand |> PushCommands.pushClip diff --git a/Serialization.fs b/Serialization.fs index b7ac812..816ffe9 100644 --- a/Serialization.fs +++ b/Serialization.fs @@ -4,9 +4,10 @@ module Serialization = open System.Text.Json open System.Text.Json.Serialization + open System.Text.Json.Serialization.Metadata let options = - JsonSerializerOptions(PropertyNamingPolicy = JsonNamingPolicy.CamelCase) + JsonSerializerOptions(PropertyNamingPolicy = JsonNamingPolicy.CamelCase, TypeInfoResolver = DefaultJsonTypeInfoResolver()) options.Converters.Add(JsonFSharpConverter()) diff --git a/paket.dependencies b/paket.dependencies index b495cf9..bd4d400 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -1,5 +1,5 @@ source https://api.nuget.org/v3/index.json -framework: net7.0 +framework: net8.0 github CaptnCodr/FSharpExtensions:main ResourceExtension.fs github CaptnCodr/FSharpExtensions:main DateTimeExtension.fs diff --git a/paket.lock b/paket.lock index a7e43a5..d2e0332 100644 --- a/paket.lock +++ b/paket.lock @@ -1,66 +1,58 @@ -RESTRICTION: == net7.0 +RESTRICTION: == net8.0 NUGET remote: https://api.nuget.org/v3/index.json Argu (6.1.1) FSharp.Core (>= 4.3.2) System.Configuration.ConfigurationManager (>= 4.4) - FSharp.Core (7.0.200) - FSharp.Data (6.2) - FSharp.Core (>= 5.0.1) - FSharp.Data.Csv.Core (>= 6.2) - FSharp.Data.Html.Core (>= 6.2) - FSharp.Data.Http (>= 6.2) - FSharp.Data.Json.Core (>= 6.2) - FSharp.Data.Runtime.Utilities (>= 6.2) - FSharp.Data.WorldBank.Core (>= 6.2) - FSharp.Data.Xml.Core (>= 6.2) - FSharp.Data.Csv.Core (6.2) - FSharp.Core (>= 5.0.1) - FSharp.Data.Runtime.Utilities (>= 6.2) - FSharp.Data.Html.Core (6.2) - FSharp.Core (>= 5.0.1) - FSharp.Data.Csv.Core (>= 6.2) - FSharp.Data.Runtime.Utilities (>= 6.2) - FSharp.Data.Http (6.2) - FSharp.Core (>= 5.0.1) - FSharp.Data.Json.Core (6.2) - FSharp.Core (>= 5.0.1) - FSharp.Data.Http (>= 6.2) - FSharp.Data.Runtime.Utilities (>= 6.2) - FSharp.Data.Runtime.Utilities (6.2) - FSharp.Core (>= 5.0.1) - FSharp.Data.Http (>= 6.2) - FSharp.Data.WorldBank.Core (6.2) - FSharp.Core (>= 5.0.1) - FSharp.Data.Http (>= 6.2) - FSharp.Data.Json.Core (>= 6.2) - FSharp.Data.Runtime.Utilities (>= 6.2) - FSharp.Data.Xml.Core (6.2) - FSharp.Core (>= 5.0.1) - FSharp.Data.Http (>= 6.2) - FSharp.Data.Json.Core (>= 6.2) - FSharp.Data.Runtime.Utilities (>= 6.2) - FSharp.SystemTextJson (1.1.23) + FSharp.Core (8.0.100) + FSharp.Data (6.3) + FSharp.Core (>= 5.0.1) + FSharp.Data.Csv.Core (>= 6.3) + FSharp.Data.Html.Core (>= 6.3) + FSharp.Data.Http (>= 6.3) + FSharp.Data.Json.Core (>= 6.3) + FSharp.Data.Runtime.Utilities (>= 6.3) + FSharp.Data.WorldBank.Core (>= 6.3) + FSharp.Data.Xml.Core (>= 6.3) + FSharp.Data.Csv.Core (6.3) + FSharp.Core (>= 5.0.1) + FSharp.Data.Runtime.Utilities (>= 6.3) + FSharp.Data.Html.Core (6.3) + FSharp.Core (>= 5.0.1) + FSharp.Data.Csv.Core (>= 6.3) + FSharp.Data.Runtime.Utilities (>= 6.3) + FSharp.Data.Http (6.3) + FSharp.Core (>= 5.0.1) + FSharp.Data.Json.Core (6.3) + FSharp.Core (>= 5.0.1) + FSharp.Data.Http (>= 6.3) + FSharp.Data.Runtime.Utilities (>= 6.3) + FSharp.Data.Runtime.Utilities (6.3) + FSharp.Core (>= 5.0.1) + FSharp.Data.Http (>= 6.3) + FSharp.Data.WorldBank.Core (6.3) + FSharp.Core (>= 5.0.1) + FSharp.Data.Http (>= 6.3) + FSharp.Data.Json.Core (>= 6.3) + FSharp.Data.Runtime.Utilities (>= 6.3) + FSharp.Data.Xml.Core (6.3) + FSharp.Core (>= 5.0.1) + FSharp.Data.Http (>= 6.3) + FSharp.Data.Json.Core (>= 6.3) + FSharp.Data.Runtime.Utilities (>= 6.3) + FSharp.SystemTextJson (1.2.42) FSharp.Core (>= 4.7) System.Text.Json (>= 6.0) - FsHttp (10.0) + FsHttp (12.0) FSharp.Core (>= 5.0) - Microsoft.Win32.SystemEvents (7.0) - System.Configuration.ConfigurationManager (7.0) - System.Diagnostics.EventLog (>= 7.0) - System.Security.Cryptography.ProtectedData (>= 7.0) - System.Security.Permissions (>= 7.0) - System.Diagnostics.EventLog (7.0) - System.Drawing.Common (7.0) - Microsoft.Win32.SystemEvents (>= 7.0) - System.Security.Cryptography.ProtectedData (7.0.1) - System.Security.Permissions (7.0) - System.Windows.Extensions (>= 7.0) - System.Text.Encodings.Web (7.0) - System.Text.Json (7.0.2) - System.Text.Encodings.Web (>= 7.0) - System.Windows.Extensions (7.0) - System.Drawing.Common (>= 7.0) + System.Configuration.ConfigurationManager (8.0) + System.Diagnostics.EventLog (>= 8.0) + System.Security.Cryptography.ProtectedData (>= 8.0) + System.Diagnostics.EventLog (8.0) + System.Security.Cryptography.ProtectedData (8.0) + System.Text.Encodings.Web (8.0) + System.Text.Json (8.0) + System.Text.Encodings.Web (>= 8.0) GITHUB remote: CaptnCodr/FSharpExtensions DateTimeExtension.fs (69d59606ebf56406174e10ad121c979d4c469f75) diff --git a/pushbullet-cli.fsproj b/pushbullet-cli.fsproj index e65ecb1..6d5cfb8 100644 --- a/pushbullet-cli.fsproj +++ b/pushbullet-cli.fsproj @@ -3,13 +3,13 @@ pb Exe - net7.0 + net8.0 true win-x64 true true true - 0.7.0.0 + 0.8.0.0 From 85218336f0005759aab5f1f2dfbb3b6265570d5d Mon Sep 17 00:00:00 2001 From: Constantin Tews Date: Wed, 15 Nov 2023 16:21:58 +0100 Subject: [PATCH 2/2] Update workflow. --- .github/workflows/build.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b93ca9..e9878e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,9 +11,6 @@ on: jobs: build: - strategy: - fail-fast: false - runs-on: [windows-latest] steps: @@ -22,7 +19,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Install local tools run: dotnet tool restore