fix: use conditional import in prepare.mjs
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 27 Nov 2023 17:03:22 +0000 (18:03 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 27 Nov 2023 17:03:22 +0000 (18:03 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
prepare.mjs

index 9a107a6ea078e1f8bb0bb1c09a12346daab9585f..768ba5bb0626ddeee91a36cdac76c35fdcf9b746 100644 (file)
@@ -1,8 +1,13 @@
 import { env } from 'node:process'
-// eslint-disable-next-line n/no-unpublished-import
-import { install } from 'husky'
 
 const isCIEnvironment = env.CI != null
 if (isCIEnvironment === false) {
-  install()
+  // eslint-disable-next-line n/no-unpublished-import
+  import('husky')
+    .then(({ install }) => {
+      return install()
+    })
+    .catch(err => {
+      console.error(err)
+    })
 }