Skip to content

Commit f4fcbe0

Browse files
committed
Added readme info
1 parent 724daca commit f4fcbe0

File tree

2 files changed

+52
-25
lines changed

2 files changed

+52
-25
lines changed

README.md

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,63 @@ The purpose of this project is to update all code versioning and dependencies be
1313

1414
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.
1515

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.
2127

2228
## CLI Options
2329

24-
- --directory, -d
30+
- --config-file, -d
2531
- 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
3445
- 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.
3546
- 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+
```
4469
4570
## Ignore Patterns
4671

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.
4873

4974
Ignore all obj and bin folders:
5075
- /obj/Debug/
@@ -60,6 +85,8 @@ Ignore packages inside node_modules folder:
6085
- /node_modules/
6186
- \node_modules\
6287

63-
## .NET Standard
88+
## .NET Standard Projects
6489

6590
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.
91+
92+

src/CodeUpdater/CodeUpdater/CodeUpdater.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<PropertyGroup>
1515
<PackAsTool>true</PackAsTool>
16-
<ToolCommandName>code-update</ToolCommandName>
16+
<ToolCommandName>code-updater</ToolCommandName>
1717
</PropertyGroup>
1818

1919
<ItemGroup>

0 commit comments

Comments
 (0)