From 91e692e3e786b73ad8bab3289f20409a8464f10d Mon Sep 17 00:00:00 2001 From: "shaggy (mosaic-dev box)" Date: Sun, 9 Aug 2026 17:58:13 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20break-C=20=E2=80=94=20install-hooks=20no?= =?UTF-8?q?-ops=20without=20git;=20web=20image=20builds=20@mosaicstack/web?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit install-hooks.mjs hard-failed (exit 1) in environments without a git binary — e.g. the docker image builds, which have no git and no repo. Hook installation is meaningless there; skip with a warning instead. docker/web.Dockerfile filtered @mosaic/web, but the package is named @mosaicstack/web, so the image build compiled nothing. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01ESFAnh2t9HmLwng8oW95St --- docker/web.Dockerfile | 2 +- scripts/install-hooks.mjs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docker/web.Dockerfile b/docker/web.Dockerfile index 4d92b4f7..5418a692 100644 --- a/docker/web.Dockerfile +++ b/docker/web.Dockerfile @@ -10,7 +10,7 @@ COPY apps/web/package.json ./apps/web/ COPY packages/ ./packages/ RUN pnpm install --frozen-lockfile COPY . . -RUN pnpm --filter @mosaic/web build +RUN pnpm --filter @mosaicstack/web build FROM base AS runner WORKDIR /app diff --git a/scripts/install-hooks.mjs b/scripts/install-hooks.mjs index becf0511..e626bfd4 100644 --- a/scripts/install-hooks.mjs +++ b/scripts/install-hooks.mjs @@ -75,6 +75,16 @@ export async function installHooks({ } = {}) { if (disabled) return; + try { + await execFileAsync('git', ['--version']); + } catch (error) { + if (error.code === 'ENOENT') { + console.warn('git not found; skipping hook installation'); + return; + } + throw error; + } + const huskyDir = path.join(root, '.husky'); const active = path.join(huskyDir, '_'); const nonce = `${Date.now()}-${process.pid}`;