better-commits 1.0.2 → 1.0.4

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/index.js CHANGED
@@ -72,7 +72,7 @@ var FOOTER_OPTION_VALUES = ["closes", "breaking-change", "deprecated"];
72
72
  function infer_type_from_branch(types) {
73
73
  let branch = "";
74
74
  try {
75
- branch = (0, import_child_process.execSync)("git rev-parse --abbrev-ref HEAD", { stdio: "pipe" }).toString();
75
+ branch = (0, import_child_process.execSync)("git branch --show-current", { stdio: "pipe" }).toString();
76
76
  } catch (err) {
77
77
  return "";
78
78
  }
@@ -267,7 +267,7 @@ async function main(config) {
267
267
  }
268
268
  if (config.check_ticket.infer_ticket) {
269
269
  try {
270
- const branch = (0, import_child_process2.execSync)("git rev-parse --abbrev-ref HEAD", { stdio: "pipe" }).toString();
270
+ const branch = (0, import_child_process2.execSync)("git branch --show-current", { stdio: "pipe" }).toString();
271
271
  const found = [branch.match(REGEX_SLASH_TAG), branch.match(REGEX_SLASH_NUM), branch.match(REGEX_START_TAG), branch.match(REGEX_START_NUM)].filter((v) => v != null).map((v) => v && v.length >= 2 ? v[1] : "");
272
272
  if (found.length && found[0]) {
273
273
  commit_state.ticket = config.check_ticket.append_hashtag ? "#" + found[0] : found[0];
package/dist/utils.js CHANGED
@@ -86,7 +86,7 @@ var FOOTER_OPTION_VALUES = ["closes", "breaking-change", "deprecated"];
86
86
  function infer_type_from_branch(types) {
87
87
  let branch = "";
88
88
  try {
89
- branch = (0, import_child_process.execSync)("git rev-parse --abbrev-ref HEAD", { stdio: "pipe" }).toString();
89
+ branch = (0, import_child_process.execSync)("git branch --show-current", { stdio: "pipe" }).toString();
90
90
  } catch (err) {
91
91
  return "";
92
92
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "better-commits",
3
3
  "private": false,
4
- "version": "1.0.2",
4
+ "version": "1.0.4",
5
5
  "description": "A CLI for creating better commits following the conventional commit guidelines",
6
6
  "author": "Erik Verduin (https://github.com/everduin94)",
7
7
  "keywords": [
package/readme.md CHANGED
@@ -38,12 +38,12 @@ To modify, these prompts, see `configuration`.
38
38
 
39
39
  ## ⚙️ Configuration
40
40
 
41
- Your first time running `better-commits`, a default config will be generated in your `$HOME` directory. -- This is your global config, it will be used if a repository-specific config cannot be found.
41
+ Your first time running `better-commits`, a default config will be generated in your `$HOME` directory, named `.better-commits.json`. -- This is your global config, it will be used if a repository-specific config cannot be found.
42
42
 
43
43
  To create a **repository-specific config**, navigate to the root of your project.
44
44
  - run `better-commits-init`
45
45
 
46
- This will create a config with all of the defaults. From there, you can modify it to suit your needs.
46
+ This will create a config named `.better-commits.json` with all of the defaults. From there, you can modify it to suit your needs.
47
47
 
48
48
  All properties are optional, they can be removed from your configuration and will be replaced by the defaults at run-time.
49
49
 
@@ -181,6 +181,10 @@ To simplify the CLI, some rules are enforced at runtime to make sure the program
181
181
  - if you're using Github issues to track your work, and select the `closes` footer option when writing your commit. Github will **automatically link and close** that issue when your **pr is merged**
182
182
  - [better-commits](https://packagephobia.com/result?p=better-commits) is much smaller than its alternative [commitizen](https://packagephobia.com/result?p=commitizen)
183
183
 
184
+ ## ❓ Troubleshooting
185
+
186
+ `TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor)`. This may happen because you're running something like git-bash on Windows. Try another terminal/command-prompt or `winpty` to see if its still an issue.
187
+
184
188
  ## Alternatives
185
189
  - Commitizen
186
190
 
package/src/index.ts CHANGED
@@ -120,7 +120,7 @@ async function main(config: z.infer<typeof Config>) {
120
120
 
121
121
  if (config.check_ticket.infer_ticket) {
122
122
  try {
123
- const branch = execSync('git rev-parse --abbrev-ref HEAD', {stdio : 'pipe' }).toString();
123
+ const branch = execSync('git branch --show-current', {stdio : 'pipe' }).toString();
124
124
  const found: string[] = [branch.match(REGEX_SLASH_TAG), branch.match(REGEX_SLASH_NUM) , branch.match(REGEX_START_TAG), branch.match(REGEX_START_NUM)]
125
125
  .filter(v => v != null)
126
126
  .map(v => v && v.length >= 2 ? v[1] : '')
package/src/utils.ts CHANGED
@@ -41,7 +41,7 @@ export const FOOTER_OPTION_VALUES: FOOTER_OPTIONS[] = ['closes', 'breaking-chang
41
41
  export function infer_type_from_branch(types: string[]): string {
42
42
  let branch = ''
43
43
  try {
44
- branch = execSync('git rev-parse --abbrev-ref HEAD', {stdio : 'pipe' }).toString();
44
+ branch = execSync('git branch --show-current', {stdio : 'pipe' }).toString();
45
45
  } catch (err) {
46
46
  return ''
47
47
  }