Compare commits

..

20 Commits

Author SHA1 Message Date
di-sukharev
1a32bff538 0.0.19 2023-03-06 22:13:32 +08:00
di-sukharev
297ccac45b * 🐛 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.
2023-03-06 22:12:37 +08:00
di-sukharev
3859533eff * 🐛 fix(githook.ts): fix HOOK_PATH import URL
The HOOK_PATH import URL was incorrect and has been fixed to point to the correct location.
2023-03-06 21:49:19 +08:00
di-sukharev
757faba0c4 0.0.18 2023-03-06 21:42:05 +08:00
di-sukharev
422d38d51e * 🐛 fix(githook.ts): update HOOK_PATH to point to the correct file path
The HOOK_PATH variable was pointing to the wrong file path, which caused the hook to fail. The file path has been updated to point to the correct file path.
2023-03-06 21:41:58 +08:00
di-sukharev
ee02be56b2 0.0.17 2023-03-06 21:40:49 +08:00
di-sukharev
1c762a6e8c * 🚀 feat(package.json): add deploy script
The deploy script builds the application, increments the patch version, and publishes the package to the registry. This makes it easier to deploy new versions of the application.
2023-03-06 21:40:39 +08:00
di-sukharev
6126fad25c 0.0.16 2023-03-06 21:38:26 +08:00
di-sukharev
01cdd2f58d removed async iife 2023-03-06 21:36:37 +08:00
di-sukharev
acdf464d2e 0.0.15 2023-03-06 21:34:03 +08:00
di-sukharev
3705a66ada 0.0.14 2023-03-06 21:33:06 +08:00
di-sukharev
bdb8da49b7 * 🚀 chore(cli.ts): change file mode from 100644 to 100755
This commit changes the file mode of cli.ts from 100644 to 100755. This change allows the file to be executable.
2023-03-06 21:33:00 +08:00
di-sukharev
6e896ec428 * 🐛 fix(githook.ts): fix HOOK_PATH import path
The import path for HOOK_PATH was incorrect, causing the file to not be found. The path has been updated to correctly reference the cli.cjs file.
2023-03-06 21:07:03 +08:00
di-sukharev
9ce961ccc0 0.0.13 2023-03-06 21:03:28 +08:00
di-sukharev
1a2f6416cc * 🐛 fix(githook.ts): fix file path in URL constructor
The file path in the URL constructor was incorrect, causing the file to not be found. The file path has been corrected to point to the correct location.
2023-03-06 21:03:25 +08:00
di-sukharev
4fa438ab17 0.0.12 2023-03-06 21:00:50 +08:00
di-sukharev
4ad7a5f779 * 🐛 fix(githook.ts): fix HOOK_PATH import path
* 📝 docs(TODO.md): add tasks for adding tests and making hook work
The HOOK_PATH import path was incorrect and has been fixed. The TODO list has been updated to include tasks for adding tests and making the hook work.
2023-03-06 21:00:41 +08:00
di-sukharev
5c0b31600f 0.0.11 2023-03-06 19:27:34 +08:00
di-sukharev
d785b821ea * 📝 docs(README.md): comment out Git hook section
The Git hook section has been commented out as it is not currently relevant to the project.
2023-03-06 19:27:19 +08:00
di-sukharev
c50c416dfc 0.0.10 2023-03-06 19:22:34 +08:00
6 changed files with 23 additions and 12 deletions

View File

@@ -83,7 +83,7 @@ To remove description:
opencommit config set description=false
```
## Git hook
<!-- ## Git hook
You can set opencommit as Git [`prepare-commit-msg`](https://git-scm.com/docs/githooks#_prepare_commit_msg) hook. Hook integrates with you IDE Source Control and allows you edit the message before commit.
@@ -106,7 +106,7 @@ To use the hook:
git commit
```
Or follow the process of your IDE Source Control feature, when it calls `git commit` command — OpenCommit will integrate into the flow.
Or follow the process of your IDE Source Control feature, when it calls `git commit` command — OpenCommit will integrate into the flow. -->
## Payments

View File

@@ -2,4 +2,7 @@
- [] [build for both mjs and cjs](https://snyk.io/blog/best-practices-create-modern-npm-package/)
- [] make bundle smaller by properly configuring esbuild
- [] do // TODOs in the code
- [] batch small files in one request
- [] add tests
- [] make hook work

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "open-commit",
"version": "0.0.9",
"version": "0.0.19",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "open-commit",
"version": "0.0.9",
"version": "0.0.19",
"license": "ISC",
"dependencies": {
"@clack/prompts": "^0.6.1",

View File

@@ -1,6 +1,6 @@
{
"name": "opencommit",
"version": "0.0.9",
"version": "0.0.19",
"description": "AI generates conventional commits with mind-blowing accuracy.",
"keywords": [
"git",
@@ -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,10 +34,10 @@
},
"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",
"patch": "npm version patch",
"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"
},
"devDependencies": {

0
src/cli.ts Normal file → Executable file
View File

View File

@@ -20,7 +20,7 @@ export const hookCommand = command(
parameters: ['<set/unset>']
},
async (argv) => {
const HOOK_PATH = fileURLToPath(new URL('cli.cjs', import.meta.url));
const HOOK_PATH = fileURLToPath(new URL('cli.mjs', import.meta.url));
try {
await assertGitRepo();
@@ -29,8 +29,15 @@ export const hookCommand = command(
if (mode === 'set') {
intro(`setting opencommit as '${HOOK_NAME}' hook`);
if (isHookExists) {
const realPath = await fs.realpath(SYMLINK_URL);
let realPath;
try {
realPath = await fs.realpath(SYMLINK_URL);
} catch (error) {
outro(error as string);
realPath = null;
}
if (realPath === HOOK_PATH)
return outro(`opencommit is already set as '${HOOK_NAME}'`);
@@ -49,6 +56,7 @@ export const hookCommand = command(
if (mode === 'unset') {
intro(`unsetting opencommit as '${HOOK_NAME}' hook`);
if (!isHookExists) {
return outro(
`opencommit wasn't previously set as '${HOOK_NAME}' hook, nothing to remove`