mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-04-20 03:02:51 -04:00
Refactoring and cleaning for v3 (#244)
* chore(README.md): update setup instructions for OpenCommit as a GitHub Action fix(commit.ts): check if OCO_MESSAGE_TEMPLATE_PLACEHOLDER exists before replacing it in the commit message template The README.md file has been updated to reflect the changes in the setup instructions for using OpenCommit as a GitHub Action. The new instructions provide a file template for the GitHub Action workflow and include the latest version of the OpenCommit GitHub Action. In the commit.ts file, a fix has been made to check if the OCO_MESSAGE_TEMPLATE_PLACEHOLDER exists before replacing it in the commit message template. This ensures that the replacement is only performed when the placeholder is present, preventing any potential errors.
This commit is contained in:
12
out/cli.cjs
12
out/cli.cjs
@@ -16425,8 +16425,8 @@ var package_default = {
|
||||
start: "node ./out/cli.cjs",
|
||||
dev: "ts-node ./src/cli.ts",
|
||||
build: "rimraf out && node esbuild.config.js",
|
||||
deploy: "npm run build:push && npm version patch && git push --tags && git push && npm publish --tag latest",
|
||||
"build:push": "npm run build && git add . && git commit -m 'build' && git push",
|
||||
deploy: "npm run build:push && npm version patch && git push --tags && git push && npm publish --tag latest",
|
||||
lint: "eslint src --ext ts && tsc --noEmit",
|
||||
format: "prettier --write src"
|
||||
},
|
||||
@@ -21548,7 +21548,7 @@ var configValidators = {
|
||||
"gpt-3.5-turbo-16k",
|
||||
"gpt-3.5-turbo-0613"
|
||||
].includes(value),
|
||||
`${value} is not supported yet, use 'gpt-4', 'gpt-3.5-turbo-0613', 'gpt-3.5-turbo-0613' or 'gpt-3.5-turbo' (default)`
|
||||
`${value} is not supported yet, use 'gpt-4', 'gpt-3.5-turbo-16k' (default), 'gpt-3.5-turbo-0613' or 'gpt-3.5-turbo'`
|
||||
);
|
||||
return value;
|
||||
},
|
||||
@@ -22306,12 +22306,12 @@ var checkMessageTemplate = (extraArgs2) => {
|
||||
return false;
|
||||
};
|
||||
var generateCommitMessageFromGitDiff = async (diff, extraArgs2) => {
|
||||
const messageTemplate = checkMessageTemplate(extraArgs2);
|
||||
await assertGitRepo();
|
||||
const commitSpinner = le();
|
||||
commitSpinner.start("Generating the commit message");
|
||||
try {
|
||||
let commitMessage = await generateCommitMessageByDiff(diff);
|
||||
const messageTemplate = checkMessageTemplate(extraArgs2);
|
||||
if (typeof messageTemplate === "string") {
|
||||
commitMessage = messageTemplate.replace(
|
||||
config7?.OCO_MESSAGE_TEMPLATE_PLACEHOLDER,
|
||||
@@ -22320,7 +22320,7 @@ var generateCommitMessageFromGitDiff = async (diff, extraArgs2) => {
|
||||
}
|
||||
commitSpinner.stop("\u{1F4DD} Commit message generated");
|
||||
ce(
|
||||
`Commit message:
|
||||
`Generated commit message:
|
||||
${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014")}
|
||||
${commitMessage}
|
||||
${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014")}`
|
||||
@@ -22350,7 +22350,7 @@ ${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2
|
||||
});
|
||||
if (isPushConfirmedByUser && !eD2(isPushConfirmedByUser)) {
|
||||
const pushSpinner = le();
|
||||
pushSpinner.start(`Running \`git push ${remotes[0]}\``);
|
||||
pushSpinner.start(`Running 'git push ${remotes[0]}'`);
|
||||
const { stdout: stdout2 } = await execa("git", [
|
||||
"push",
|
||||
"--verbose",
|
||||
@@ -22372,7 +22372,7 @@ ${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2
|
||||
});
|
||||
if (!eD2(selectedRemote)) {
|
||||
const pushSpinner = le();
|
||||
pushSpinner.start(`Running \`git push ${selectedRemote}\``);
|
||||
pushSpinner.start(`Running 'git push ${selectedRemote}'`);
|
||||
const { stdout: stdout2 } = await execa("git", ["push", selectedRemote]);
|
||||
pushSpinner.stop(
|
||||
`${source_default.green(
|
||||
|
||||
@@ -27971,7 +27971,7 @@ var configValidators = {
|
||||
"gpt-3.5-turbo-16k",
|
||||
"gpt-3.5-turbo-0613"
|
||||
].includes(value),
|
||||
`${value} is not supported yet, use 'gpt-4', 'gpt-3.5-turbo-0613', 'gpt-3.5-turbo-0613' or 'gpt-3.5-turbo' (default)`
|
||||
`${value} is not supported yet, use 'gpt-4', 'gpt-3.5-turbo-16k' (default), 'gpt-3.5-turbo-0613' or 'gpt-3.5-turbo'`
|
||||
);
|
||||
return value;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user