Skip to content

Commit

Permalink
Publish on NuGet (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
pisolofin committed Aug 13, 2024
1 parent 444f41a commit 1fbfe96
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github: [belav]
github: [pisolofin]
3 changes: 2 additions & 1 deletion .github/workflows/publish_nuget.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Publish Nuget
on:
push:
branches: [ main ]
branches: [ build-fix ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/validate_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Validate Pull Request
on:
pull_request:
branches: [main]
workflow_dispatch:
jobs:
run_tests:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions Nuget/Build.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project>
<PropertyGroup>
<Version>0.28.2</Version>
<Version>0.0.2</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/belav/csharpier</RepositoryUrl>
<RepositoryUrl>https://github.com/pisolofin/csharpier-editorconfig</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Description>CSharpier is an opinionated code formatter for c#.</Description>
<Description>CSharpier is an not opinionated code formatter for c#.</Description>
<PackageIcon>logo.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
Expand Down
47 changes: 10 additions & 37 deletions Nuget/README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,21 @@
CSharpier is an opinionated code formatter for c#. It uses Roslyn to parse your code and re-prints it using its own rules.
The printing process was ported from [prettier](https://github.com/prettier/prettier) but has evolved over time.

CSharpier provides a few basic options that affect formatting and has no plans to add more. It follows the [Option Philosophy](https://prettier.io/docs/en/option-philosophy.html) of prettier.
This is as non opinionated version of [csharpier](https://github.com/belav/csharpier) tool created to add EditorConfig file style guide, allowing users to define and apply custom styling options.

### Quick Start
Install CSharpier globally using the following command.
Install CSharpier-Config globally using the following command.
```bash
dotnet tool install csharpier -g
dotnet tool install csharpier-config -g
```
Then format the contents of a directory and its children with the following command.
```bash
dotnet csharpier .
dotnet csharpier-config .
```

CSharpier can also format [on save in your editor](https://csharpier.com/docs/Editors), as a [pre-commit hook](https://csharpier.com/docs/Pre-commit), as [part of your build](https://csharpier.com/docs/MSBuild) or even [programatically](https://csharpier.com/docs/API). Then you can ensure code was formatted with a [CI/CD tool](https://csharpier.com/docs/ContinuousIntegration).

---

[Read the documentation](https://csharpier.com)
**This is a work in progress project**

[Try it out](https://playground.csharpier.com)
In this branch, I will set up the project with new references in the documentation, as well as handle the deployment and naming of the executable program.

---
All documentation that you find about csharpier is also valid for csharpier-config, you have only to change command like
All documentation you find about `CSharpier` is also valid for `CSharpier-Config`. You only need to adjust the commands accordingly.

### Before
```c#
public class ClassName {
public void CallMethod() {
this.LongUglyMethod("1234567890", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
}
```

### After
```c#
public class ClassName
{
public void CallMethod()
{
this.LongUglyMethod(
"1234567890",
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
);
}
}
```
- `dotnet csharpier` -> `dotnet csharpier-config`
- `dotnet-csharpier` -> `dotnet-csharpier-config`
Binary file added Nuget/csharpier-editorconfig.snk
Binary file not shown.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

# csharpier-config

This is as non opinionated version of [csharpier](https://github.com/belav/csharpier) tool created to add EditorConfig file style guide,
allowing users to define and apply custom styling options.
This is as non opinionated version of [csharpier](https://github.com/belav/csharpier) tool created to add EditorConfig file style guide, allowing users to define and apply custom styling options.

I started implementing these options in a separate branch called [feature/brackets](https://github.com/pisolofin/csharpier-editorconfig/tree/feature/brackets).

Expand Down
2 changes: 1 addition & 1 deletion Scripts/RunLinuxTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
docker run --rm -v ${pwd}:/app -e "NormalizeLineEndings=1" -w /app/tests mcr.microsoft.com/dotnet/sdk:7.0 dotnet test /app/Src/CSharpier.Tests/CSharpier.Tests.csproj --logger:trx

# gross way to run csharpier against the csharpier-repos
#docker run --rm -v ${pwd}:/app -e "NormalizeLineEndings=1" -w /app mcr.microsoft.com/dotnet/sdk:5.0 dotnet ./csharpier/Src/CSharpier/bin/Debug/net6.0/dotnet-csharpier.dll csharpier-repos --skip-write
#docker run --rm -v ${pwd}:/app -e "NormalizeLineEndings=1" -w /app mcr.microsoft.com/dotnet/sdk:5.0 dotnet ./csharpier/Src/CSharpier/bin/Debug/net6.0/dotnet-csharpier-config.dll csharpier-repos --skip-write
2 changes: 1 addition & 1 deletion Shell/ReviewBranch.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function CSH-ReviewBranch {

$repositoryRoot = Join-Path $PSScriptRoot ".."
$csProjectPath = Join-Path $repositoryRoot "Src/CSharpier.Cli/CSharpier.Cli.csproj"
$csharpierDllPath = Join-Path $repositoryRoot "Src/CSharpier.Cli/bin/release/net8.0/dotnet-csharpier.dll"
$csharpierDllPath = Join-Path $repositoryRoot "Src/CSharpier.Cli/bin/release/net8.0/dotnet-csharpier-config.dll"

$location = Get-Location

Expand Down
2 changes: 1 addition & 1 deletion Src/CSharpier.Benchmarks/CSharpier.Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AssemblyOriginatorKeyFile>../../Nuget/csharpier.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>../../Nuget/csharpier-editorconfig.snk</AssemblyOriginatorKeyFile>
<SignAssembly>True</SignAssembly>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Src/CSharpier.Cli.Tests/CSharpier.Cli.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsPackable>false</IsPackable>
<AssemblyOriginatorKeyFile>../../Nuget/csharpier.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>../../Nuget/csharpier-editorconfig.snk</AssemblyOriginatorKeyFile>
<SignAssembly>True</SignAssembly>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Src/CSharpier.Cli.Tests/CliTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ private class CsharpierProcess

public CsharpierProcess()
{
var path = Path.Combine(Directory.GetCurrentDirectory(), "dotnet-csharpier.dll");
var path = Path.Combine(Directory.GetCurrentDirectory(), "dotnet-csharpier-config.dll");

this.command = CliWrap
.Cli.Wrap("dotnet")
Expand Down
2 changes: 1 addition & 1 deletion Src/CSharpier.Cli.Tests/ServerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ServerTests
[Ignore("Not working on GH, test locally on linux?")]
public async Task Stuff()
{
var path = Path.Combine(Directory.GetCurrentDirectory(), "dotnet-csharpier.dll");
var path = Path.Combine(Directory.GetCurrentDirectory(), "dotnet-csharpier-config.dll");

var processStartInfo = new ProcessStartInfo("dotnet", $"{path} --server")
{
Expand Down
6 changes: 3 additions & 3 deletions Src/CSharpier.Cli/CSharpier.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<Import Project="../../Nuget/Build.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<PackageId>CSharpier</PackageId>
<PackageId>CSharpier-Config</PackageId>
<AssemblyName>dotnet-csharpier-config</AssemblyName>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<PackAsTool>true</PackAsTool>
<AssemblyOriginatorKeyFile>../../Nuget/csharpier.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>../../Nuget/csharpier-editorconfig.snk</AssemblyOriginatorKeyFile>
<SignAssembly>True</SignAssembly>
<PublicKey>002400000480000094000000060200000024000052534131000400000100010049d266ea1aeae09c0abfce28b8728314d4e4807126ee8bc56155a7ddc765997ed3522908b469ae133fc49ef0bfa957df36082c1c2e0ec8cdc05a4ca4dbd4e1bea6c17fc1008555e15af13a8fc871a04ffc38f5e60e6203bfaf01d16a2a283b90572ade79135801c1675bf38b7a5a60ec8353069796eb53a26ffdddc9ee1273be</PublicKey>
<PublicKey>0024000004800000940000000602000000240000525341310004000001000100F1336A544482E27A7A6D9EC6DE7C91AD2BF157844B2A02CB6A4EEB11036D42A4B1FE1BC4CA11B882E3E1ACA228CD45A96F1135FD7E18E0C5C4B376244A9115BB63CBEC48884FEB75503A31B6A7B57DD972A65E0D356F589D3AE1292E6D2546B38FE33DF0D42BA71B387783DB5B5C5EA1367FD468112DDFD47FD6CA7AE004C5B2</PublicKey>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Ignore" />
Expand Down
2 changes: 1 addition & 1 deletion Src/CSharpier.MsBuild/CSharpier.MsBuild.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="../../Nuget/Build.props"/>
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<PackageId>CSharpier.MsBuild</PackageId>
<PackageId>CSharpier-Config.MsBuild</PackageId>
<DevelopmentDependency>true</DevelopmentDependency>
<CSharpierOutputDir>../CSharpier.Cli/bin/$(Configuration)/$(TargetFramework)</CSharpierOutputDir>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<CSharpier_FrameworkVersion Condition="'$(CSharpier_FrameworkVersion)' == '' and $([MSBuild]::VersionGreaterThanOrEquals($(NETCoreSdkVersion), '7.0'))">net7.0</CSharpier_FrameworkVersion>
<CSharpier_FrameworkVersion Condition="'$(CSharpier_FrameworkVersion)' == '' and $([MSBuild]::VersionGreaterThanOrEquals($(NETCoreSdkVersion), '6.0'))">net6.0</CSharpier_FrameworkVersion>
<CSharpier_FrameworkVersion Condition="'$(CSharpier_FrameworkVersion)' == ''" Label="Fallback">net8.0</CSharpier_FrameworkVersion>
<CSharpierDllPath>$(MSBuildThisFileDirectory)../tools/csharpier/$(CSharpier_FrameworkVersion)/dotnet-csharpier.dll</CSharpierDllPath>
<CSharpierDllPath>$(MSBuildThisFileDirectory)../tools/csharpier/$(CSharpier_FrameworkVersion)/dotnet-csharpier-config.dll</CSharpierDllPath>
<CSharpierArgs Condition="'$(CSharpier_Check)' == 'true'">$(CSharpierArgs) --check</CSharpierArgs>
<CSharpierArgs Condition="'$(CSharpier_LogLevel)' != ''">$(CSharpierArgs) --loglevel $(CSharpier_LogLevel)</CSharpierArgs>
<FirstTargetFramework Condition=" '$(TargetFrameworks)' == '' ">$(TargetFramework)</FirstTargetFramework>
Expand Down
2 changes: 1 addition & 1 deletion Src/CSharpier.Playground/CSharpier.Playground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<IsPackable>false</IsPackable>
<SpaRoot>ClientApp\</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
<AssemblyOriginatorKeyFile>../../Nuget/csharpier.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>../../Nuget/csharpier-editorconfig.snk</AssemblyOriginatorKeyFile>
<SignAssembly>True</SignAssembly>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Src/CSharpier.Tests/CSharpier.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<IsPackable>false</IsPackable>
<RootNamespace>CSharpier.Tests</RootNamespace>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<AssemblyOriginatorKeyFile>../../Nuget/csharpier.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>../../Nuget/csharpier-editorconfig.snk</AssemblyOriginatorKeyFile>
<SignAssembly>True</SignAssembly>
</PropertyGroup>
<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions Src/CSharpier/CSharpier.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../Nuget/Build.props" />
<PropertyGroup>
<PackageId>CSharpier.Core</PackageId>
<PackageId>CSharpier-Config.Core</PackageId>
<TargetFrameworks>net6.0;net7.0;net8.0;netstandard2.0</TargetFrameworks>
<RootNamespace>CSharpier</RootNamespace>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<AssemblyOriginatorKeyFile>../../Nuget/csharpier.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>../../Nuget/csharpier-editorconfig.snk</AssemblyOriginatorKeyFile>
<SignAssembly>True</SignAssembly>
<PublicKey>002400000480000094000000060200000024000052534131000400000100010049d266ea1aeae09c0abfce28b8728314d4e4807126ee8bc56155a7ddc765997ed3522908b469ae133fc49ef0bfa957df36082c1c2e0ec8cdc05a4ca4dbd4e1bea6c17fc1008555e15af13a8fc871a04ffc38f5e60e6203bfaf01d16a2a283b90572ade79135801c1675bf38b7a5a60ec8353069796eb53a26ffdddc9ee1273be</PublicKey>
<PublicKey>0024000004800000940000000602000000240000525341310004000001000100F1336A544482E27A7A6D9EC6DE7C91AD2BF157844B2A02CB6A4EEB11036D42A4B1FE1BC4CA11B882E3E1ACA228CD45A96F1135FD7E18E0C5C4B376244A9115BB63CBEC48884FEB75503A31B6A7B57DD972A65E0D356F589D3AE1292E6D2546B38FE33DF0D42BA71B387783DB5B5C5EA1367FD468112DDFD47FD6CA7AE004C5B2</PublicKey>
<AssemblyName>$(MSBuildProjectName)-Config</AssemblyName>
</PropertyGroup>
<ItemGroup>
Expand All @@ -34,7 +34,7 @@
<_Parameter1>CSharpier.Tests, PublicKey=$(PublicKey)</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>dotnet-csharpier, PublicKey=$(PublicKey)</_Parameter1>
<_Parameter1>dotnet-csharpier-config, PublicKey=$(PublicKey)</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Tests/MsBuild/Run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ RUN dotnet build -c Release
$csharpierFrameworkVersion
</PropertyGroup>
<ItemGroup>
<PackageReference Include=`"CSharpier.MsBuild`" Version=`"0.0.1`">
<PackageReference Include=`"CSharpier-Config.MsBuild`" Version=`"0.0.1`">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit 1fbfe96

Please sign in to comment.