better-commits 1.11.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/branch.js CHANGED
@@ -280,6 +280,7 @@ var Config = import_zod2.z.object({
280
280
  breaking_change: import_zod2.z.object({
281
281
  add_exclamation_to_title: import_zod2.z.boolean().default(true)
282
282
  }).default({}),
283
+ confirm_with_editor: import_zod2.z.boolean().default(false),
283
284
  confirm_commit: import_zod2.z.boolean().default(true),
284
285
  print_commit_output: import_zod2.z.boolean().default(true),
285
286
  branch_pre_commands: import_zod2.z.array(import_zod2.z.string()).default([]),
package/dist/index.js CHANGED
@@ -344,6 +344,7 @@ var Config = import_zod2.z.object({
344
344
  breaking_change: import_zod2.z.object({
345
345
  add_exclamation_to_title: import_zod2.z.boolean().default(true)
346
346
  }).default({}),
347
+ confirm_with_editor: import_zod2.z.boolean().default(false),
347
348
  confirm_commit: import_zod2.z.boolean().default(true),
348
349
  print_commit_output: import_zod2.z.boolean().default(true),
349
350
  branch_pre_commands: import_zod2.z.array(import_zod2.z.string()).default([]),
@@ -646,6 +647,12 @@ async function main(config) {
646
647
  commit_state.trailer = "";
647
648
  }
648
649
  }
650
+ if (config.confirm_with_editor) {
651
+ const options = config.overrides.shell ? { shell: config.overrides.shell, stdio: "inherit" } : { stdio: "inherit" };
652
+ const trailer = commit_state.trailer ? `--trailer="${commit_state.trailer}"` : "";
653
+ (0, import_child_process3.execSync)(`git commit -m "${build_commit_string(commit_state, config, false, true, false)}" ${trailer} --edit`, options);
654
+ process.exit(0);
655
+ }
649
656
  let continue_commit = true;
650
657
  p3.note(build_commit_string(commit_state, config, true, false, true), "Commit Preview");
651
658
  if (config.confirm_commit) {
package/dist/init.js CHANGED
@@ -232,6 +232,7 @@ var Config = import_zod2.z.object({
232
232
  breaking_change: import_zod2.z.object({
233
233
  add_exclamation_to_title: import_zod2.z.boolean().default(true)
234
234
  }).default({}),
235
+ confirm_with_editor: import_zod2.z.boolean().default(false),
235
236
  confirm_commit: import_zod2.z.boolean().default(true),
236
237
  print_commit_output: import_zod2.z.boolean().default(true),
237
238
  branch_pre_commands: import_zod2.z.array(import_zod2.z.string()).default([]),
package/dist/utils.js CHANGED
@@ -158,6 +158,7 @@ var Config = import_zod.z.object({
158
158
  breaking_change: import_zod.z.object({
159
159
  add_exclamation_to_title: import_zod.z.boolean().default(true)
160
160
  }).default({}),
161
+ confirm_with_editor: import_zod.z.boolean().default(false),
161
162
  confirm_commit: import_zod.z.boolean().default(true),
162
163
  print_commit_output: import_zod.z.boolean().default(true),
163
164
  branch_pre_commands: import_zod.z.array(import_zod.z.string()).default([]),
package/dist/zod-state.js CHANGED
@@ -230,6 +230,7 @@ var Config = import_zod2.z.object({
230
230
  breaking_change: import_zod2.z.object({
231
231
  add_exclamation_to_title: import_zod2.z.boolean().default(true)
232
232
  }).default({}),
233
+ confirm_with_editor: import_zod2.z.boolean().default(false),
233
234
  confirm_commit: import_zod2.z.boolean().default(true),
234
235
  print_commit_output: import_zod2.z.boolean().default(true),
235
236
  branch_pre_commands: import_zod2.z.array(import_zod2.z.string()).default([]),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "better-commits",
3
3
  "private": false,
4
- "version": "1.11.0",
4
+ "version": "1.12.0",
5
5
  "description": "A CLI for creating better commits following the conventional commits specification",
6
6
  "author": "Erik Verduin (https://github.com/everduin94)",
7
7
  "keywords": [
package/readme.md CHANGED
@@ -217,6 +217,7 @@ Better-commits (& better-branch) are highly flexible with sane defaults. These o
217
217
  "add_exclamation_to_title": true
218
218
  },
219
219
  "confirm_commit": true,
220
+ "confirm_with_editor": false,
220
221
  "print_commit_output": true,
221
222
  "branch_pre_commands": [],
222
223
  "branch_post_commands": [],
@@ -307,6 +308,7 @@ Better-commits (& better-branch) are highly flexible with sane defaults. These o
307
308
  | `commit_footer.options` | Footer options |
308
309
  | `breaking_change.add_exclamation_to_title` | If true adds exclamation mark to title for breaking changes |
309
310
  | `confirm_commit` | If true manually confirm commit at end |
311
+ | `confirm_with_editor` | Confirm / Edit commit with $GIT_EDITOR / $EDITOR |
310
312
  | `print_commit_output` | If true pretty print commit preview |
311
313
  | `overrides.shell` | Override default shell, useful for windows users |
312
314
 
@@ -405,6 +407,10 @@ If you're using Github issues to track your work, and select the `closes` footer
405
407
 
406
408
  `better-commits` uses native `git` commands under the hood. So any hooks, tools, or staging should work as if it was a normal commit.
407
409
 
410
+ Setting `confirm_with_editor=true` will allow you to edit/confirm a commit with your editor.
411
+ - For example, to edit with Neovim: `git config --global core.editor "nvim"`
412
+ - For VS Code, `git config --global core.editor "code -n --wait"`
413
+
408
414
  You can add this badge to your repository to display that you're using a better-commits repository config
409
415
 
410
416
  | Markdown | Result |
package/src/index.ts CHANGED
@@ -207,7 +207,13 @@ export async function main(config: z.infer<typeof Config>) {
207
207
  commit_state.trailer = '';
208
208
  }
209
209
  }
210
-
210
+
211
+ if (config.confirm_with_editor) {
212
+ const options = config.overrides.shell ? { shell: config.overrides.shell, stdio: 'inherit' } : { stdio: 'inherit' }
213
+ const trailer = commit_state.trailer ? `--trailer="${commit_state.trailer}"` : '';
214
+ execSync(`git commit -m "${build_commit_string(commit_state, config, false, true, false)}" ${trailer} --edit`, options);
215
+ process.exit(0);
216
+ }
211
217
 
212
218
  let continue_commit = true;
213
219
  p.note(build_commit_string(commit_state, config, true, false, true), 'Commit Preview')
package/src/zod-state.ts CHANGED
@@ -124,6 +124,7 @@ export const Config = z
124
124
  add_exclamation_to_title: z.boolean().default(true),
125
125
  })
126
126
  .default({}),
127
+ confirm_with_editor: z.boolean().default(false),
127
128
  confirm_commit: z.boolean().default(true),
128
129
  print_commit_output: z.boolean().default(true),
129
130
  branch_pre_commands: z.array(z.string()).default([]),