From 2f11a29c4d18ced2f4612361f662b64c9e22f5be Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 21 Sep 2026 20:31:47 +0200 Subject: [PATCH] The runtime build installs the module's SDK itself and shows its compiler's output A module never built on this workstation had no node_modules, tsc failed on the first import behind /dev/null, and the suite reported a build that said nothing. --- scripts/build-module-runtime.sh | 11 ++++++++++- src/rebuild.ts | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/build-module-runtime.sh b/scripts/build-module-runtime.sh index 17a9192..53f57a5 100755 --- a/scripts/build-module-runtime.sh +++ b/scripts/build-module-runtime.sh @@ -33,7 +33,16 @@ SRCS=(); for f in \ pg.d.ts; do [ -f "$MOD/$f" ] && SRCS+=("$f") done -TSC="$MESH_SDK/node_modules/.bin/tsc"; ( cd "$MOD" && "$TSC" "${SRCS[@]}" --module NodeNext --moduleResolution NodeNext --target ES2022 --outDir dist >/dev/null ) +# The module compiles against the SDK, which its package.json names and nothing installs: a module +# never built on this workstation has no node_modules, and tsc fails on the first import. Installed +# as a package copy from the sibling checkout (never a link) when absent — the compile needs only +# the types; the image takes the SDK from MESH_SDK below. +if [ ! -e "$MOD/node_modules/@novox/mesh-sdk" ]; then + ( cd "$MOD" && npm install --no-save --install-links --no-package-lock --ignore-scripts --silent "$MESH_SDK" ) \ + || { echo "cannot install the SDK into $MOD for the compile" >&2; exit 1; } +fi +# Output kept: a compile error hidden behind /dev/null is a build that fails saying nothing. +TSC="$MESH_SDK/node_modules/.bin/tsc"; ( cd "$MOD" && "$TSC" "${SRCS[@]}" --module NodeNext --moduleResolution NodeNext --target ES2022 --outDir dist 1>&2 ) STAGE="$(mktemp -d)"; trap 'rm -rf "$STAGE"' EXIT cp -r "$MESH_TOOLS/dist" "$STAGE/dist" diff --git a/src/rebuild.ts b/src/rebuild.ts index e20dda8..d6276f3 100644 --- a/src/rebuild.ts +++ b/src/rebuild.ts @@ -134,7 +134,7 @@ export function rebuild(env: NodeJS.ProcessEnv = process.env, testFiles: string[ // the code in front of you, which is the whole of 005. throw new Error( `could not build the ${build.what}: ${build.argv.join(" ")} in ${build.in}\n\n` + - `${(ran.stderr || ran.stdout || String(ran.error)).trim()}`, + `${(ran.stderr || ran.stdout || (ran.error ? String(ran.error) : `exit status ${ran.status}, and it said nothing`)).trim()}`, ); } built.push(build.what);