Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search for config in .gitmojirc.json even if package.json file exists #919

Closed
vhoyer opened this issue Sep 19, 2022 · 2 comments · Fixed by #924
Closed

Search for config in .gitmojirc.json even if package.json file exists #919

vhoyer opened this issue Sep 19, 2022 · 2 comments · Fixed by #924
Labels

Comments

@vhoyer
Copy link

vhoyer commented Sep 19, 2022

Describe the bug

When we have a package.json file, the .gitmojirc.json file is ignored.

The behavior I'd expect for this, would be.

  • do we have a package.json file?
    • YES: do we have a gitmoji property in the package.json file?
      • YES: then use the require(package.json).gitmoji as config
      • NO: goto [gitmojirc]
    • NO: [gitmojirc] do we have a .gitmojirc.json file?
      • YES: then use the require(gitmojirc.json) as config
      • NO: then use the default configuration (LOCAL_)

The behavior we currently have is this:

  • do we have a package.json file?
    • YES: do we have a gitmoji property in the package.json file?
      • YES: then use the require(package.json).gitmoji as config
      • NO: then use the default configuration (LOCAL_)
    • NO: do we have a .gitmojirc.json file?
      • YES: then use the require(gitmojirc.json) as config
      • NO: then use the default configuration (LOCAL_)

Reproduction

assuming default global configuration for gitmoji-cli

mkdir gitmoji-cli-issue-config-fallback
cd gitmoji-cli-issue-config-fallback
npm init -y
echo <<EOF > .gitmojirc.json
{
  "scopePrompt": true,
}
EOF
gitmoji -c

this will NOT prompt you for scope, even though I think it SHOULD

System Info

System:
    OS: Linux 5.15 Manjaro Linux
    CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
    Memory: 6.24 GB / 15.35 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.8.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 8.19.1 - /usr/bin/npm
  Browsers:
    Firefox: 104.0.2


### Validations

- [X] Follow our [Code of Conduct](https://github.com/carloscuesta/gitmoji-cli/blob/master/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guide](https://github.com/carloscuesta/gitmoji-cli/blob/master/.github/CONTRIBUTING.md).
- [X] Check that there isn't already an issue that reports the same bug to avoid creating duplicates.
- [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- [X] The provided reproduction is a [minimal reproducible](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
@carloscuesta
Copy link
Owner

Hey!

Thanks for opening the issue I think it definitely makes more sense to fallback into different configuration systems and ultimately use the local & defaults as a fallback

Will try to take a look at this 👀

@carloscuesta
Copy link
Owner

Hey @vhoyer this should be fixed in 6.3.0, let me know if you spot any issues 🙏

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants