Skip to content

Commit

Permalink
[WIP] Write the README
Browse files Browse the repository at this point in the history
  • Loading branch information
0xced committed Mar 14, 2024
1 parent 524af06 commit f85b239
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

[![NuGet](https://img.shields.io/nuget/v/Chisel.svg?label=NuGet&logo=NuGet)](https://www.nuget.org/packages/Chisel/) [![Continuous Integration](https://img.shields.io/github/actions/workflow/status/0xced/Chisel/continuous-integration.yml?branch=main&label=Continuous%20Integration&logo=GitHub)](https://github.com/0xced/Chisel/actions/workflows/continuous-integration.yml)

Chisel was born because some database drivers can't resist taking dependencies on cloud libraries. The [MongoDB driver](https://www.nuget.org/packages/MongoDB.Driver) depends on the ASW SDK for authentication with Identity and Access Management (IAM) and [Microsoft's SQL Server driver](https://www.nuget.org/packages/Microsoft.Data.SqlClient) depends on the Azure SDK for authentication with the Microsoft identity platform (formerly Azure AD).

Users have asked for separate NuGet packages for both MongoDB ([issue #4635](https://jira.mongodb.org/browse/CSHARP-4635)) and SqlClient ([issue #1108](https://github.com/dotnet/SqlClient/issues/1108)) but as of `MongoDB.Driver` 2.24.0 and `Microsoft.Data.SqlClient` 5.2.0 the cloud dependencies are unavoidable, even if MongoDB or SQL Server is used on premises (where cloud authentication is obviously not needed).

Enter Chisel to remove those dependencies and save some precious megabytes.

## Getting started

Add the [Chisel](https://www.nuget.org/packages/Chisel/) NuGet package to your project using the NuGet Package Manager or run the following command:
Expand All @@ -12,3 +18,75 @@ Add the [Chisel](https://www.nuget.org/packages/Chisel/) NuGet package to your p
dotnet add package Chisel
```

While Chisel's main purpose is removing unwanted dependencies from existing NuGet packages, it provides another great feature: a graph of your project's dependencies. After adding Chisel, a [Mermaid](https://mermaid.js.org) (or [Graphviz](https://graphviz.org)) graph is written in the intermediate output path (aka the `obj` directory).

For a project referencing the `Hangfire.PostgreSql` and `Npgsql.EntityFrameworkCore.PostgreSQL` packages the graph would look like this.

```mermaid
graph LR
classDef default fill:aquamarine,stroke:#009061
classDef project fill:skyblue,stroke:#05587C
classDef ignored fill:lightgray,stroke:#7A7A7A
classDef removed fill:lightcoral,stroke:#A42A2A
Hangfire.Core --> Newtonsoft.Json
Hangfire.PostgreSql --> Dapper
Hangfire.PostgreSql --> Hangfire.Core
Hangfire.PostgreSql --> Npgsql
Microsoft.EntityFrameworkCore --> Microsoft.EntityFrameworkCore.Abstractions
Microsoft.EntityFrameworkCore --> Microsoft.Extensions.Caching.Memory
Microsoft.EntityFrameworkCore --> Microsoft.Extensions.Logging
Microsoft.EntityFrameworkCore.Relational --> Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.Relational --> Microsoft.Extensions.Configuration.Abstractions
Microsoft.Extensions.Caching.Abstractions --> Microsoft.Extensions.Primitives
Microsoft.Extensions.Caching.Memory --> Microsoft.Extensions.Caching.Abstractions
Microsoft.Extensions.Caching.Memory --> Microsoft.Extensions.DependencyInjection.Abstractions
Microsoft.Extensions.Caching.Memory --> Microsoft.Extensions.Logging.Abstractions
Microsoft.Extensions.Caching.Memory --> Microsoft.Extensions.Options
Microsoft.Extensions.Caching.Memory --> Microsoft.Extensions.Primitives
Microsoft.Extensions.Configuration.Abstractions --> Microsoft.Extensions.Primitives
Microsoft.Extensions.DependencyInjection --> Microsoft.Extensions.DependencyInjection.Abstractions
Microsoft.Extensions.Logging --> Microsoft.Extensions.DependencyInjection
Microsoft.Extensions.Logging --> Microsoft.Extensions.Logging.Abstractions
Microsoft.Extensions.Logging --> Microsoft.Extensions.Options
Microsoft.Extensions.Logging.Abstractions --> Microsoft.Extensions.DependencyInjection.Abstractions
Microsoft.Extensions.Options --> Microsoft.Extensions.DependencyInjection.Abstractions
Microsoft.Extensions.Options --> Microsoft.Extensions.Primitives
Npgsql --> Microsoft.Extensions.Logging.Abstractions
Npgsql.EntityFrameworkCore.PostgreSQL --> Microsoft.EntityFrameworkCore
Npgsql.EntityFrameworkCore.PostgreSQL --> Microsoft.EntityFrameworkCore.Abstractions
Npgsql.EntityFrameworkCore.PostgreSQL --> Microsoft.EntityFrameworkCore.Relational
Npgsql.EntityFrameworkCore.PostgreSQL --> Npgsql
class Dapper default
class Hangfire.Core default
class Hangfire.PostgreSql default
class Microsoft.EntityFrameworkCore default
class Microsoft.EntityFrameworkCore.Abstractions default
class Microsoft.EntityFrameworkCore.Relational default
class Microsoft.Extensions.Caching.Abstractions default
class Microsoft.Extensions.Caching.Memory default
class Microsoft.Extensions.Configuration.Abstractions default
class Microsoft.Extensions.DependencyInjection default
class Microsoft.Extensions.DependencyInjection.Abstractions default
class Microsoft.Extensions.Logging default
class Microsoft.Extensions.Logging.Abstractions default
class Microsoft.Extensions.Options default
class Microsoft.Extensions.Primitives default
class Newtonsoft.Json default
class Npgsql default
class Npgsql.EntityFrameworkCore.PostgreSQL default
```

## Removing the AWS SDK from MongoDB.Driver

## Removing the Azure SDK from Microsoft.Data.SqlClient

## Advanced configuration

* `ChiselEnabled`
* `ChiselGraphName` (`.mmd` or `.mermaid`)
* `ChiselGraphDirection` (`LeftToRight` vs `TopToBottom`)
* `ChiselGraphIncludeVersions`
* `ChiselIgnores`

0 comments on commit f85b239

Please sign in to comment.