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

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

Open
adamtay opened this issue Jun 14, 2021 · 3 comments
Open

Comments

@adamtay
Copy link

adamtay commented Jun 14, 2021

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?

@bk201-
Copy link
Owner

bk201- commented Oct 12, 2021

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

@adamtay
Copy link
Author

adamtay commented Oct 12, 2021

@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.

@bk201-
Copy link
Owner

bk201- commented Oct 13, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants