|
1 | 1 | # Code Updater
|
2 | 2 |
|
3 |
| -The purpose of this project is to update all code versioning and dependencies below a directory. This is useful when you have a large number of projects that you want to update all at once. This application is assumed to run on a local machine, and then the changes are manually committed to source control. This allows for a more controlled update process, because a developer is meant to manually check the changes before committing them. |
| 3 | +The purpose of this project is to update specific aspects of code below a directory. This is useful when you have a large number of projects that you want to update all at once. This application is assumed to run on a local machine, and then the changes are manually committed to source control. This allows for a more controlled update process, because a developer is meant to manually check the changes before committing them. |
4 | 4 |
|
5 |
| -It would be great to get this to work for all kinds of languages/frameworks someday, but for now it's just .NET and NPM. |
| 5 | +It would be great to get this to work for all kinds of languages/frameworks someday, but for now it's just .NET and a little bit for NPM. |
6 | 6 |
|
7 |
| -## What Updates Are Done |
| 7 | +## What Updates Cane Be Done |
8 | 8 |
|
9 |
| -- Updates .NET *.csproj files to use a specified C# Language Version |
10 |
| -- Updates .NET *.csproj files to use a specified .NET SDK Version (AKA TargetFramework element) |
11 |
| -- Updates all NuGet packages in all *.csproj files to the latest version |
12 |
| -- Updates all NPM packages in all package.json files to the latest version |
| 9 | +- Update .NET *.csproj files to use a specified C# Language Version |
| 10 | +- Update .NET *.csproj files to use a specified .NET SDK Version (AKA TargetFramework element) |
| 11 | +- Enable/Disable .NET Analyzers in all *.csproj files |
| 12 | +- Run `dotnet format` command on all *.csproj files |
| 13 | +- Update all NuGet packages in all *.csproj files to the latest version |
| 14 | +- Add Nuget auditing properties to all *.csproj files |
| 15 | +- Update all NPM packages in all package.json files to the latest version |
13 | 16 |
|
14 | 17 | ## How to Use It
|
15 | 18 |
|
16 |
| -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 steps assumed steps a user would follow. |
| 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. |
17 | 20 |
|
18 | 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.
|
19 | 22 |
|
20 | 23 | 1. Install the application. Choose one:
|
21 |
| - - Install the tool globally by running `dotnet tool install --global ProgrammerAL.Tools.CodeUpdater --version 1.0.0` |
| 24 | + - Install the tool globally by running `dotnet tool install --global ProgrammerAL.Tools.CodeUpdater --version <<version number>>` |
22 | 25 | - Or clone this repository locally
|
23 | 26 | 2. Run the application
|
24 | 27 | - If you installed the tool, run it with the command: `code-updater --config "C:/my-repos/my-app-1"`
|
25 | 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"`
|
26 | 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.
|
27 | 30 | 4. Manually check a diff of all the file changes to ensure everything is as you expect
|
| 31 | + - Make any manual changes you feel you need to |
| 32 | + - If there were any build failures that were caused by the updates, fix those |
28 | 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.
|
29 | 34 |
|
30 | 35 | ## CLI Options
|
@@ -108,7 +113,7 @@ Below are the list of properties in the config file.
|
108 | 113 |
|
109 | 114 | 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.
|
110 | 115 |
|
111 |
| -Ignore all obj and bin folders: |
| 116 | +Ignore all C# `obj` and `bin` folders: |
112 | 117 | - /obj/Debug/
|
113 | 118 | - /obj/Release/
|
114 | 119 | - /bin/Debug/
|
@@ -142,3 +147,14 @@ PowerShell is required as a workaround. The NPM executable on Windows doesn't ru
|
142 | 147 | 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.
|
143 | 148 |
|
144 | 149 |
|
| 150 | +## Update Script Sample |
| 151 | + |
| 152 | +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: |
| 153 | + |
| 154 | +- `code-updater-config.json` |
| 155 | + - Example config file to use when running Code Updater |
| 156 | +- `run-code-updater.ps1` |
| 157 | + - PowerShell script that runs Code Updater one directory up in the tree, using the given `code-updater-config.json` file as config |
| 158 | + |
| 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. |
| 160 | + |
0 commit comments