Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
"start:css": "node scripts/watch-styling.mjs",
"start:tutorial": "yarn workspace @stream-io/stream-chat-react-tutorial dev",
"start:vite": "yarn workspace @stream-io/stream-chat-react-vite dev",
"postinstall": "husky",
"postinstall": "node -e \"require('fs').existsSync('scripts/install-husky.mjs') && import('./scripts/install-husky.mjs')\"",
"test": "vitest run",
"test:watch": "vitest",
"types": "tsc --emitDeclarationOnly false --noEmit",
Expand Down
11 changes: 11 additions & 0 deletions scripts/install-husky.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { existsSync } from 'node:fs';

// husky installs this repo's local git hooks and is a dev-only dependency. It is
// invoked from a presence-guarded postinstall (see package.json) so it never runs
// for consumers — this file is intentionally not published. The .git check is a
// secondary guard for non-checkout environments; husky's own default() already
// no-ops gracefully on a missing .git or HUSKY=0, and any genuine setup error is
// left to surface rather than be swallowed. See GetStream/stream-chat-js#1763.
if (existsSync('.git')) {
(await import('husky')).default();
}