rushstack
rushstack copied to clipboard
[rush-lib] adds `shouldPublishTakesPrecedence` flag to rush.json to indicate that it should ignore `versionPolicyName` when publishing
Summary
Fixes #958 in a different way
Introduces the shouldPublishTakesPrecedence flag to the root of the config.
This allows users to ignore the versionPolicyName when publishing packages.
Details
This issue adds the flag as mentioned above. This gives full control to the end user
and allows the limited usage of versionPolicyName. And is a non-breaking change
Alternative 1: add a flag to the schema that disallows the use of them both (see also #719) but that is a breaking change
Alternative 2: add a warning when they're both set, this doesn't prevent accidental publishing.
Alternative 3: create a lint rule and check in the build. This is very cumbersome.
How it was tested
Not tested. If anyone can point me to a test where config properties like shouldPublish and versionPolicyName are tested, I'm happy to add a test.
Impacted documentation
rush-init/rush.json is updated accordingly.
@microsoft-github-policy-service agree
CC @elliot-nelson FYI
@alber70g Thanks so much for putting up this PR, and for putting up with the extreme delay!
I'm looking at your change and if I understand correctly, you want to be able to set versionPolicyName on a project, but not have it included in the list of published packages. Maybe to put it another way: you want it to be an iron-clad rule that if shouldPublish: true is not set on a package, it doesn't get published, even if the versionPolicyName property is set.
I personally like this change, because it fits well into planned changes for Versioning 2.0, but I do want to ask: why even set the versionPolicyName property at all then? Is this a situation where sometimes you temporarily turn shouldPublish on and off, and don't want to also have to delete the versionPolicyName property at the same time?
One more update (for @octogonz) - I am waiting for PR author to confirm, but, in my opinion, I think it's time to just make this change permanent. I think versionPolicyName should not automatically enable shouldPublish, and we don't need a special flag in rush.json for that.
(The only caveat is how to roll that change out to people... not sure if there's a way to make it clear during the upgrade process that they should be going and adding this flag to their projects.)
Sounds good to me - thanks Elliot!