Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/hooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ set -uo pipefail
ROOT="$(git rev-parse --show-toplevel)"
cd "$ROOT"

# Ensure dotnet SDK is in PATH for the hook
export DOTNET_ROOT="${DOTNET_ROOT:-${HOME}/.dotnet}"
export PATH="${DOTNET_ROOT}:${PATH}"

RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; CYAN='\033[0;36m'; RESET='\033[0m'

echo -e "${CYAN}━━━ Pre-Push Gate ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
Expand Down Expand Up @@ -64,8 +68,8 @@ fi

# ── Gate 2: markdownlint check ─────────────────────────────────────────────
echo -e "\n${CYAN}📝 Checking Markdown lint (markdownlint-cli2)...${RESET}"
if [[ -x "$ROOT/node_modules/.bin/markdownlint-cli2" ]]; then
"$ROOT/node_modules/.bin/markdownlint-cli2" "**/*.md" \
if [[ -x "$ROOT/src/Web/node_modules/.bin/markdownlint-cli2" ]]; then
"$ROOT/src/Web/node_modules/.bin/markdownlint-cli2" "**/*.md" \
"!**/node_modules/**" \
"!**/bin/**" \
"!**/obj/**" \
Expand All @@ -77,13 +81,14 @@ if [[ -x "$ROOT/node_modules/.bin/markdownlint-cli2" ]]; then
--config "$ROOT/.markdownlint.json"
MD_EXIT=$?
else
echo -e "${YELLOW}⚠️ markdownlint-cli2 not found at node_modules/.bin — run 'npm install'.${RESET}"
exit 1
echo -e "${YELLOW}⚠️ markdownlint-cli2 not found — skipping local lint (CI enforces it).${RESET}"
echo -e "${YELLOW} To run locally: cd src/Web && npm ci${RESET}"
MD_EXIT=0
fi

if [[ $MD_EXIT -ne 0 ]]; then
echo -e "${RED}❌ Markdownlint violations detected.${RESET}"
echo -e "${YELLOW} Fix: npx markdownlint-cli2 \"**/*.md\"${RESET}"
echo -e "${YELLOW} Fix: cd src/Web && npx markdownlint-cli2 \"**/*.md\"${RESET}"
echo -e "${YELLOW} Then: git add -u && git commit (or --amend), then re-push.${RESET}"
exit 1
fi
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cSpell.words": [
"ASPNETCORE",
"autobuild",
"cref",
"EECOM",
"inheritdoc",
Expand All @@ -9,4 +10,4 @@
"reskill",
"toplevel"
]
}
}
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageVersion Include="Aspire.StackExchange.Redis.DistributedCaching" Version="13.3.5" />
<!-- Auth0 Packages -->
<PackageVersion Include="Auth0.AspNetCore.Authentication" Version="1.7.0" />
<PackageVersion Include="Auth0.ManagementApi" Version="8.3.0" />
<PackageVersion Include="Auth0.ManagementApi" Version="8.4.0" />
<!-- Validation -->
<!-- 9.1.x-beta uses AngleSharp 1.4.0 (compatible with bunit 2.7.2); 9.0.x used 0.17.1 which clashed -->
<PackageVersion Include="HtmlSanitizer" Version="9.1.923-beta" />
Expand All @@ -27,8 +27,8 @@
<!-- CQRS/Mediator -->
<PackageVersion Include="MediatR" Version="14.1.0" />
<!-- Database -->
<PackageVersion Include="MongoDB.Bson" Version="3.8.1" />
<PackageVersion Include="MongoDB.Driver" Version="3.8.1" />
<PackageVersion Include="MongoDB.Bson" Version="3.9.0" />
<PackageVersion Include="MongoDB.Driver" Version="3.9.0" />
<PackageVersion Include="MongoDB.EntityFrameworkCore" Version="10.0.1" />
<!-- Transitive pin: MongoDB.Driver resolves an older SharpCompress; pinned to 1.0.0 -->
<PackageVersion Include="SharpCompress" Version="1.0.0" />
Expand All @@ -37,7 +37,7 @@
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.8" />
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="10.6.0" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="10.6.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
<PackageVersion Include="Microsoft.Playwright" Version="1.60.0" />
<!-- OpenTelemetry -->
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.15.3" />
Expand All @@ -62,4 +62,4 @@
<PackageVersion Include="xunit.v3.assert" Version="3.2.2" />
<PackageVersion Include="xunit.v3.extensibility.core" Version="3.2.2" />
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ MyBlog/
3. **Install npm dependencies** (for TailwindCSS)

```bash
npm ci
cd src/Web && npm ci && cd ../..
```

4. **Build the solution**
Expand Down
14 changes: 0 additions & 14 deletions package.json

This file was deleted.

23 changes: 19 additions & 4 deletions src/Web/Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,33 @@
<PublishTrimmed>false</PublishTrimmed>
<InvariantGlobalization>false</InvariantGlobalization>
<IncludeNETCoreAppRuntime>false</IncludeNETCoreAppRuntime>
<NpmCommand Condition="'$(NpmCommand)' == ''">npm</NpmCommand>
</PropertyGroup>

<Target Name="DetectNpm" BeforeTargets="EnsureNpmPackages;BuildTailwind" Condition="'$(CI)' != 'true' AND '$(CI)' != '1'">
<Exec Command="$(NpmCommand) --version" IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="NpmExitCode" />
</Exec>
<PropertyGroup>
<NpmAvailable Condition="'$(NpmExitCode)' == '0'">true</NpmAvailable>
<NpmAvailable Condition="'$(NpmExitCode)' != '0'">false</NpmAvailable>
</PropertyGroup>
<Error Condition="'$(NpmAvailable)' != 'true' AND !Exists('$(MSBuildProjectDirectory)/wwwroot/css/tailwind.css')"
Text="npm was not found and no pre-built tailwind.css exists. Install Node.js/npm and run 'cd src/Web &amp;&amp; npm ci' before building." />
<Warning Condition="'$(NpmAvailable)' != 'true' AND Exists('$(MSBuildProjectDirectory)/wwwroot/css/tailwind.css')"
Text="npm was not found. Skipping Tailwind build and using the existing generated CSS at wwwroot/css/tailwind.css." />
</Target>

<!-- On a fresh machine, node_modules won't exist. Auto-run npm install before Tailwind builds. -->
<Target Name="EnsureNpmPackages" BeforeTargets="BuildTailwind"
Condition="'$(CI)' != 'true' AND !Exists('$(MSBuildProjectDirectory)/../../node_modules')">
Condition="'$(CI)' != 'true' AND '$(CI)' != '1' AND '$(NpmAvailable)' == 'true' AND !Exists('$(MSBuildProjectDirectory)/node_modules')">
<Message Importance="high" Text="node_modules not found — running npm install..." />
<Exec Command="npm install" WorkingDirectory="$(MSBuildProjectDirectory)/../.." />
<Exec Command="npm install" WorkingDirectory="$(MSBuildProjectDirectory)" />
</Target>

<!-- Build Tailwind CSS (skip on CI environments where npm is not installed) -->
<Target Name="BuildTailwind" BeforeTargets="Build" Condition="'$(CI)' != 'true'">
<Exec Command="npm run tw:build" WorkingDirectory="$(MSBuildProjectDirectory)/../.." />
<Target Name="BuildTailwind" BeforeTargets="Build" Condition="'$(CI)' != 'true' AND '$(CI)' != '1' AND '$(NpmAvailable)' == 'true'">
<Exec Command="npm run tw:build" WorkingDirectory="$(MSBuildProjectDirectory)" />
</Target>


Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions src/Web/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "myblog",
"private": true,
"scripts": {
"tw:build": "npx @tailwindcss/cli -i Styles/input.css -o wwwroot/css/tailwind.css",
"tw:build:prod": "npx @tailwindcss/cli -i Styles/input.css -o wwwroot/css/tailwind.css --minify",
"tw:watch": "npx @tailwindcss/cli -i Styles/input.css -o wwwroot/css/tailwind.css --watch"
},
"devDependencies": {
"@tailwindcss/cli": "^4.2.0",
"markdownlint-cli2": "^0.22.1",
"tailwindcss": "^4.2.0"
},
"allowScripts": {
"@parcel/watcher": true
}
}
Loading