-
Notifications
You must be signed in to change notification settings - Fork 40
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
Show changelog only for changes in a subfolder #149
Comments
I don’t believe there currently is an easy way, but I agree, this would be a clearly useful use case |
Exactly, I think there are generally much less tools supporting monorepos this way and makes me think either the tooling has not caught up or I am incapable of finding it. This would allow something like :
then when run against module-1 just consider commits and tags from that one and bump and create changelog restricting to only that directory. |
+1 for some kind of support in this area. In my monorepo I tend to use the package name as the commit scope. So as a workaround I use the following script on the 'postchangelog' lifecycle hook to filter the changelog: import fs from 'fs';
import readline from 'readline';
const scope = process.cwd().match(/([^/]*)$/, '')[0];
const changelog = fs.createReadStream(`./CHANGELOG.md`);
const reader = readline.createInterface({
input: changelog,
crlfDelay: Infinity
});
let filtered = '';
for await (const line of reader) {
if (line.startsWith('* **')) {
const pattern = `**${scope}:** `;
if (line.includes(pattern)) filtered += line.replace(pattern, '') + '\n';
} else {
filtered += line + '\n';
}
}
fs.writeFileSync(`./CHANGELOG.md`, filtered); This assumes that the scope name, sub package name and folder are all equal. There are some obvious limitations to this approach but for the most part it works. |
try |
I have a mono repo which sets up various modules in subfolders:
/modules/module1
/modules/module2
...
With tags formatted as
modules/module1/v1.2.3
andmodules/module2/v1.2.3
.Is it possible to enable changelog generation that loads only those changes within one of these folders between tags with that name? I am able to retrieve the current tag and the next tag, so that would probably just be done with CLI parameters, but I am unsure about the changelog generation. Is there a way to "pipe" a custom list of commits into the script?
The text was updated successfully, but these errors were encountered: