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

feat!: add option to customize types/scopes to exclude #103

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

tmlmt
Copy link
Contributor

@tmlmt tmlmt commented Apr 14, 2023

The current version of changelogen (great piece of work by the way <3) seems opinionated, as it hard codes the exclusion of chore(deps) from changelogs by filtering parsed commits:

const commits = parseCommits(rawCommits, config).filter(
(c) =>
config.types[c.type] &&
!(c.type === "chore" && c.scope === "deps" && !c.isBreaking)
);

I like to keep track of the history of my dependencies, so I would like to have the possibility to include those commits in the generated changelog. This is what this PR enables, with an new config option, excludeChoreDeps which defaults to true as being the current behavior.

In order to add a corresponding test (with both boolean values of the option), I've decided to export a new function, filterParsedCommits, which I can import in the test file and run tests on it.

I hope that is acceptable 😃

@pi0
Copy link
Member

pi0 commented Aug 22, 2023

Thanks for this PR (and sorry took too long to review!). I like the idea. Only thinking to find a better option namespace so that we could include more configurations like this about changelog filtering without adding too many top level options (ideas welcome!)

@pi0 pi0 marked this pull request as draft August 22, 2023 12:08
@tmlmt
Copy link
Contributor Author

tmlmt commented Aug 22, 2023

Hey @pi0, thanks for reverting! Do you have any idea of such typical cases? I proposed this specific option because chore(deps) was the only one originally hard-coded.

Well in that case one could think of something like --exclude <comma-separated list of types/scopes to exclude>. For instance --exclude ci,chore(deps) defaulting (or not) to chore(deps).

We could also think about:

  1. adding this as a config parameter
  2. similarly propose an --include or --include-only option to only include certain types or scopes

What are your thoughts?

@tmlmt tmlmt changed the title feat: add option to include chore(deps) commits feat!: add option to customize types/scopes to exclude Oct 22, 2023
@codecov
Copy link

codecov bot commented Oct 22, 2023

Codecov Report

Attention: Patch coverage is 75.00000% with 8 lines in your changes missing coverage. Please review.

Project coverage is 47.10%. Comparing base (0914fd7) to head (c751676).
Report is 22 commits behind head on main.

Files with missing lines Patch % Lines
src/commands/default.ts 0.00% 7 Missing ⚠️
src/git.ts 95.83% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #103       +/-   ##
===========================================
- Coverage   69.10%   47.10%   -22.00%     
===========================================
  Files           9       12        +3     
  Lines         916     1002       +86     
  Branches       85      101       +16     
===========================================
- Hits          633      472      -161     
- Misses        283      527      +244     
- Partials        0        3        +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tmlmt
Copy link
Contributor Author

tmlmt commented Oct 22, 2023

Hey @pi0, I am back on this one with a proposal which generalizes my original PR as requested. The new option exclude, actionable both in config file and cli, enables to customize which entire types (e.g. fix, chore) or types+scopes (e.g. chore(deps)) to exclude from the changelog.

  • Default: [""] ⚠️ this is what makes it a breaking change (current default is to exclude chore(deps)). We could make it non-breaking by either:
  • Example in changelog.config: exclude: ["ci", "chore(deps")]
  • Example in command line: `npx changelogen@latest --bump --exclude 'ci,chore(deps)'

Let me know what you think :)

@JohnCampionJr
Copy link
Contributor

This would be useful!

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

Successfully merging this pull request may close these issues.

3 participants