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
+51-24Lines changed: 51 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,38 +13,63 @@ The purpose of this project is to update all code versioning and dependencies be
13
13
14
14
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 to take.
15
15
16
-
1. Clone the repository locally
17
-
1. Run the application using dotnet run. Pass in the required arguments. Example: `dotnet run -- --directory "C:\my-repos/my-app-1" --ignorePatterns "\ignore-path-1\" --ignorePatterns "\ignore-path-2\"`
18
-
1. Wait for the application to finish. It will output the number of projects updated, and the number of projects that failed to update.
19
-
1. Manually check a diff of all the projects to ensure everything is as you expect
20
-
1. Commit the code changes to source control. Wait for a CI/CD pipeline to run and ensure everything is still working as expected.
16
+
There are 2 ways to run this. As a .NET Tool installed on your machine, or downloading the repository and running the code yourself.
17
+
18
+
1. Install the application
19
+
- Install the tool globally by running `todo`
20
+
- Clone this repository locally
21
+
2. Run the application
22
+
- If you installed the tool, run it with the command: `code-updater --config-file "C:/my-repos/my-app-1"`
23
+
- 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-file "C:/my-repos/my-app-1"`
24
+
3. Wait for the application to finish. It will output the number of projects updated, and the number of projects that failed to update.
25
+
4. Manually check a diff of all the projects to ensure everything is as you expect
26
+
5. Commit the code changes to source control. Wait for a CI/CD pipeline to run and ensure everything is still working as expected.
21
27
22
28
## CLI Options
23
29
24
-
- --directory, -d
30
+
- --config-file, -d
25
31
- Required
26
-
- Root directory to search within for all projects to update
27
-
- --ignorePatterns, -p
28
-
- Optional
29
-
- Allows Multiples
30
-
- 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.
31
-
- --npmBuildCommand, -n
32
-
- Optional
33
-
- Default Value: `publish`
32
+
- Path to the file to use for config values when updating code
33
+
34
+
## Config File
35
+
36
+
The config file holds all values to determine what changes to make to code files. 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.
37
+
38
+
Below are the list of properties in the config file. All fields are required.
39
+
40
+
- RootDirectory
41
+
- Root directory to run from. Code Updater will search all child directories within this for projects to update.
42
+
- IgnorePatterns
43
+
- 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
44
+
- NpmBuildCommand
34
45
- 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.
35
46
- Npm command to run to "compile" the npm directory. Default value is `publish`. Format run is: npm run <npmBuildCommand>.
36
-
- --dotnetTargetFramework, -t
37
-
- Optional
38
-
- Default Value: `net8.0`
39
-
- Target Framework to set in all *.CsProj files. Default value is `net8.0`
40
-
- --dotnetLangVersion, -l
41
-
- Optional
42
-
- Default Value: `latest`
43
-
- C# language version to set in all *.CsProj files. Default value is `latest`
47
+
- DotNetTargetFramework
48
+
- Target Framework to set in all *.CsProj files
49
+
- DotNetLangVersion
50
+
- C# language version to set in all *.CsProj files
51
+
- EnableNetAnalyzers
52
+
- Boolean value to set the `EnableNetAnalyzers` csproj element to. If the `EnableNetAnalyzers` element does not exist in the project file, it will be added.
53
+
- EnforceCodeStyleInBuild
54
+
- Boolean value to set the `EnforceCodeStyleInBuild` csproj element to. If the `EnableNetAnalyzers` element does not exist in the project file, it will be added.
55
+
56
+
### Example Config File
57
+
58
+
```json
59
+
{
60
+
"RootDirectory": "C:/my-repos/my-app-1",
61
+
"IgnorePatterns": [],
62
+
"NpmBuildCommand": "publish",
63
+
"DotNetTargetFramework": "net8.0",
64
+
"DotNetLangVersion": "latest",
65
+
"EnableNetAnalyzers": true,
66
+
"EnforceCodeStyleInBuild": true
67
+
}
68
+
```
44
69
45
70
## Ignore Patterns
46
71
47
-
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` input argument. As of right now, there is no way to remove these.
72
+
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.
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.
0 commit comments