|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Layout gotcha |
| 4 | + |
| 5 | +The .sln and all projects live in the nested `PreMailer.Net/` folder, not the repo root. **Run all `dotnet` commands from `./PreMailer.Net/`** (matches `working-directory` in `.github/workflows/dotnetcore.yml`). |
| 6 | + |
| 7 | +``` |
| 8 | +./PreMailer.Net/ <- cwd for dotnet |
| 9 | + PreMailer.Net.sln |
| 10 | + PreMailer.Net/ (library, netstandard2.0 + net461, signed) |
| 11 | + PreMailer.Net.Tests/ (xunit, net9.0) |
| 12 | + Benchmarks/ (BenchmarkDotNet, net9.0, Exe) |
| 13 | +``` |
| 14 | + |
| 15 | +## Commands |
| 16 | + |
| 17 | +From `./PreMailer.Net/`: |
| 18 | + |
| 19 | +- Restore/build: `dotnet restore` then `dotnet build -c Release --no-restore` |
| 20 | +- All tests: `dotnet test --no-restore` |
| 21 | +- Single test: `dotnet test --filter "FullyQualifiedName~PreMailerTests.MethodName"` |
| 22 | +- Watch tests: `dotnet watch test --project PreMailer.Net.Tests/PreMailer.Net.Tests.csproj` |
| 23 | +- Benchmarks: `dotnet run -c Release --project Benchmarks/Benchmarks.csproj` |
| 24 | +- Pack (manual): `PreMailer.Net/nuget.bat` — calls `dotnet pack ... --include-symbols` |
| 25 | + |
| 26 | +## Framework targets |
| 27 | + |
| 28 | +- Library multi-targets **`netstandard2.0;net461`** — keep code compatible with both. No C# nullable reference types in the library (only Benchmarks has `<Nullable>enable</Nullable>`). |
| 29 | +- `net461` gets an extra `System.Memory` package reference; don't remove it. |
| 30 | +- Assembly is signed with `PreMailer.Net.snk` (`SignAssembly=true`). Any InternalsVisibleTo must include the public key. |
| 31 | +- `LangVersion=latest` is set, so modern C# syntax is fine as long as it compiles for both TFMs. |
| 32 | + |
| 33 | +## Dependencies |
| 34 | + |
| 35 | +- Library depends only on **AngleSharp 1.4.0**. The DOM is an `IHtmlDocument`; expose it via `PreMailer.Document` (see README "Custom DOM Processing"). |
| 36 | +- Tests use xunit + Moq + coverlet. No fixtures/services required — tests are pure. |
| 37 | + |
| 38 | +## Release flow |
| 39 | + |
| 40 | +Publishing to NuGet is driven by GitHub **Releases**, not branch pushes (see `dotnetcore.yml`): |
| 41 | + |
| 42 | +1. Create a GitHub release; tag like `v2.3.4`. |
| 43 | +2. The `v` prefix is stripped and passed as `-p:Version=`; the release body becomes `PackageReleaseNotes`. |
| 44 | +3. CI runs on `windows-latest` with .NET SDK `10.0.x` and pushes `*.nupkg` using `secrets.NUGET_APIKEY`. |
| 45 | + |
| 46 | +Do not bump versions in the `.csproj` — version is supplied at pack time from the tag. |
| 47 | + |
| 48 | +## Conventions |
| 49 | + |
| 50 | +- README is packed into the nupkg (`PackageReadmeFile`). Keep README changes shippable. |
| 51 | +- `-premailer-*` CSS properties are proxied to HTML attributes (see `AttributeToCss.cs`, tests in `PreMailerTests`). Preserve that contract. |
| 52 | +- Unsupported pseudo-classes/elements must be logged to `InlineResult.Warnings`, not thrown. |
| 53 | + |
| 54 | +## Local CI |
| 55 | + |
| 56 | +README documents running workflows with `act`: |
| 57 | +`act push --container-architecture=linux/arm64 --platform ubuntu-slim=node:lts-bullseye` |
| 58 | +Note: the real CI uses `windows-latest`, so `act` won't fully reproduce it. |
0 commit comments