Compare commits

...

8 Commits

Author SHA1 Message Date
di-sukharev
06fa6daa72 1.1.39 2023-04-01 13:24:57 +08:00
di-sukharev
af457473be 1.1.38 2023-04-01 13:24:33 +08:00
di-sukharev
33b418e399 1.1.37 2023-04-01 13:24:28 +08:00
di-sukharev
7e5ed6de0b refactor(commit.ts): add push command when no remotes are found
refactor(githook.ts): simplify switch statement by removing comments and adding inline comments
2023-04-01 13:24:15 +08:00
di-sukharev
e2f68b7256 refactor(githook.ts): replace comments with line breaks for switch cases in platform switch statement 2023-03-30 19:53:14 +08:00
di-sukharev
eacc750952 1.1.36 2023-03-30 15:15:03 +08:00
di-sukharev
3fe57537ad 1.1.35 2023-03-30 15:15:00 +08:00
di-sukharev
db9cff1ae1 refactor(githook.ts): add switch statement to determine path separator based on platform
fix(githook.ts): change path separator to use the determined separator variable
2023-03-30 15:14:43 +08:00
4 changed files with 27 additions and 4 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "opencommit",
"version": "1.1.34",
"version": "1.1.39",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "opencommit",
"version": "1.1.34",
"version": "1.1.39",
"license": "MIT",
"dependencies": {
"@clack/prompts": "^0.6.1",

View File

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

View File

@@ -79,6 +79,12 @@ ${chalk.grey('——————————————————')}`
const remotes = await getGitRemotes();
if (!remotes.length) {
const { stdout } = await execa('git', ['push']);
if (stdout) outro(stdout);
process.exit(0);
}
if (remotes.length === 1) {
const isPushConfirmedByUser = await confirm({
message: 'Do you want to run `git push`?'

View File

@@ -7,8 +7,25 @@ import chalk from 'chalk';
import { intro, outro } from '@clack/prompts';
import { COMMANDS } from '../CommandsEnum.js';
const platform = process.platform;
let separator = '';
switch (platform) {
case 'win32': // Windows
separator = path.sep;
break;
case 'darwin': // macOS
separator = '';
break;
case 'linux': // Linux
separator = '';
break;
default:
throw new Error(`Unsupported platform: ${platform}`);
}
const HOOK_NAME = 'prepare-commit-msg';
const SYMLINK_URL = path.join(path.sep, '.git', 'hooks', HOOK_NAME);
const SYMLINK_URL = path.join(separator, '.git', 'hooks', HOOK_NAME);
export const isHookCalled = process.argv[1].endsWith(`${SYMLINK_URL}`);