Skip to content

Allow multiple paths in --commit-path #909

@rigor789

Description

@rigor789

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

We're working in a monorepo, and would like to generate changelogs for the whole repo, excluding certain folders. I was able to achieve this using the git pathspec syntax, and a small change in git-raw-commits.

We're now able to use the following to generate the changelog excluding a specific sub-path:

conventional-changelog -p angular -i CHANGELOG.md -s --commit-path='. :!packages/*'

Not sure if this would fit in the scope of this project - but I thought I'd share in case anyone runs into a similar issue.

If this is something you are willing to merge, let me know and I can prepare a PR.

Here is the diff that solved my problem:

diff --git a/node_modules/git-raw-commits/index.js b/node_modules/git-raw-commits/index.js
index 767d4a0..e76c33c 100644
--- a/node_modules/git-raw-commits/index.js
+++ b/node_modules/git-raw-commits/index.js
@@ -32,7 +32,7 @@ function getGitArgs (gitOpts) {
   // allow commits to focus on a single directory
   // this is useful for monorepos.
   if (gitOpts.path) {
-    gitArgs.push('--', gitOpts.path)
+    gitArgs.push('--', ...gitOpts.path.split(' '))
   }
 
   return gitArgs.concat(dargs(gitOpts, {

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions