Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add package with build tasks to format on build #200

Merged
merged 13 commits into from
May 24, 2021

Conversation

shocklateboy92
Copy link
Collaborator

My coworkers are (pretty much) guaranteed forget to run the dotnet tool command, so I want to run it for them automatically during build.

This creates a nuget package that injects a build task that formats before build. Assuming you're fine with the approach, you'll need to update the metadata of the package and update the github actions to publish it too.

@belav
Copy link
Owner

belav commented May 16, 2021

As someone who is guilty of forgetting to prettier my files all the time at work without a file watcher, I love it.

Personally, I'd want to run this for debug, and then run it with --check during release. Although doing the --check as a build step might be a little weird because it makes it harder for someone to run release code locally.

My original thought was we should add some properties to support situations like that.

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
  <CSharpier_Disable>true</CSharpier_Disable>// maybe CSharpier_Enable?
  <CSharpier_Check>true</CSharpier_Check>
</PropertyGroup>

On the other hand you can always run the check as a separate github action, like .github/workflows/validatePR.yml, so maybe we don't need to worry about adding properties right now.

I believe this depends on #181 to support .csharpierrc and .csharpierignore, which I was going to work on in the next day or two.

@belav
Copy link
Owner

belav commented May 17, 2021

I think this is what is needed to publish the msbuild project. I haven't tested out trying to reference this nuget package in a project yet.
The readme should also get updated, but I'm about to split that apart

<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../CSharpier.Targets"/>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need the netstandard2.0 here. Otherwise it can't be used to format projects that don't also target net5.0 themselves

@belav
Copy link
Owner

belav commented May 18, 2021

closes #218

@belav belav merged commit 25d7abe into belav:master May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants