From 9b046e99d996767f1968ab6ac268c508aaabeffb Mon Sep 17 00:00:00 2001 From: "Dylan R. E. Moonfire" Date: Sat, 11 Sep 2021 14:14:45 -0500 Subject: [PATCH] fix(nuget): updating deployment and dependencies --- package-lock.json | 18 +++++--- package.json | 2 +- release.config.js | 7 ++- .../Globals/ConfigToolGlobalService.cs | 44 +++++++++++++++++++ .../MfGames.ToolBuilder.csproj | 1 + .../MfGames.ToolBuilder.Tests.csproj | 2 +- 6 files changed, 64 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index b8c4cf0..08aea00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "husky": "^7.0.2", "semantic-release": "^17.4.7", "semantic-release-dotnet": "^1.0.0", - "semantic-release-nuget": "^1.1.0" + "semantic-release-nuget": "^1.1.1" } }, "node_modules/@babel/code-frame": { @@ -2193,6 +2193,7 @@ "minimist": "^1.2.5", "neo-async": "^2.6.0", "source-map": "^0.6.1", + "uglify-js": "^3.1.4", "wordwrap": "^1.0.0" }, "bin": { @@ -2592,6 +2593,7 @@ "dev": true, "license": "MIT", "dependencies": { + "graceful-fs": "^4.1.6", "universalify": "^2.0.0" }, "optionalDependencies": { @@ -3936,6 +3938,7 @@ "inBundle": true, "license": "MIT", "dependencies": { + "colors": "^1.1.2", "object-assign": "^4.1.0", "string-width": "^4.2.0" }, @@ -4976,6 +4979,7 @@ "inBundle": true, "license": "MIT", "dependencies": { + "encoding": "^0.1.12", "minipass": "^3.1.0", "minipass-sized": "^1.0.3", "minizlib": "^2.0.0" @@ -6785,9 +6789,9 @@ } }, "node_modules/semantic-release-nuget": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/semantic-release-nuget/-/semantic-release-nuget-1.1.0.tgz", - "integrity": "sha512-Eaqb39E+dPTgYgHif0/P6cUj7IxZxI9e2BgmfE+NkRlPArpRPa94UZTi8UFMbEKiKg0IaNnAO79yexUPcZnuHA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/semantic-release-nuget/-/semantic-release-nuget-1.1.1.tgz", + "integrity": "sha512-FtkGKQKSPLCelMBh3q0eIKRban6mnDiWT3n4vukP11h3dov2lp7Ij36YbsXUX0pKrdlcS/bWPjzpgKrSHQ4hrg==", "dev": true }, "node_modules/semantic-release/node_modules/get-stream": { @@ -11943,9 +11947,9 @@ } }, "semantic-release-nuget": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/semantic-release-nuget/-/semantic-release-nuget-1.1.0.tgz", - "integrity": "sha512-Eaqb39E+dPTgYgHif0/P6cUj7IxZxI9e2BgmfE+NkRlPArpRPa94UZTi8UFMbEKiKg0IaNnAO79yexUPcZnuHA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/semantic-release-nuget/-/semantic-release-nuget-1.1.1.tgz", + "integrity": "sha512-FtkGKQKSPLCelMBh3q0eIKRban6mnDiWT3n4vukP11h3dov2lp7Ij36YbsXUX0pKrdlcS/bWPjzpgKrSHQ4hrg==", "dev": true }, "semver": { diff --git a/package.json b/package.json index c50c8b9..77e2bcf 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,6 @@ "husky": "^7.0.2", "semantic-release": "^17.4.7", "semantic-release-dotnet": "^1.0.0", - "semantic-release-nuget": "^1.1.0" + "semantic-release-nuget": "^1.1.1" } } diff --git a/release.config.js b/release.config.js index e0233f1..9184c5d 100644 --- a/release.config.js +++ b/release.config.js @@ -5,7 +5,12 @@ module.exports = { "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", "@semantic-release/npm", - "semantic-release-dotnet", + [ + "semantic-release-dotnet", + { + paths: ["src/Directory.Build.props"], + }, + ], [ "semantic-release-nuget", { diff --git a/src/MfGames.ToolBuilder/Globals/ConfigToolGlobalService.cs b/src/MfGames.ToolBuilder/Globals/ConfigToolGlobalService.cs index 2534b30..426fec5 100644 --- a/src/MfGames.ToolBuilder/Globals/ConfigToolGlobalService.cs +++ b/src/MfGames.ToolBuilder/Globals/ConfigToolGlobalService.cs @@ -2,8 +2,12 @@ using System; using System.CommandLine; using System.IO; +using MfGames.IO.Extensions; + using Microsoft.Extensions.Configuration; +using Newtonsoft.Json; + namespace MfGames.ToolBuilder.Globals { /// @@ -109,6 +113,27 @@ namespace MfGames.ToolBuilder.Globals } } + /// + /// Reads the default configuration file and returns it as a + /// deserialized object. + /// + /// A type that represents the configuration file. + /// The resulting file. + public TType? ReadDefaultConfigFile() + { + FileInfo? file = this.DefaultConfigFile; + + if (!file.Exists) + { + return default; + } + + var json = file.ReadAllText(); + TType result = JsonConvert.DeserializeObject(json); + + return result; + } + /// /// Sets the internal name of the application, used for the /// configuration path. @@ -122,5 +147,24 @@ namespace MfGames.ToolBuilder.Globals this.InternalName = internalName; return this; } + + /// + /// Writes the given object to the default configuration file. + /// + /// A type that represents the configuration file. + public void WriteDefaultConfigFile(TType value) + { + // Get the file and make sure the directory containing it exists. + FileInfo file = this.DefaultConfigFile; + + file.Directory?.CreateIfMissing(); + + // Write it out. + string json = JsonConvert.SerializeObject( + value, + Formatting.Indented); + + file.WriteAllText(json); + } } } diff --git a/src/MfGames.ToolBuilder/MfGames.ToolBuilder.csproj b/src/MfGames.ToolBuilder/MfGames.ToolBuilder.csproj index 29c0091..47cc525 100644 --- a/src/MfGames.ToolBuilder/MfGames.ToolBuilder.csproj +++ b/src/MfGames.ToolBuilder/MfGames.ToolBuilder.csproj @@ -14,6 +14,7 @@ + diff --git a/tests/MfGames.ToolBuilder.Tests/MfGames.ToolBuilder.Tests.csproj b/tests/MfGames.ToolBuilder.Tests/MfGames.ToolBuilder.Tests.csproj index 405e71f..17768b1 100644 --- a/tests/MfGames.ToolBuilder.Tests/MfGames.ToolBuilder.Tests.csproj +++ b/tests/MfGames.ToolBuilder.Tests/MfGames.ToolBuilder.Tests.csproj @@ -11,7 +11,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + all