* 🐛 fix(package.json): change cli file extension from .cjs to .mjs

* 🐛 fix(githook.ts): change cli file path to match new extension
The cli file extension has been changed from .cjs to .mjs to improve compatibility with Node.js ESM modules. The file path in githook.ts has been updated to match the new extension.
This commit is contained in:
di-sukharev
2023-03-06 22:12:37 +08:00
parent 3859533eff
commit 297ccac45b
2 changed files with 5 additions and 7 deletions

View File

@@ -12,8 +12,8 @@
],
"main": "cli.js",
"bin": {
"opencommit": "./out/cli.cjs",
"oc": "./out/cli.cjs"
"opencommit": "./out/cli.mjs",
"oc": "./out/cli.mjs"
},
"repository": {
"url": "https://github.com/di-sukharev/opencommit"
@@ -34,9 +34,9 @@
},
"scripts": {
"watch": "npm run -S build -- --sourcemap --watch",
"start": "node ./out/cli.cjs",
"start": "node ./out/cli.mjs",
"dev": "ts-node ./src/cli.ts",
"build": "rimraf out && esbuild ./src/cli.ts --bundle --outfile=out/cli.cjs --format=cjs --platform=node",
"build": "rimraf out && esbuild ./src/cli.ts --bundle --outfile=out/cli.mjs --format=esm --platform=node --banner:js=\"import {createRequire} from 'module';const require=createRequire(import.meta.url);\"",
"deploy": "npm run build && npm version patch && npm publish",
"lint": "eslint src --ext ts && tsc --noEmit"
},

View File

@@ -20,9 +20,7 @@ export const hookCommand = command(
parameters: ['<set/unset>']
},
async (argv) => {
const HOOK_PATH = fileURLToPath(
new URL('../../out/cli.cjs', import.meta.url)
);
const HOOK_PATH = fileURLToPath(new URL('cli.mjs', import.meta.url));
try {
await assertGitRepo();