Skip to content

Commit

Permalink
🐛 Fix(index.ts,defaultConfig): wrong commit return value and defaultC…
Browse files Browse the repository at this point in the history
…onfig SCOPES options (website has same value as api)
  • Loading branch information
INeedJobToStartWork committed Jan 16, 2024
2 parents 5a1f911 + 18368ec commit 89db0fc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 102 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# commitsmile

## 0.3.10

### Patch Changes

- fix commit message bug + scopes bug (same value website and api)

## 0.3.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "commitsmile",
"version": "0.3.9",
"version": "0.3.10",
"description": "Make smile on your commits",
"keywords": [],
"homepage": "",
Expand Down
2 changes: 1 addition & 1 deletion src/defaultConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const defaultConfig: z.infer<typeof configSchema> = {
options: [
{ label: "🌍 Enviroment", value: "enviroment" },
{ label: "📖 Docs", value: "docs" },
{ label: "🌐 Website", value: "api" },
{ label: "🌐 Website", value: "web" },
{ label: "📱 Mobile", value: "mobile" },
{ label: "🍃 API", value: "api" }
]
Expand Down
110 changes: 10 additions & 100 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,7 @@ program
logging.debug("Options: ", options);

const config = await getConfiguration(options.config);
// const Answers = await prompter.group(
// {
// changes: async () => await select(config.CHANGES),
// scopes: async () => await select(config.SCOPES),
// commitShort: async () => await prompter.text(config.COMMIT_SHORT),
// commitDescription: async () => await prompter.text(config.COMMIT_DESCRIPTION),
// commit: async ({ results }) => {
// const { changes, scopes, commitShort } = results;
// const commit = (): string => {
// const scopesFormat = scopes ? `(${scopes})` : "";
// return `${changes}${scopesFormat}: ${commitShort}`;
// };
// prompter.note(commit());
// let agree = await prompter.confirm({ message: "Commit message is correct?" });
// if (prompter.isCancel(agree) || !agree) {
// prompter.cancel("Commit message is canceled!");
// process.exit(0);
// }
// return commit;
// }
// },
// {
// onCancel: () => {
// prompter.cancel("Operation cancelled.");
// process.exit(0);
// }
// }
// );
// console.log(Answers.commit);
const group = await prompter.group(
const Answers = await prompter.group(
{
changes: async () => select(config.CHANGES),
scopes: async () => select(config.SCOPES),
Expand All @@ -74,84 +45,23 @@ program
}
},
{
// On Cancel callback that wraps the group
// So if the user cancels one of the prompts in the group this function will be called
onCancel: ({ results }) => {
onCancel: () => {
prompter.cancel("Operation cancelled.");
process.exit(0);
}
}
);

console.log(group.changes, group.scopes, group.commitShort, group.commitDescription, group.commit);
console.log(`git commit -m "${group.commit}" ${group.commitDescription ? `-m "${group.commitDescription}"` : ""}`);

// logging.info(
// `git commit -m "${Answers.commit}" ${Answers.commitDescription ? `-m "${Answers.commitDescription}"` : ""}`
// );
// spawnSync(
// `git commit -m "${Answers.commit}" ${Answers.commitDescription ? `-m "${Answers.commitDescription}"` : ""}`,
// {
// shell: true,
// stdio: "inherit"
// }
// );
logging.debug(Answers.commit);
spawnSync(
`git commit -m "${Answers.commit}" ${Answers.commitDescription ? `-m "${Answers.commitDescription}"` : ""}`,
{
shell: true,
stdio: "inherit"
}
);

return process.exit(0);
});
// program
// .description("Execute Commit Smile application")
// .option("-C, --config <relativePath>", "path to config", EXECUTED_PATH)
// .option("-D, --debugger", "Debugger mode", false)
// .action(async (options: { debugger: boolean; config: string }) => {
// process.env.DEBUG = options.debugger ? "TRUE" : "FALSE";

// logging.debug("Debug mode enabled");
// logging.debug("Options: ", options);

// const config = await getConfiguration(options.config);
// const Answers = await prompter.group(
// {
// changes: async () => await select(config.CHANGES),
// scopes: async () => await select(config.SCOPES),
// commitShort: async () => await prompter.text(config.COMMIT_SHORT),
// commitDescription: async () => await prompter.text(config.COMMIT_DESCRIPTION),
// commit: async ({ results }) => {
// const { changes, scopes, commitShort } = results;
// const commit = (): string => {
// const scopesFormat = scopes ? `(${scopes})` : "";
// return `${changes}${scopesFormat}: ${commitShort}`;
// };
// prompter.note(commit());
// let agree = await prompter.confirm({ message: "Commit message is correct?" });
// if (prompter.isCancel(agree) || !agree) {
// prompter.cancel("Commit message is canceled!");
// process.exit(0);
// }
// return commit;
// }
// },
// {
// onCancel: () => {
// prompter.cancel("Operation cancelled.");
// process.exit(0);
// }
// }
// );
// console.log(Answers.commit);
// // logging.info(
// // `git commit -m "${Answers.commit}" ${Answers.commitDescription ? `-m "${Answers.commitDescription}"` : ""}`
// // );
// // spawnSync(
// // `git commit -m "${Answers.commit}" ${Answers.commitDescription ? `-m "${Answers.commitDescription}"` : ""}`,
// // {
// // shell: true,
// // stdio: "inherit"
// // }
// // );

// return process.exit(0);
// });

// program
// .command("init")
Expand Down

0 comments on commit 89db0fc

Please sign in to comment.