Add changesetBaseRef configuration option for versioning (#1195)#1201
Conversation
* Add changesetBaseRef, allowing for comparing files against non-master refs * Update yarnrc documentation accordingly
| export async function fetchBase(root: PortablePath) { | ||
| const candidateBases = [`master`, `origin/master`, `upstream/master`]; | ||
| export async function fetchBase(root: PortablePath, {baseRef}: {baseRef?: string | null}) { | ||
| const candidateBases = baseRef !== null ? [baseRef] : [`master`, `origin/master`, `upstream/master`]; |
There was a problem hiding this comment.
I'm thinking, what do you think about making it an array of refs instead, that would default to ['master', 'origin/master', 'upstream/master'] (what it currently is)? This way people who want to use a custom branch would be able to keep the behaviour that tries to take the origin into account if possible.
There was a problem hiding this comment.
I wanted to do that, but did not know how to use an array type. I see now I just need to add isArray: true. I will add this
There was a problem hiding this comment.
Hey Maël, I have updated the code and documentation accordingly. I've tested it and it works well. The only limitation is that using the environment variable will only allow a single ref to be set, not a huge deal imo. That could also be user error, I didn't take the time to see if there was a syntax to pass an array.
* renamed changesetBaseRef to changesetBaseRefs * updated its type to array, set master, origin/master, upstream/master as default * remove hardcoded candidates, enforce non-nullable configuration * update docs accordingly
* Add a usageError for when the changesetBaseRefs is explicitly set to the empty array * ref -> refs in documentation
|
Thanks! |
What's the problem this PR addresses?
This PR implements issue #1195
How did you fix it?
Add changesetBaseRef, allowing for comparing files against non-master refs
Update yarnrc documentation accordingly