Skip to content

Commit

Permalink
update website copy of doc
Browse files Browse the repository at this point in the history
  • Loading branch information
belav authored Jun 16, 2024
1 parent 3d6f93a commit d388ca4
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions Src/Website/docs/Pre-commit.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,12 @@ repos:
From the root of your repository
```bash
cd <Your project root directory>
dotnet new tool-manifest
dotnet tool install husky
dotnet husky install
```

Optionally - add this to one of your projects to automate the install for future developers
```xml
<!-- set HUSKY to 0 in CI/CD disable this -->
<Target Name="husky" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(HUSKY)' != 0">
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High"/>
<Exec Command="dotnet husky install" StandardOutputImportance="Low" StandardErrorImportance="High"
<!-- update this to be the root of your solution -->
WorkingDirectory="../../" />
</Target>
```

Modify the file at `.husky/task-runner.json`
```json
{
Expand All @@ -85,6 +76,12 @@ You can run and test your task with the following command.
dotnet husky run
```

Optionally - add this to one of your projects to automate the installation for future developers
You can set the HUSKY environment variable to 0 to disable Husky in CI/CD pipelines.
```bash
dotnet husky attach <path-to-project-file>
```

Once you are sure the task is working properly, you can add it as a pre-commit hook.
```bash
dotnet husky add pre-commit -c "dotnet husky run"
Expand Down

0 comments on commit d388ca4

Please sign in to comment.