Skip to content

Commit 014efe9

Browse files
committed
chore: slightly more helpful and organized pnpm onboarding
1 parent 7ec6c79 commit 014efe9

10 files changed

Lines changed: 166 additions & 105 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "A type-safe data engineering framework for .NET",
55
"main": "index.js",
66
"scripts": {
7-
"postinstall": "bash scripts/post-pnpm-install-hook.sh",
7+
"postinstall": "bash scripts/post-install/post-install.sh",
88
"prepare": "husky"
99
},
1010
"keywords": [
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Sourced by ../post-install.sh.
2+
# ── chromium ──────────────────────────────────────────────────────────────────
3+
# Optional. Plotly's static image export (PNG/SVG via kaleido) launches a
4+
# headless Chromium under the hood. Without a Chromium-family browser on
5+
# PATH, Python flows that emit graph image outputs (e.g. FlowthruCoverage's
6+
# heatmap PNG) will fail at the image-export step.
7+
8+
CHROMIUM_BIN=""
9+
for candidate in chromium chromium-browser google-chrome chrome; do
10+
if command -v "$candidate" &>/dev/null; then
11+
CHROMIUM_BIN="$candidate"
12+
break
13+
fi
14+
done
15+
16+
if [ -n "$CHROMIUM_BIN" ]; then
17+
CHROMIUM_VERSION=$("$CHROMIUM_BIN" --version 2>/dev/null | head -1)
18+
ok "$CHROMIUM_VERSION (via $CHROMIUM_BIN)"
19+
else
20+
warn "chromium not found. Python flows that export Plotly graphs to PNG/SVG"
21+
warn "(e.g. FlowthruCoverage's heatmap) may fail to produce image outputs"
22+
warn "without a headless Chromium on PATH."
23+
warn "Install: https://www.chromium.org/getting-involved/download-chromium/"
24+
fi
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Sourced by ../post-install.sh.
2+
# ── .NET 9 runtime ────────────────────────────────────────────────────────────
3+
# Optional but recommended. StrawberryShake.Server's MSBuild codegen invokes
4+
# a tool that ships only net8 and net9 binaries; on hosts running newer SDKs
5+
# (e.g. .NET 10), MSBuild still selects the net9 tool, which then requires the
6+
# .NET 9 *shared framework* on disk to launch. SDK-only installs of newer
7+
# .NET versions are not sufficient.
8+
#
9+
# Without this runtime, Flowthru.Extensions.GQL example projects
10+
# (e.g. KedroSpaceflightsGQL) will fail at build time with MSB3073 / exit 150.
11+
12+
if command -v dotnet &>/dev/null; then
13+
if dotnet --list-runtimes 2>/dev/null \
14+
| grep -qE '^Microsoft\.NETCore\.App 9\.'; then
15+
DOTNET9_VERSION=$(dotnet --list-runtimes 2>/dev/null \
16+
| grep -E '^Microsoft\.NETCore\.App 9\.' \
17+
| head -1 \
18+
| awk '{print $2}')
19+
ok "Microsoft.NETCore.App $DOTNET9_VERSION (required for Flowthru.Extensions.GQL codegen)"
20+
else
21+
warn ".NET 9 runtime not found. The Flowthru.Extensions.GQL example projects"
22+
warn "(e.g. KedroSpaceflightsGQL) will fail to build because StrawberryShake's"
23+
warn "codegen tool ships only net8/net9 binaries and needs the .NET 9 shared"
24+
warn "framework at build time."
25+
warn "Download: https://dotnet.microsoft.com/download/dotnet/9.0"
26+
fi
27+
fi
28+
# If dotnet itself is missing, the dotnet check has already warned.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Sourced by ../post-install.sh.
2+
# ── dotnet ────────────────────────────────────────────────────────────────────
3+
# Required to build and test all Flowthru projects.
4+
# On success, runs 'dotnet restore' to prime the NuGet cache.
5+
6+
REQUIRED_DOTNET_MAJOR=$(grep -o '"version":[[:space:]]*"[^"]*"' "$ROOT_DIR/global.json" \
7+
| grep -o '[0-9][0-9]*' | head -1)
8+
9+
if command -v dotnet &>/dev/null; then
10+
DOTNET_VERSION=$(dotnet --version 2>/dev/null)
11+
DOTNET_MAJOR=$(echo "$DOTNET_VERSION" | cut -d. -f1)
12+
13+
if [ "$DOTNET_MAJOR" -ge "$REQUIRED_DOTNET_MAJOR" ]; then
14+
ok "dotnet $DOTNET_VERSION (global.json requires .NET $REQUIRED_DOTNET_MAJOR+)"
15+
echo ""
16+
echo " Running dotnet restore..."
17+
dotnet restore "$ROOT_DIR"
18+
ok "dotnet restore complete"
19+
else
20+
warn "dotnet $DOTNET_VERSION found, but .NET $REQUIRED_DOTNET_MAJOR+ is required (see global.json)."
21+
warn "Download: https://dotnet.microsoft.com/download"
22+
fi
23+
else
24+
warn "dotnet not found. .NET $REQUIRED_DOTNET_MAJOR+ is required to build and test Flowthru."
25+
warn "Download: https://dotnet.microsoft.com/download"
26+
fi
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Sourced by ../post-install.sh.
2+
# ── java ──────────────────────────────────────────────────────────────────────
3+
# Required to run Spark-backed tests. Spark 4.1.1 requires JDK 17+.
4+
5+
if command -v java &>/dev/null; then
6+
JAVA_VERSION=$(java -version 2>&1 | head -1)
7+
ok "java: $JAVA_VERSION"
8+
else
9+
warn "java not found. JDK 17+ is required to run Spark-backed Flowthru tests."
10+
fi
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Sourced by ../post-install.sh.
2+
# ── python ────────────────────────────────────────────────────────────────────
3+
# Required for the Flowthru.Extensions.Python extension and example projects.
4+
5+
if command -v python3 &>/dev/null; then
6+
PYTHON_VERSION=$(python3 --version 2>/dev/null | awk '{print $2}')
7+
ok "python $PYTHON_VERSION"
8+
elif command -v python &>/dev/null; then
9+
PYTHON_VERSION=$(python --version 2>/dev/null | awk '{print $2}')
10+
ok "python $PYTHON_VERSION"
11+
else
12+
warn "python not found. Python 3.10+ is required for the Flowthru Python extension and examples."
13+
warn "Install via uv: https://docs.astral.sh/uv/ or https://www.python.org/downloads/"
14+
fi
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Sourced by ../post-install.sh.
2+
# ── SPARK_HOME ────────────────────────────────────────────────────────────────
3+
# Required to run Spark-backed tests (Flowthru.Extensions.Spark.Tests).
4+
# Tests guard themselves with Assume checks and skip gracefully if unset.
5+
6+
if [ -n "${SPARK_HOME:-}" ] && [ -d "$SPARK_HOME" ]; then
7+
if [ -f "$SPARK_HOME/RELEASE" ]; then
8+
SPARK_RELEASE=$(head -1 "$SPARK_HOME/RELEASE")
9+
ok "SPARK_HOME=$SPARK_HOME ($SPARK_RELEASE)"
10+
else
11+
ok "SPARK_HOME=$SPARK_HOME"
12+
fi
13+
else
14+
warn "SPARK_HOME is not set or does not point to a valid directory."
15+
warn "Apache Spark 4.1.1 is required to run Spark-backed Flowthru tests."
16+
warn "Download: https://spark.apache.org/downloads.html"
17+
fi
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Sourced by ../post-install.sh.
2+
# ── uv ────────────────────────────────────────────────────────────────────────
3+
# Required for Python-backed flows and the Flowthru.Extensions.Python test suite.
4+
5+
if command -v uv &>/dev/null; then
6+
UV_VERSION=$(uv --version 2>/dev/null | awk '{print $2}')
7+
ok "uv $UV_VERSION"
8+
else
9+
warn "uv not found. uv is required for Python-backed Flowthru flows and tests."
10+
warn "Install: https://docs.astral.sh/uv/getting-started/installation/"
11+
fi
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
# Post-install hook for the Flowthru repo.
3+
# Sources each dependency check in ./dependencies/ in the order listed below.
4+
# Each subscript is sourced (not executed) so it inherits ROOT_DIR and the
5+
# ok/warn helpers defined here; subscripts are not intended to run standalone.
6+
set -euo pipefail
7+
8+
POST_INSTALL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
ROOT_DIR="$(cd "$POST_INSTALL_DIR/../.." && pwd)"
10+
DEPENDENCIES_DIR="$POST_INSTALL_DIR/dependencies"
11+
12+
ok() { echo " [OK] $*"; }
13+
warn() { echo " [!!] $*" >&2; }
14+
15+
# Order is intentional: `dotnet-9` inspects runtimes only when `dotnet`
16+
# itself was found, so it must run after the base dotnet check.
17+
DEPENDENCIES=(
18+
dotnet
19+
dotnet-9
20+
uv
21+
python
22+
java
23+
spark
24+
chromium
25+
)
26+
27+
echo ""
28+
echo "Checking non-Node dependencies..."
29+
echo ""
30+
31+
for dep in "${DEPENDENCIES[@]}"; do
32+
# shellcheck source=/dev/null
33+
source "$DEPENDENCIES_DIR/$dep.sh"
34+
echo ""
35+
done

scripts/post-pnpm-install-hook.sh

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)