Browse Source

build(npm): fix Commitizen ES Module errors

Commitizen is currently generating errors due to ES Module/CommonJS
incompatibilities described by the following GitHub issue:

    https://github.com/conventional-changelog/commitlint/issues/3842

This change implements the temporary workaround described by the issue.

Change-Id: Idb74a3366bf046a0c9bac83380de904c5c059087
Signed-off-by: Chris Kay <chris.kay@arm.com>
Chris Kay 1 month ago
parent
commit
7d2a608a73
2 changed files with 16 additions and 1 deletions
  1. 15 0
      .cz-adapter.cjs
  2. 1 1
      .cz.json

+ 15 - 0
.cz-adapter.cjs

@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2024, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * A workaround for:
+ *
+ *     https://github.com/conventional-changelog/commitlint/issues/3949
+ */
+
+exports.prompter = async (inquirerIns, commit) => {
+    ; (await import('@commitlint/cz-commitlint')).prompter(inquirerIns, commit)
+}

+ 1 - 1
.cz.json

@@ -1,3 +1,3 @@
 {
-    "path": "@commitlint/cz-commitlint"
+    "path": "./.cz-adapter.cjs"
 }