Skip to content

Commit

Permalink
⬆️ Upgrade connorjs-analyzers (#5)
Browse files Browse the repository at this point in the history
Upgrades `connorjs-analyzers` and reorganizes properties. Adds CSharpier,
applies formatting, and documents targets mindset.
  • Loading branch information
connorjs authored Jul 28, 2024
1 parent 1d86ea9 commit cc13994
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,15 @@ Most other configuration files live in the root directory.
The solution view offers an alternative display of the workspace.
It reorganizes the root configuration files into `client`, `server`, and `shared` under the `files` solution folder.
It groups all projects together under the `projects` solution folder (no `client` and `server` separation).

## Targets

The workspace uses the standard `dotnet` targets for both .NET and npm.

- `restore` installs dependencies
- `build` compiles, lints, and builds the projects
- `test` runs unit tests with coverage

.NET uses `build` for Analyzers and formatting (via `CSharpier.MSBuild`), so npm uses `build` for ESLint, tsc, and Prettier.

`dotnet format` exists to help auto-fix, but is not used to verify the build.
36 changes: 10 additions & 26 deletions server/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,46 +1,30 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)../Workspace.props" />

<!-- MSBuild properties (general) -->
<!-- https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-properties -->
<PropertyGroup>
<!-- Configure test property (used by connorjs-analyzers and more) -->
<IsTestProject>$(MSBuildProjectName.EndsWith('test'))</IsTestProject>

<!-- Artifacts -->
<ArtifactsPath>$(WorkspaceRoot)artifacts</ArtifactsPath>
</PropertyGroup>

<!-- MSBuild properties (for .NET) -->
<!-- https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props -->
<PropertyGroup>
<!-- Framework properties -->
<TargetFramework>net8.0</TargetFramework>

<!-- Publish related -->
<IsPublishable>false</IsPublishable> <!-- Private -->

<!-- Reference -->
<DisableTransitiveProjectReferences>true</DisableTransitiveProjectReferences> <!-- Prefer explicit dependencies -->

<!-- Code generation -->
<ImplicitUsings>disable</ImplicitUsings> <!-- Prefer explicit usings -->
</PropertyGroup>

<!-- C# compiler options -->
<!-- https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/ -->
<PropertyGroup>
<!-- Language -->
<Nullable>enable</Nullable>

<!-- Code generation -->
<Deterministic>true</Deterministic>
</PropertyGroup>

<!-- Unit test properties -->
<PropertyGroup Condition="$(MSBuildProjectName.EndsWith('test'))">
<PropertyGroup Condition="$(IsTestProject)">
<!-- Coverage arguments -->
<TestingPlatformCommandLineArguments>--coverage --coverage-output $(MSBuildProjectName).cobertura.xml --coverage-settings $(WorkspaceRoot)coverage.runsettings --results-directory $(WorkspaceRoot)coverage</TestingPlatformCommandLineArguments>
</PropertyGroup>

<!-- Unit test usings -->
<ItemGroup Condition="$(MSBuildProjectName.EndsWith('test'))">
<ItemGroup Condition="$(IsTestProject)">
<!-- Allow internal for unit tests -->
<AssemblyAttribute Include="Microsoft.VisualStudio.TestTools.UnitTesting.DiscoverInternalsAttribute" />

<!-- Usings -->
<Using Include="FluentAssertions" />
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
</ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions server/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="connorjs-analyzers" Version="0.2.3" />
<GlobalPackageReference Include="connorjs-analyzers" Version="0.3.1" />
<GlobalPackageReference Include="CSharpier.MsBuild" Version="0.28.2" />
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion server/hello-cs-test/hello-cs-test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\hello-cs\hello-cs.csproj" />
<ProjectReference Include="../hello-cs/hello-cs.csproj" />
</ItemGroup>
</Project>
5 changes: 4 additions & 1 deletion server/hello-cs/HelloUtility.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace Connorjs.DotNetWithEsprojExample.Hello;
namespace Connorjs.DotNetWithEsprojExample.Hello;

/// <summary>
/// Example “Hello, world!” class.
/// </summary>
public static class HelloUtility
{
/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions server/hello-cs/hello-cs.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>Connorjs.DotNetWithEsprojExample.Hello</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<RootNamespace>Connorjs.DotNetWithEsprojExample.Hello</RootNamespace>
</PropertyGroup>
</Project>

0 comments on commit cc13994

Please sign in to comment.