mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-01-13 07:38:01 -05:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1499bbeb18 | ||
|
|
ffd5d9967a | ||
|
|
1a32bff538 | ||
|
|
297ccac45b | ||
|
|
3859533eff | ||
|
|
757faba0c4 | ||
|
|
422d38d51e | ||
|
|
ee02be56b2 | ||
|
|
1c762a6e8c | ||
|
|
6126fad25c | ||
|
|
01cdd2f58d | ||
|
|
acdf464d2e | ||
|
|
3705a66ada | ||
|
|
bdb8da49b7 | ||
|
|
6e896ec428 | ||
|
|
9ce961ccc0 | ||
|
|
1a2f6416cc | ||
|
|
4fa438ab17 | ||
|
|
4ad7a5f779 | ||
|
|
5c0b31600f | ||
|
|
d785b821ea | ||
|
|
c50c416dfc | ||
|
|
f8720ff089 | ||
|
|
afa5949c06 | ||
|
|
b1ec69e4dd | ||
|
|
0061816b6a | ||
|
|
352b81c6c6 | ||
|
|
430776af29 | ||
|
|
c573edea97 | ||
|
|
5282734583 | ||
|
|
9c67a3774f | ||
|
|
deeb7cdf97 | ||
|
|
fe819f0814 |
6
TODO.md
6
TODO.md
@@ -1,4 +1,8 @@
|
||||
# TODOs
|
||||
|
||||
- [] [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
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "open-commit",
|
||||
"version": "0.0.3",
|
||||
"version": "0.0.20",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "open-commit",
|
||||
"version": "0.0.3",
|
||||
"version": "0.0.20",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^0.6.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "opencommit",
|
||||
"version": "0.0.3",
|
||||
"version": "0.0.20",
|
||||
"description": "AI generates conventional commits with mind-blowing accuracy.",
|
||||
"keywords": [
|
||||
"git",
|
||||
@@ -37,7 +37,7 @@
|
||||
"start": "node ./out/cli.cjs",
|
||||
"dev": "ts-node ./src/cli.ts",
|
||||
"build": "rimraf out && esbuild ./src/cli.ts --bundle --outfile=out/cli.cjs --format=cjs --platform=node",
|
||||
"publish": "npm version patch && npm publish",
|
||||
"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
0
src/cli.ts
Normal file → Executable file
@@ -20,7 +20,7 @@ export const hookCommand = command(
|
||||
parameters: ['<set/unset>']
|
||||
},
|
||||
async (argv) => {
|
||||
const HOOK_PATH = fileURLToPath(new URL('cli.mjs', import.meta.url));
|
||||
const HOOK_URL = __filename;
|
||||
|
||||
try {
|
||||
await assertGitRepo();
|
||||
@@ -29,10 +29,17 @@ export const hookCommand = command(
|
||||
|
||||
if (mode === 'set') {
|
||||
intro(`setting opencommit as '${HOOK_NAME}' hook`);
|
||||
if (isHookExists) {
|
||||
const realPath = await fs.realpath(SYMLINK_URL);
|
||||
|
||||
if (realPath === HOOK_PATH)
|
||||
if (isHookExists) {
|
||||
let realPath;
|
||||
try {
|
||||
realPath = await fs.realpath(SYMLINK_URL);
|
||||
} catch (error) {
|
||||
outro(error as string);
|
||||
realPath = null;
|
||||
}
|
||||
|
||||
if (realPath === HOOK_URL)
|
||||
return outro(`opencommit is already set as '${HOOK_NAME}'`);
|
||||
|
||||
throw new Error(
|
||||
@@ -41,7 +48,7 @@ export const hookCommand = command(
|
||||
}
|
||||
|
||||
await fs.mkdir(path.dirname(SYMLINK_URL), { recursive: true });
|
||||
await fs.symlink(HOOK_PATH, SYMLINK_URL, 'file');
|
||||
await fs.symlink(HOOK_URL, SYMLINK_URL, 'file');
|
||||
await fs.chmod(SYMLINK_URL, 0o755);
|
||||
|
||||
return outro(`${chalk.green('✔')} Hook set`);
|
||||
@@ -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`
|
||||
@@ -56,7 +64,7 @@ export const hookCommand = command(
|
||||
}
|
||||
|
||||
const realpath = await fs.realpath(SYMLINK_URL);
|
||||
if (realpath !== HOOK_PATH) {
|
||||
if (realpath !== HOOK_URL) {
|
||||
return outro(
|
||||
`opencommit wasn't previously set as '${HOOK_NAME}' hook, but different hook was, if you want to remove it — do it manually`
|
||||
);
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
/* Projects */
|
||||
|
||||
/* Language and Environment */
|
||||
"target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
||||
"target": "ES2020" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
||||
"lib": [
|
||||
"ES6"
|
||||
"ES5"
|
||||
] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
|
||||
|
||||
/* Modules */
|
||||
"module": "ESNext" /* Specify what module code is generated. */,
|
||||
"module": "CommonJS" /* Specify what module code is generated. */,
|
||||
// "rootDir": "./src" /* Specify the root folder within your source files. */,
|
||||
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
||||
"resolveJsonModule": true /* Enable importing .json files. */,
|
||||
|
||||
Reference in New Issue
Block a user