Skip to content

fix: v0.3.1 – package components missing from the ShellUI.Components namespace #97

fix: v0.3.1 – package components missing from the ShellUI.Components namespace

fix: v0.3.1 – package components missing from the ShellUI.Components namespace #97

Workflow file for this run

name: CI
on:
push:
branches: [ main, develop, "release/**" ]
pull_request:
branches: [ main, develop, "release/**" ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
10.0.x
- name: Restore dependencies
run: dotnet restore ShellUI.slnx
# Regenerated every run: it's gitignored because Windows and Linux Tailwind builds differ byte for byte.
- name: Build precompiled CSS bundle
# Run through bash so the executable bit doesn't matter.
run: |
set -euxo pipefail
bash scripts/rebuild-precompiled-css.sh
BUNDLE=src/ShellUI.Components/wwwroot/shellui-all.css
test -f "$BUNDLE" || (echo "ERROR: bundle was not produced"; exit 1)
grep -Fq -- '--background' "$BUNDLE" || (echo "ERROR: theme vars not in bundle"; exit 1)
grep -Fq '.bg-background' "$BUNDLE" || (echo "ERROR: core utility rule missing"; exit 1)
grep -Fq 'hover\:bg-accent' "$BUNDLE" || (echo "ERROR: hover: modifier rules missing"; exit 1)
grep -Fq 'state=open' "$BUNDLE" || (echo "ERROR: data-[state=open] arbitrary value not compiled"; exit 1)
grep -Fq 'px-2\.5' "$BUNDLE" || (echo "ERROR: Badge padding class px-2.5 missing (variant .cs helpers not scanned?)"; exit 1)
grep -Fq 'border-transparent' "$BUNDLE" || (echo "ERROR: border-transparent missing (variant .cs helpers not scanned?)"; exit 1)
# Above the current bundle, below an accidental full Tailwind build.
size=$(wc -c < "$BUNDLE")
echo "precompiled bundle size: ${size} bytes"
if [ "$size" -gt 150000 ]; then
echo "ERROR: bundle exceeded 150KB — investigate before shipping."
exit 1
fi
- name: Build
run: dotnet build ShellUI.slnx --no-restore --configuration Release
- name: Run tests
run: dotnet test ShellUI.slnx --no-restore --no-build --configuration Release --verbosity normal
# Builds a scaffolded project; catches what TemplateCompileTests can't.
- name: Smoke-test CLI scaffolding
shell: bash
run: |
set -euxo pipefail
TMPDIR=$(mktemp -d)
dotnet pack src/ShellUI.CLI/ShellUI.CLI.csproj -c Release -o "$TMPDIR/nupkgs" --no-build
dotnet tool install --tool-path "$TMPDIR/tools" --add-source "$TMPDIR/nupkgs" ShellUI.CLI --prerelease
export PATH="$TMPDIR/tools:$PATH"
mkdir -p "$TMPDIR/app" && cd "$TMPDIR/app"
dotnet new blazor -o SmokeApp --no-restore
cd SmokeApp
shellui init --tailwind standalone --yes
grep -q 'HeadOutlet @rendermode="InteractiveServer"' Components/App.razor || (echo "init did not patch HeadOutlet @rendermode"; exit 1)
grep -q 'Routes @rendermode="InteractiveServer"' Components/App.razor || (echo "init did not patch Routes @rendermode"; exit 1)
grep -q 'ShellUI theme bootstrap' Components/App.razor || (echo "init did not inject theme bootstrap"; exit 1)
grep -q '<script src="shellui.js"></script>' Components/App.razor || (echo "init did not inject shellui.js script tag"; exit 1)
if grep -Fq 'shellui-sidebar.js' Components/App.razor; then
echo "init incorrectly injected a shellui-sidebar.js script tag (sidebar JS lives in the global shellui.js now)"
exit 1
fi
grep -q '@theme inline' wwwroot/input.css || (echo "init did not write full theme to input.css"; exit 1)
grep -q ':root' wwwroot/input.css || (echo "init did not write :root variables to input.css"; exit 1)
grep -q '\.dark' wwwroot/input.css || (echo "init did not write .dark variables to input.css"; exit 1)
shellui add chart pie-chart dashboard-02 data-table --force
grep -q 'Blazor-ApexCharts' SmokeApp.csproj || (echo "shellui add chart did not add Blazor-ApexCharts NuGet dep"; exit 1)
grep -q 'System.Linq.Dynamic.Core' SmokeApp.csproj || (echo "shellui add data-table did not add System.Linq.Dynamic.Core NuGet dep"; exit 1)
test -f Components/UI/Models/DataTableModels.cs || (echo "shellui add data-table did not install data-table-models"; exit 1)
# Without charts.css, chart tooltips render white on white.
test -f wwwroot/css/charts.css || (echo "shellui add chart did not install chart-styles CSS"; exit 1)
grep -q '<link href="css/charts.css"' Components/App.razor || (echo "shellui add chart did not link charts.css in App.razor"; exit 1)
# A dynamic import of shellui-sidebar.js 404s once compiled into a consumer's RCL.
grep -q 'ShellUI.initSidebar' Components/UI/SidebarProvider.razor || (echo "SidebarProvider did not call ShellUI.initSidebar"; exit 1)
if grep -Fq 'shellui-sidebar.js' Components/UI/SidebarProvider.razor; then
echo "SidebarProvider still dynamically imports shellui-sidebar.js"
exit 1
fi
test -f wwwroot/shellui.js || (echo "shellui.js was not installed"; exit 1)
grep -Fq 'initSidebar: function (handle, dotNetRef)' wwwroot/shellui.js || (echo "shellui.js does not expose initSidebar"; exit 1)
grep -Fq 'disposeSidebar: function (handle)' wwwroot/shellui.js || (echo "shellui.js does not expose disposeSidebar"; exit 1)
test ! -e wwwroot/shellui-sidebar.js || (echo "legacy sidebar JS was installed for a fresh sidebar install"; exit 1)
dotnet build -c Debug
# Catches missing dependencies that per-template tests can't see.
ALL=$(python3 - "$GITHUB_WORKSPACE" <<'PY'
import os, re, sys
root = sys.argv[1]
reg = open(os.path.join(root, "src/ShellUI.Templates/ComponentRegistry.cs")).read().split("GetComponentContent")[0]
names = [n for n, c in re.findall(r'\{ "([a-z0-9-]+)", (\w+)\.Metadata \}', reg)
if not re.search(r"IsAvailable\s*=\s*false", open(os.path.join(root, f"src/ShellUI.Templates/Templates/{c}.cs")).read())]
print(" ".join(names))
PY
)
# The CLI's source must build in .NET 8 and 9 projects too, not only .NET 10.
for fw in net10.0 net9.0 net8.0; do
cd "$TMPDIR/app"
dotnet new blazor -o "AllApp-$fw" -f "$fw" --no-restore
cd "AllApp-$fw"
shellui init --tailwind standalone --yes
shellui add $ALL
dotnet build -c Debug
done
# Package-only install from a local-only feed, so nuget.org can't mask a broken package.
- name: NuGet-only install — verify safelist ships
shell: bash
run: |
set -euxo pipefail
LOCAL_FEED="$GITHUB_WORKSPACE/src/ShellUI.Components/bin/Release"
test -d "$LOCAL_FEED" || (echo "local feed not found at $LOCAL_FEED — did the pack step run?"; exit 1)
ls "$LOCAL_FEED"/*.nupkg | head -3
echo "---nupkg contents (looking for shellui-all.css):---"
unzip -l "$LOCAL_FEED"/ShellUI.Components*.nupkg | grep -E 'shellui-all|staticwebassets/' | head -10 || echo " (no matches — bundle not in nupkg!)"
echo "---source wwwroot check:---"
ls -la "$GITHUB_WORKSPACE/src/ShellUI.Components/wwwroot/" | head -10
TMPDIR=$(mktemp -d)
mkdir -p "$TMPDIR/app" && cd "$TMPDIR/app"
dotnet new blazor -o NuGetSmoke --no-restore
cd NuGetSmoke
cat > NuGet.config <<EOF
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="local" value="$LOCAL_FEED" />
</packageSources>
</configuration>
EOF
# A cached copy of the same version would shadow the fresh nupkg.
rm -rf ~/.nuget/packages/shellui.components
dotnet add package ShellUI.Components --prerelease
# The package's .targets copies the safelist during build, so restore alone isn't enough.
dotnet build -c Debug
SAFELIST="wwwroot/shellui-classes.txt"
test -f "$SAFELIST" || (
echo "ERROR: $SAFELIST not in consumer project after dotnet build."
echo "The package's build/ShellUI.Components.targets should have copied it."
echo "Files in wwwroot/:"; ls -la wwwroot/ 2>/dev/null || echo " (no wwwroot/ directory)"
exit 1
)
grep -q 'bg-background' "$SAFELIST" || (echo "safelist appears malformed — missing core Tailwind class 'bg-background'"; exit 1)
wc -l "$SAFELIST"
# .NET 10 serves package assets from the NuGet cache, not bin/, so check the extracted package.
BUNDLE="$(find ~/.nuget/packages/shellui.components -name 'shellui-all.css' -type f | head -1)"
if [ -z "$BUNDLE" ]; then
echo "ERROR: shellui-all.css not in consumer's extracted NuGet cache — the pure-NuGet install path is broken."
echo "---consumer's extracted NuGet cache tree:---"
find ~/.nuget/packages/shellui.components -type f 2>/dev/null | head -30
exit 1
fi
echo "found bundle at: $BUNDLE"
BUNDLE_SIZE=$(wc -c < "$BUNDLE")
echo "bundle size: $BUNDLE_SIZE bytes"
grep -Fq -- '--background' "$BUNDLE" || (echo "ERROR: bundle missing --background theme var"; exit 1)
grep -Fq '.bg-background' "$BUNDLE" || (echo "ERROR: bundle missing .bg-background utility"; exit 1)
grep -Fq 'hover\:bg-accent' "$BUNDLE" || (echo "ERROR: bundle missing hover:bg-accent modifier rule"; exit 1)
grep -Fq 'state=open' "$BUNDLE" || (echo "ERROR: bundle missing data-[state=open] arbitrary-value modifier"; exit 1)
grep -Fq 'px-2\.5' "$BUNDLE" || (echo "ERROR: bundle missing Badge padding — .cs variant scan regression?"; exit 1)
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: |
**/*.nupkg
**/*.snupkg