refactor: switch commonjs files to esm
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 3 Oct 2023 14:48:19 +0000 (16:48 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 3 Oct 2023 14:48:19 +0000 (16:48 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
package.json
prepare.js [deleted file]
prepare.mjs [new file with mode: 0644]

index 65b46808b6faf4625986257d456d4f53d5842c4a..c7b7a489430716339c9d60c900afd976738febab 100644 (file)
@@ -32,7 +32,7 @@
   },
   "scripts": {
     "preinstall": "npx --yes only-allow pnpm",
-    "prepare": "node prepare.js",
+    "prepare": "node prepare.mjs",
     "benchmark:busy-wait": "node busy-wait.mjs",
     "benchmark:empty-array": "node empty-array.mjs",
     "benchmark:deep-clone-object": "node deep-clone-object.mjs",
diff --git a/prepare.js b/prepare.js
deleted file mode 100644 (file)
index d879b74..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-const isCIEnvironment = process.env.CI != null
-if (isCIEnvironment === false) {
-  // eslint-disable-next-line n/no-unpublished-require
-  require('husky').install()
-}
diff --git a/prepare.mjs b/prepare.mjs
new file mode 100644 (file)
index 0000000..9a107a6
--- /dev/null
@@ -0,0 +1,8 @@
+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()
+}