chore(package.json): update version to 1.1.18
refactor(commit.ts): rename getStagedGitDiff to getChangedFiles and remove unused import of generateCommitMessageWithChatCompletion refactor(commit.ts): reformat import statements for better readability refactor(commit.ts): reformat code for better readability feat(commit.ts): add support for selecting remote to push to when multiple remotes are available refactor(commit.ts): remove unnecessary code and fix formatting feat(commit.ts): add support for extraArgs parameter in generateCommitMessageFromGitDiff function chore(checkIsLatestVersion.ts): update console message for clarity and readability fix(git.ts): handle empty output from git command fix(git.ts): add -- argument to git diff command to handle file names with leading hyphens refactor(mergeStrings.ts): remove unnecessary whitespace and add missing semicolon
This commit is contained in:
@@ -11,11 +11,9 @@ export const checkIsLatestVersion = async () => {
|
||||
console.warn(
|
||||
chalk.yellow(
|
||||
`
|
||||
You are not using the latest stable version of OpenCommit!
|
||||
Consider updating to the latest version to get the latest features and bug fixes.
|
||||
Current version: ${currentVersion}
|
||||
Latest version: ${latestVersion}
|
||||
🎉 To update to the latest version, run: npm update opencommit
|
||||
You are not using the latest stable version of OpenCommit with new features and bug fixes.
|
||||
Current version: ${currentVersion}. Latest version: ${latestVersion}.
|
||||
🚀 To update run: npm i -g opencommit@latest.
|
||||
`
|
||||
)
|
||||
);
|
||||
|
||||
+6
-4
@@ -20,10 +20,10 @@ export const getOpenCommitIgnore = (): Ignore => {
|
||||
|
||||
try {
|
||||
ig.add(readFileSync('.opencommitignore').toString().split('\n'));
|
||||
} catch(e) {}
|
||||
} catch (e) {}
|
||||
|
||||
return ig;
|
||||
}
|
||||
};
|
||||
|
||||
export const getStagedFiles = async (): Promise<string[]> => {
|
||||
const { stdout: files } = await execa('git', [
|
||||
@@ -33,11 +33,12 @@ export const getStagedFiles = async (): Promise<string[]> => {
|
||||
'--relative'
|
||||
]);
|
||||
|
||||
if (!files) return [];
|
||||
|
||||
const filesList = files.split('\n');
|
||||
|
||||
|
||||
const ig = getOpenCommitIgnore();
|
||||
const allowedFiles = filesList.filter(file => !ig.ignores(file));
|
||||
const allowedFiles = filesList.filter((file) => !ig.ignores(file));
|
||||
|
||||
if (!allowedFiles) return [];
|
||||
|
||||
@@ -86,6 +87,7 @@ export const getDiff = async ({ files }: { files: string[] }) => {
|
||||
const { stdout: diff } = await execa('git', [
|
||||
'diff',
|
||||
'--staged',
|
||||
'--',
|
||||
...filesWithoutLocks
|
||||
]);
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ export function mergeStrings(arr: string[], maxStringLength: number): string[] {
|
||||
currentItem = item;
|
||||
}
|
||||
}
|
||||
|
||||
mergedArr.push(currentItem);
|
||||
|
||||
return mergedArr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user