Skip to content

support config file #460

Closed
Closed

Description

@zyy7259

support .czrc or cz.config.js config file through https://github.com/davidtheclark/cosmiconfig

Activity

  1. prometheas commented on May 28, 2018

    @prometheas

    I must first say that it's very courteous indeed that commitizen at least looks for its configs under a top-level config key in package.json, rather than forcing us to jam another bespoke key name in that file like so many other packages do, but… definitely this, please!

  2. lucascono commented on Jan 28, 2019

    @lucascono

    Please, implement cosmiconfig. It is very useful to be able to highlight syntax in text editors according to file extensions.

  3. Nargonath commented on Jun 19, 2019

    @Nargonath

    Another use case for this is when you want to gather all your configuration into one package ala react-scripts.

  4. fsmaia commented on May 14, 2020

    @fsmaia
    Contributor

    I would love this too! Any help wanted?

  5. travi commented on May 14, 2020

    @travi
    Contributor

    is there something special desired about cosmiconfig that isn't handled currently? i've been using .czrc files in my projects for quite a while. here are the currently supported sources:

    var configs = ['.czrc', '.cz.json', 'package.json'];

  6. Nargonath commented on May 14, 2020

    @Nargonath

    From what I remembered since my last post, what I wanted to do is "import" my configuration from a package instead of having it in the root folder i.e for prettier I can do that:

    // .prettierrc.js
    const config = require('my-prettier-config');
    
    module.exports = config;

    From what I understand such behavior was not possible at least in 2019 when I commented.

  7. fsmaia commented on May 14, 2020

    @fsmaia
    Contributor

    I found out that the configuration is read in the presets/styles instead of cz-cli. Example:
    https://github.com/commitizen/cz-conventional-changelog/blob/master/index.js#L7

  8. Nargonath commented on May 15, 2020

    @Nargonath

    I'm not sure what you mean by that.

  9. fsmaia commented on May 15, 2020

    @fsmaia
    Contributor

    I mean that configLoader is used by cz-cli to determine the preset, but preset with additional configurations must also call configLoader to load them, otherwise rc file configurations won't be read.

    But IMHO this issue's main purpose is the lack of documentation concerning configuration files. A simple phrase in README like: "this project uses cosmiconfig" would be enough.

  10. prometheas commented on May 19, 2020

    @prometheas

    Yes, agree with @fsmaia that the heart of this issue is the lack of documentation around the package's support of config files, though it's hard to know without confirmation from its creator, @zyy7259.

    That said, assuming this is correct, the PR above (assuming it's approved and merged) does seem allow this issue to be closed…

  11. commitizen-bot commented on Aug 21, 2020

    @commitizen-bot

    🎉 This issue has been resolved in version 4.1.3 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  12. pmcelhaney commented on Jan 5, 2022

    @pmcelhaney
    Contributor

    For anyone following this thread I just created a PR to support cosmiconfig attached to #773

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions