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
Copy file name to clipboardExpand all lines: README.md
+44-34Lines changed: 44 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,54 +16,54 @@ It would be great to get this to work for all kinds of languages/frameworks some
16
16
17
17
## How to Use It
18
18
19
-
Remember, the purpose of this is to update code. It is assumed, and recommended, a developer runs this locally and verifies the changes before comitting to source control. Below are the assumed steps a user would follow.
19
+
Remember, the purpose of this is to update code and dependencies. It is assumed, and recommended, a developer runs this locally and verifies the changes before comitting the changes to source control. Below are the assumed steps a user would follow.
20
20
21
-
There are 2 ways to run this. As a .NET Tool installed on your machine, or downloading the repository and running the code yourself.
22
-
23
-
1. Install the application. Choose one:
21
+
1. Install the Tool
24
22
- Install the tool globally by running `dotnet tool install --global ProgrammerAL.Tools.CodeUpdater --version <<version number>>`
25
-
- Or clone this repository locally
26
-
2. Run the application
27
-
- If you installed the tool, run it with the command: `code-updater --config "C:/my-repos/my-app-1"`
28
-
- If you downloaded the code, open a terminal to the `~/src/CodeUpdater/CodeUpdater` directory and run the application using dotnet run while passing in the required arguments. Example: `dotnet run -- --config "C:/my-repos/my-app-1"`
29
-
3. Wait for the application to finish. It will output the number of projects updated, and the number of projects that failed to update.
30
-
4. Manually check a diff of all the file changes to ensure everything is as you expect
23
+
2. Create an Options File
24
+
- The options file specifys what updates to run on the code
25
+
- Instructions on how to create the file are below. See the `Options File` and `Example Options File` sections
26
+
3. Run the Tool
27
+
- Run it with the command: `code-updater --options "C:/my-repos/my-app-1/my-options-file.json"`
28
+
4. Wait for the application to finish. It will output the number of projects updated, and the number of projects that failed to update.
29
+
5. Manually check a diff of all the file changes to ensure everything is as you expect
31
30
- Make any manual changes you feel you need to
32
31
- If there were any build failures that were caused by the updates, fix those
33
-
5. Commit the code changes to source control. Wait for a CI/CD pipeline to run and ensure everything is still working as expected.
32
+
6. Commit the code changes to source control. Wait for a CI/CD pipeline to run and ensure everything is still working as expected. You do have a CI/CD pipeline, right?
34
33
35
34
## CLI Options
36
35
37
36
-`-o|--options`
38
-
- Required
39
-
- Path to the file to use for config values when updating code
37
+
- Path to the options file to use for updating code
40
38
-`-h|--help`
41
39
- Outputs CLI help
42
40
43
41
## Options File
44
42
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
-
43
+
This is a config file used by the app to determine what updates to run. It is composed of different objects which enable certain update features. Setting an object means that feature will run. Omitting it from the file will disable that update feature.
47
44
48
45
- UpdatePathOptions
49
46
- Required
50
-
- This object holds settings for what to update
47
+
- This object determines what will be updated based on file paths
51
48
- Properties:
52
49
- RootDirectory
53
50
- Root directory to run from. Code Updater will search all child directories within this for projects to update.
54
51
- 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
52
+
- Strings 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. Ex: `\my-skip-path\` will ignore all projects that have the text `\my-skip-path\` within the full path. Note this example will only work on Windows because that uses backslashes for path separators.
56
53
- LoggingOptions
57
54
- Optional
58
-
- Options for output logging of the operation
59
-
-Required Properties:
55
+
- Options for output logging of the tool
56
+
- Properties:
60
57
- OutputFile
61
-
- If this is set, it will be the file to write logs to, in addition to the console
58
+
- Optional
59
+
- Path to a file to write logs to. Note that logs are always written to the console, even if you choose to output to a file.
- This stores different options for what updates to perform on C# code
66
+
- This stores different objects, each are a set of options for what updates to perform on C# code and csproj files
67
67
- Child Objects:
68
68
- CsProjVersioningOptions
69
69
- Optional
@@ -76,18 +76,21 @@ This is a config file used by the app to determine what updates to run. It is co
76
76
- TreatWarningsAsErrors
77
77
- Boolean. The value to set for the TreatWarningsAsErrors flag in all `*.csproj` files
78
78
- CsProjDotNetAnalyzerOptions
79
-
- .NET Analyzer settings to set in all `*.csproj` files
79
+
- Optional
80
+
- .NET First Party Analyzer settings to set in all `*.csproj` files. You can read more at https://learn.microsoft.com/en-us/visualstudio/code-quality/install-net-analyzers?view=vs-2022
80
81
- Required Properties:
81
82
- EnableNetAnalyzers
82
-
- Boolean. True to set the `EnableNetAnalyzers` csproj value to true, false to set it to false
83
+
- Boolean. Value to set the `EnableNetAnalyzers` csproj value to
83
84
- EnforceCodeStyleInBuild
84
-
- Boolean. True to set the `EnforceCodeStyleInBuild` csproj value to true, false to set it to false
85
+
- Boolean. Value to set the `EnforceCodeStyleInBuild` csproj value to
85
86
- CSharpStyleOptions
87
+
- Optional
86
88
- Options for any code styling updates that will be performed over C# code
87
89
- Required Properties:
88
90
- RunDotnetFormat
89
91
- Boolean. True to run the `dotnet format` command
90
92
- NugetAuditOptions
93
+
- Optional
91
94
- 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
95
- Required Properties:
93
96
- NuGetAudit
@@ -97,6 +100,7 @@ This is a config file used by the app to determine what updates to run. It is co
97
100
- AuditLevel
98
101
- String. What value to set for the `NuGetAuditLevel` property in the csproj file. Valid values are: `low`, `moderate`, `high`, and `critical`
99
102
- NuGetUpdateOptions
103
+
- Optional
100
104
- Settings to use for updating NuGet packages in csproj files
101
105
- Required Properties:
102
106
- UpdateTopLevelNugetsInCsProj
@@ -105,11 +109,15 @@ This is a config file used by the app to determine what updates to run. It is co
105
109
- 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.
106
110
- NpmOptions
107
111
- Optional
108
-
- Options for updating Npm packages
109
-
- Required Properties:
110
-
- NpmBuildCommand
111
-
- NpmBuildCommand
112
-
- String. Npm command to \"compile\" the npm directory. Format of the command run is: `npm run {{NpmBuildCommand}}`
112
+
- Options for updating Npm packages. If this is not set, NPM packages will not be updated
113
+
- Properties:
114
+
- NpmCompileOptions
115
+
- Optional
116
+
- Options for compiling Npm packages after updates. Note if this is not set, but the parent NpmOptions is set, NPM Packages will be updated but not tested with a compile.
117
+
- Required Properties:
118
+
- NpmBuildCommand
119
+
- NpmBuildCommand
120
+
- String. Npm command to "compile" the npm directory. The CLI command that will be run is: `npm run {{NpmBuildCommand}}`
113
121
114
122
115
123
### Example Options File
@@ -151,14 +159,16 @@ This is a config file used by the app to determine what updates to run. It is co
151
159
}
152
160
},
153
161
"NpmOptions": {
154
-
"NpmBuildCommand": "publish"
162
+
"NpmCompileOptions":{
163
+
"NpmBuildCommand": "publish"
164
+
}
155
165
}
156
166
}
157
167
```
158
-
168
+
159
169
## Ignore Patterns
160
170
161
-
The Code Updater application has a default set of paths to ignore. The list is below. Note that all paths are in the list using both forwardslashes and backslashes. These are in addition to any skip paths passed in with the `IgnorePatterns` config file property. As of right now, there is no way to remove these.
171
+
The Code Updater application has a default set of paths to ignore. The list is below. Note that all paths are in the list using both forwardslashes and backslashes. These are in addition to any skip paths passed in with the `IgnorePatterns` config file property. There is no way to remove these. Think of these like an ignore file, but no wildcard syntax. it's just basic string matching.
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.
189
+
The tool can be very opinionated. For example, 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. Maybe a change you need can be incorporated into the project.
/// Npm command to \"compile\" the npm directory. Format run is: npm run <NpmBuildCommand>.
52
+
/// Options for compiling Npm packages after updates. Note if this is not set, but the parent NpmOptions is set, NPM Packages will be updated but not tested with a compile.
/// .NET Analyzer settings to set in all csproj files
74
+
/// .NET First Party Analyzer settings to set in all `*.csproj` files. You can read more at https://learn.microsoft.com/en-us/visualstudio/code-quality/install-net-analyzers?view=vs-2022
0 commit comments