Skip to content

Address a possible pitfall related to config file #25

Description

@demacdonald

Currently iterate over the fields provided in the config ("error", "debug", etc) for colors.

Would be better if we iterated over the known set of functions we support instead.

In the case someone adds additional fields in the config that do not belong there we should not be creating additional chalk functions.

For example:

{
    "colors": {
        "logs": {
            "default": ["red"],
            "error": ["bgRed", "cyan"]
            "a": ["bgRed", "cyan"]
            "b": ["bgRed", "cyan"]
            "c": ["bgRed", "cyan"]
            "d": ["bgRed", "cyan"]
            "e": ["bgRed", "cyan"]
            "f": ["bgRed", "cyan"]
            "g": ["bgRed", "cyan"]
            "h": ["bgRed", "cyan"]
            "i": ["bgRed", "cyan"]
        }
    }
}

In above example, we are currently building chalk functions for each of them even though we will never use them.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions