Compile the toolkit after installing it, because npm does not

It declares the hook npm is supposed to run after a git install, and this npm
does not run it — so the package arrives as sources with every entry point
pointing at a compiled directory that is not there.
This commit is contained in:
2026-09-13 02:44:12 +02:00
parent a5d65ada53
commit 78257cf151
+10
View File
@@ -28,6 +28,16 @@ COPY package.json package-lock.json ./
# builds itself on install, which is what lets it be named by a git URL rather than fetched from a
# package registry this mesh does not yet run.
RUN npm install --no-audit --no-fund
# **And then compile the toolkit, because npm did not.** It declares a `prepare` script, which is
# the hook npm is supposed to run after installing a package from git — and this npm does not run
# it, so the package arrives as sources with every one of its entry points pointing at a compiled
# directory that is not there. The compile is therefore done here, explicitly: install the toolkit's
# own build dependencies inside it, build it, then drop them again so they do not travel into the
# image. Doing it by hand rather than relying on the hook is also the honest arrangement — a build
# that silently depended on a hook firing would break the day it stopped, in the same invisible way.
RUN npm --prefix node_modules/@novox/mesh-sdk install --no-audit --no-fund \
&& npm --prefix node_modules/@novox/mesh-sdk run build \
&& npm --prefix node_modules/@novox/mesh-sdk prune --omit=dev
COPY tsconfig.json ./
COPY src ./src
RUN npm run build