refactor(githook.ts): remove unused platform variable and switch statement

fix(githook.ts): change DEFAULT_SYMLINK_URL to use relative path instead of absolute path
This commit is contained in:
di-sukharev
2023-04-05 12:35:23 +08:00
parent a5e60ac23c
commit 2b10dc089c
+1 -23
View File
@@ -7,30 +7,8 @@ import chalk from 'chalk';
import { intro, outro } from '@clack/prompts';
import { COMMANDS } from '../CommandsEnum.js';
const platform = process.platform;
let separator = '';
switch (platform) {
// Windows
case 'win32':
separator = path.sep;
break;
// macOS
case 'darwin':
separator = '';
break;
// Linux and Android
case 'android':
case 'linux':
separator = '';
break;
default:
throw new Error(`Unsupported platform: ${platform}`);
}
const HOOK_NAME = 'prepare-commit-msg';
const DEFAULT_SYMLINK_URL = path.join(separator, '.git', 'hooks', HOOK_NAME);
const DEFAULT_SYMLINK_URL = path.join('.git', 'hooks', HOOK_NAME);
const getHooksPath = async (): Promise<string> => {
try {