Compare commits

..

6 Commits

Author SHA1 Message Date
di-sukharev
e76db8276b 1.0.13 2023-03-11 00:20:09 +08:00
di-sukharev
c2ae98170c * refactor(api.ts): move apiKey initialization to the top of the file
* feat(api.ts): add check for process arguments to avoid intro message if 'config set' command is used
2023-03-11 00:19:29 +08:00
di-sukharev
91987030f0 1.0.12 2023-03-11 00:15:34 +08:00
di-sukharev
2a55b08b51 * refactor(api.ts): remove redundant code block and process.exit(1) call 2023-03-11 00:15:17 +08:00
di-sukharev
ed4d6e0109 1.0.11 2023-03-10 22:49:43 +08:00
di-sukharev
6712e798c5 * feat(cli.ts): add check for new opencommit version after commit is made
* chore(cli.ts): import execa and outro from their respective packages
2023-03-10 22:49:27 +08:00
4 changed files with 18 additions and 7 deletions

4
package-lock.json generated
View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "opencommit",
"version": "1.0.10",
"version": "1.0.13",
"description": "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
"keywords": [
"git",

View File

@@ -11,7 +11,9 @@ const config = getConfig();
let apiKey = config?.OPENAI_API_KEY;
if (!apiKey) {
const [command, mode] = process.argv.slice(2);
if (!apiKey && command !== 'config' && mode !== 'set') {
intro('opencommit');
outro(
@@ -20,6 +22,7 @@ if (!apiKey) {
outro(
'For help Look into README https://github.com/di-sukharev/opencommit#setup'
);
process.exit(1);
}

View File

@@ -7,6 +7,8 @@ import { configCommand } from './commands/config';
import { hookCommand, isHookCalled } from './commands/githook.js';
import { prepareCommitMessageHook } from './commands/prepare-commit-msg-hook';
import { commit } from './commands/commit';
import { execa } from 'execa';
import { outro } from '@clack/prompts';
const rawArgv = process.argv.slice(2);
@@ -19,11 +21,17 @@ cli(
ignoreArgv: (type) => type === 'unknown-flag' || type === 'argument',
help: { description: packageJSON.description }
},
() => {
async () => {
if (isHookCalled) {
prepareCommitMessageHook();
await prepareCommitMessageHook();
} else {
commit();
await commit();
const { stdout } = await execa('npm', ['view', 'opencommit', 'version']);
if (stdout !== packageJSON.version)
outro(
'new opencommit version is available, update with `npm i -g opencommit`'
);
}
},
rawArgv