rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[rush-lib] adds `shouldPublishTakesPrecedence` flag to rush.json to indicate that it should ignore `versionPolicyName` when publishing

Open alber70g opened this issue 2 years ago • 5 comments
trafficstars

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.

alber70g avatar May 18 '23 12:05 alber70g

@microsoft-github-policy-service agree

alber70g avatar May 18 '23 12:05 alber70g

CC @elliot-nelson FYI

octogonz avatar Jun 01 '23 00:06 octogonz

@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?

elliot-nelson avatar Jul 06 '23 17:07 elliot-nelson

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.)

elliot-nelson avatar Jul 25 '23 17:07 elliot-nelson

Sounds good to me - thanks Elliot!

octogonz avatar Jul 26 '23 17:07 octogonz