jira-prepare-commit-msg icon indicating copy to clipboard operation
jira-prepare-commit-msg copied to clipboard

Feature Request: Usage of jira-prepare-commit-msg in a shared husky config

Open adamtay opened this issue 4 years ago • 3 comments

Is there a way that we could support jira-prepare-commit-msg when implemented within a shared husky config package?

From the readme, it seems as every application consuming the shared husky config file would need to define their own jira-prepare-commit-msg configuration file or to inherit/extend a configuration file that the shared config package exports?

adamtay avatar Jun 14 '21 05:06 adamtay

Hi @adamtay!

Sorry, but could you please describe an issue more, because I can't understand. What does mean shared husky config package? Is it monorepo or which folder structure do you have? From which root do you do commit?

Thanks

bk201- avatar Oct 12 '21 08:10 bk201-

@bk201- we publish a shared configuration internally within our org for husky v4 which looks something like -

// @org/husky-config
module.exports = {
  hooks: {
    "pre-commit": "lint-staged",
    "prepare-commit-msg": "jira-prepare-commit-msg",
  },
};

Individual applications can then consume this shared husky config file by having within their application -

// .huskyrc.js
module.exports = {
  ...require("@org/husky-config"),
};

The problem with this approach is that there is no way to configure the configurations for jira-prepare-commit-msg to be shared across all applications. For example, if I want to set jira-prepare-commit-msg.messagePattern, this must be defined within all applications rather than at a centralized level to ensure consistency between our applications.

I think what would be nice to have within our @org/husky-config package, is the ability to specify the config path which could then be exported as part of our npm package and thus shared across all our applications.

// @org/husky-config
module.exports = {
  hooks: {
    "pre-commit": "lint-staged",
    "prepare-commit-msg": "jira-prepare-commit-msg --config=./jira-prepare-commit-msg-config.js",
  },
};

This would be a similar pattern to what other packages like eslint and prettier are doing for example.

adamtay avatar Oct 12 '21 20:10 adamtay

Hi @adamtay! I understand the issue. Honestly, I so far want to add flags for configuration. It seems like this time came :)

The main idea is to remove cosmiconfig as dependence and probably add something less heavy. I hope config throw params also have to help with monorepo

bk201- avatar Oct 13 '21 20:10 bk201-