-
Notifications
You must be signed in to change notification settings - Fork 17
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
Support for parserOpts #8
Comments
Took a stab at some stuff and got at least a decent start going. Not sure I have enough to make a full blown PR for you with tests and all. It would probably make more since in config file so it could be usable by all the projects in my monorepo without having to repeat myself. Here's what I've got. plugins.ts
scheme.json
semantic-release.ts
|
Hey jreilly-lukava, thanks for the suggestion! Seems like having option to customize the Thanks! |
I'm new to semantic-release so I've been beating my head against the wall for a long time on and off trying to implement something that worked for me. While the above would be useful for per project customization I found that I could add customization to a .releaserc.js or such that could contain global customization applied to every project, which works great for me. So I ended up with something like this. .releaserc.js module.exports = {
branches: ['main'],
preset: 'conventionalcommits',
analyzeCommits: {
parserOpts: {
headerPattern: '^Merged PR (\\d+): (\\w*)(?:\\(([\\w$.\\-* ]*)\\))?: (.*)$',
headerCorrespondence: ['pr', 'type', 'scope', 'subject']
},
},
generateNotes: {
linkReferences: true,
linkCompare: false,
parserOpts: {
headerPattern: '^Merged PR (\\d+): (\\w*)(?:\\(([\\w$.\\-* ]*)\\))?: (.*)$',
headerCorrespondence: ['pr', 'type', 'scope', 'subject']
},
writerOpts: {
mainTemplate: readFileSync(join(__dirname, 'templates/template.hbs'), 'utf-8'),
headerPartial: readFileSync(join(__dirname, 'templates/header.hbs'), 'utf-8'),
commitPartial: readFileSync(join(__dirname, 'templates/commit.hbs'), 'utf-8'),
footerPartial: readFileSync(join(__dirname, 'templates/footer.hbs'), 'utf-8'),
}
}
} |
I guess I still don't know what I'm doing :) Those setting in .releaserc.js are messing with the commit filtering. Back to the drawing board. |
Yeah, unfortunately seems like I've got some POC for now that allows passing parserOpts and writerOpts basing on what you've done, next is adding some kind of configuration file. Feel free to test it to see if it works correctly for you! |
Wow, that was quicker than I expected. I really appreciate your effort! The changes work as I would expect them to. However after working with semantic-release there are still some pitfalls I've run into.
I'm going to keep watching this repo though and am happy to help out in any way I can as I still don't have a good solution for this in my situtation. |
I managed coble something together using cosmiconfig with a .nx-releaserc.js style configuration. Should be pretty easy to extends things to read from the project config in angular/nx.json file first and then the config file, and lastly nothing if neither of those are configured. I don't have time to get a PR to you. If you want I could get you something to look at next week. |
I'm curious about this one (comparing tags), could you elaborate further? 😄
Sounds good! I will release what I have so far, because for now I also don't really have much time to dig into this config file stuff. Fell free to open a PR when you will have something, thanks! Since this issue was about parserOpts/writerOpts that I've added, I will close it. |
🎉 This issue has been resolved in version 1.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sure. Take this compare link from the conventional-changelog monorepo. It's using the tags of conventional-commits-parser-v3.2.3 and conventional-commits-parser-v3.2.4 for it's comparison. But when you look at the list of commits you see commits like 5917ad2 which is isolated to another package and not even a package that is a dependency for the commits parser. So it's for this reason I personally don't find much use for the compare link in monorepos. |
Ahh got it, makes sense! |
I'm unfortunately work in an Azure DevOps environment and they have non-github standard naming for PRs and thusly I need to be able to configure the parserOpts. I'd love to see support for this if it's not already possible. I tried including the below in my "options" but with no luck.
Likewise I'd love to be able to configure writerOps as well.
The text was updated successfully, but these errors were encountered: