You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -34,78 +34,125 @@ There are 2 ways to run this. As a .NET Tool installed on your machine, or downl
34
34
35
35
## CLI Options
36
36
37
-
-`-d|--config`
37
+
-`-o|--options`
38
38
- Required
39
39
- Path to the file to use for config values when updating code
40
40
-`-h|--help`
41
41
- Outputs CLI help
42
42
43
-
## Config File
43
+
## Options File
44
44
45
-
The config file holds all values to determine what changes to make. The reason this is separate from CLI input arguments is to let a developer store this config in different repos but have this .NET Tool installed globally on their machine. That makes it easy to let other developers run this tool with specific settings for each repository, while only needing to provide a single CLI input argument.
45
+
This is a config file used by the app to determine what updates to run. It is composed of different objects which enable update features. Setting an object means that feature will run, leaving it null will disable that update feature.
46
46
47
-
Below are the list of properties in the config file.
48
47
49
-
-RootDirectory
48
+
-UpdatePathOptions
50
49
- Required
51
-
- Root directory to run from. Code Updater will search all child directories within this for projects to update.
52
-
- IgnorePatterns
53
-
- Required
54
-
- String to ignore within file paths when looking for projects to update. This is OS sensitive, so use \ as the path separator for Windows, and / as the path separator everywhere else. Eg: `\my-skip-path\` will ignore all projects that have the text `\my-skip-path\` within the full path. Note this example will only happen on Windows because that uses backslashes for path separators.- NpmBuildCommand
55
-
- NpmBuildCommand
56
-
- Required
57
-
- After upgrading all of the code, this application will attempt to build all applications it updated. This option sets the npm command to run to do the build.
58
-
- Npm command to run to "compile" the npm directory. Default value is `publish`. Format run is: npm run <npmBuildCommand>.
59
-
- DotNetTargetFramework
60
-
- Required
61
-
- Target Framework to set in all *.CsProj files
62
-
- DotNetLangVersion
63
-
- Required
64
-
- C# language version to set in all *.CsProj files
65
-
- EnableNetAnalyzers
66
-
- Required
67
-
- Boolean value to set the `EnableNetAnalyzers` csproj element to. If the `EnableNetAnalyzers` element does not exist in the project file, it will be added.
68
-
- EnforceCodeStyleInBuild
69
-
- Required
70
-
- Boolean value to set the `EnforceCodeStyleInBuild` csproj element to. If the `EnableNetAnalyzers` element does not exist in the project file, it will be added.
71
-
- RunDotnetFormat
72
-
- Required
73
-
- True to run the `dotnet format` command on all csproj files
74
-
- NugetAudit
75
-
- Required
76
-
- This is an object with 3 properties, each is required. For more information see the Microsoft documentation at https://learn.microsoft.com/en-us/nuget/concepts/auditing-packages#configuring-nuget-audit
77
-
- NuGetAudit
78
-
- Boolean to enable/disable the NuGet Audit features. Note that even if this is set to false, you still need to provide values for the other 2 properties even though they won't be used.
79
-
- AuditMode
80
-
- String. Which mode to audit, `direct` dependencies, or `all` dependencies.
81
-
- AuditLevel
82
-
- String. Minimum severity level to report. Ex: If you set it to moderate, you get `moderate`, `high`, and `critical` advisories. If you set it to `low`, you get all advisories.
83
-
- OutputFile
50
+
- This object holds settings for what to update
51
+
- Properties:
52
+
- RootDirectory
53
+
- Root directory to run from. Code Updater will search all child directories within this for projects to update.
54
+
- IgnorePatterns
55
+
- String to ignore within file paths when looking for projects to update. This is OS sensitive, so use \ as the path separator for Windows, and / as the path separator everywhere else. Eg: `\my-skip-path\` will ignore all projects that have the text `\my-skip-path\` within the full path. Note this example will only happen on Windows because that uses backslashes for path separators.- NpmBuildCommand
56
+
- LoggingOptions
57
+
- Optional
58
+
- Options for output logging of the operation
59
+
- Required Properties:
60
+
- OutputFile
61
+
- If this is set, it will be the file to write logs to, in addition to the console
- If this is set, it will be the file to write logs to, in addition to the console
86
-
- LogLevel
66
+
- This stores different options for what updates to perform on C# code
67
+
- Child Objects:
68
+
- CsProjVersioningOptions
69
+
- Optional
70
+
- Versioning options for csproj files
71
+
- Required Properties:
72
+
- TargetFramework
73
+
- String. Target Framework to set in all *.csproj files
74
+
- LangVersion
75
+
- String. C# language version to set in all *.csproj files
76
+
- TreatWarningsAsErrors
77
+
- Boolean. The value to set for the TreatWarningsAsErrors flag in all *.csproj files
78
+
- CsProjDotNetAnalyzerOptions
79
+
- .NET Analyzer settings to set in all csproj files
80
+
- Required Properties:
81
+
- EnableNetAnalyzers
82
+
- Boolean. True to set the `EnableNetAnalyzers` csproj value to true, false to set it to false
83
+
- EnforceCodeStyleInBuild
84
+
- Boolean. True to set the `EnforceCodeStyleInBuild` csproj value to true, false to set it to false
85
+
- CSharpStyleOptions
86
+
- Options for any code styling updates that will be performed over C# code
87
+
- Required Properties:
88
+
- RunDotnetFormat
89
+
- Boolean. True to run the `dotnet format` command
90
+
- NugetAuditOptions
91
+
- Settings to use for configuring Nuget Audit settings in csproj files. You can read more at https://learn.microsoft.com/en-us/nuget/concepts/auditing-packages#configuring-nuget-audit
92
+
- Required Properties:
93
+
- NuGetAudit
94
+
- Boolean. What value to set for the `NuGetAudit` property in the csproj file.
95
+
- AuditMode
96
+
- String. What value to set for the `NuGetAuditMode` property in the csproj file. Valid values are `direct` and `all`.
97
+
- AuditLevel
98
+
- String. What value to set for the `NuGetAuditLevel` property in the csproj file. Valid values are: `low`, `moderate`, `high`, and `critical`
99
+
- NuGetUpdateOptions
100
+
- Settings to use for updating NuGet packages in csproj files
101
+
- Required Properties:
102
+
- UpdateTopLevelNugetsInCsProj
103
+
- Boolean. True to updates all referenced nugets to the latest version. These are the references in the csproj files.
104
+
- UpdateTopLevelNugetsNotInCsProj
105
+
- Boolean. True to updates all indirect nugets to the latest version. These are the nugets that are referenced automatically based on SDK chosen or something like that.
The tool is very opinionated. It updates all packages to the latest version, and sets some project level properties. If the tool does some things you can't use for your projects, you can download the code, make changes, and keep thay for yourself. Maybe in the future we can hide certain settings behind a flag. Feel free to file an issue and and we can discuss it.
179
+
The tool can be very opinionated. When updating packages it will only update to the latest version. If the tool does some things you can't use for your projects, you can download the code, make changes, and keep that for yourself (OSS FTW). If this is something you have to do, feel free to file an issue in the repo and and we can discuss it.
133
180
134
181
## Required 3rd Party Software
135
182
@@ -140,13 +187,12 @@ In order to run the tool you need the following software installed on your local
140
187
- PowerShell
141
188
- Quick Reminder: PowerShell is cross platform, you can run it on Linux and MacOS, not just Windows
142
189
143
-
PowerShell is required as a workaround. The NPM executable on Windows doesn't run like other applications. It doesn't exit like a normal process. I don't know why, I never spent the time figuring it out. The workaround makes PowerShell the host application so it exits like you would expect, when the process is done. For this reason, whenever an external process must be run, it's run through PowerShell. Kind of a hack, but it works well enough.
190
+
PowerShell is required as a workaround. The NPM executable on Windows doesn't run like other applications, and as a result, on Windows, it doesn't exit like a normal process. I don't know why, I never spent the time figuring it out. The workaround makes PowerShell the host application so it exits like you would expect, when the process is done. For this reason, whenever an external process must be run, it's run through PowerShell. It's a hack, but it works well enough.
144
191
145
192
## .NET Standard Projects
146
193
147
194
When updating *.csproj files to a specific `TargetFramework` version, the project is skipped if using .NET Standard. Those are usually set for a specific level of API compatibility so we don't want to mess with those.
148
195
149
-
150
196
## Update Script Sample
151
197
152
198
You can create a script to make it easy to run Code Updater on a regular basis. A sample PowerShell script to do that is in the `/code-update-runner-sample` directory of this repo. It has the below files:
@@ -156,5 +202,5 @@ You can create a script to make it easy to run Code Updater on a regular basis.
156
202
-`run-code-updater.ps1`
157
203
- PowerShell script that runs Code Updater one directory up in the tree, using the given `code-updater-config.json` file as config
158
204
159
-
Feel free to use those files as a base, and modify them for your repositories as needed. For extra points, commit them to your repository too.
205
+
Feel free to use those files as a base, and modify them for your repositories as needed. For extra points, commit them to your repository to make it easy to use in the future.
0 commit comments