microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.85k stars 594 forks source link

[rush] Publish fails due to publish having uncommited changes in package.json #1795

Open acoates-ms opened 4 years ago

acoates-ms commented 4 years ago

Is this a feature or a bug?

Please describe the actual behavior.

rush publish fails to complete due to uncommitted changes in package.json. I suspect there is some reordering of fields or something going on. I tried it manually and saw a sorting of the dependencies uncommitted and indention changed to tabs, which then prevents rush publish from switching to the master branch to preform the final merge.

I suspect this is the same issue that was hit in #1543 .

If the issue is a bug, how can we reproduce it? Please provide detailed steps and include a GitHub branch if applicable. Your issue will get resolved faster if you can make it easy to investigate.

I can provide an internal Microsoft repo, but do not an external repo right now.

What is the expected behavior?

Publish would succeed. If rush has an opinion on the format of package.json, it should just commit the change.

If this is a bug, please provide the tool version, Node.js version, and OS.

Rush: 5.20.0 Node: 10.19.0 OS: Windows

acoates-ms commented 4 years ago

So I worked out at least the last part of my issue. My .gitattributes had:

*.json            text eol=crlf

This was causing rush publish to end up with uncommited changes in package.json related to the line endings. I was able to fix this by changing json files to use LF in our repo. Still seems like there are issues here with rush publish.

octogonz commented 4 years ago

Would this be fixed by https://github.com/microsoft/rushstack/issues/1467 which proposes to convert all our files to LF by default?

acoates-ms commented 4 years ago

The latest version of this we hit appears to be around having empty dependency or devDependency properties in package.json.

For internal microsoft people: @iclanton This build hit the issue. I had previously added some logic to spit out the diff when we hit this publish failure, so you can see in the build task after the rush publish task, the diff shows that rush has deleted the empty dependency properties in package.json locally, and that diff prevents the rush publish step from being able to complete. https://office.visualstudio.com/ISS/_build/results?buildId=4456456&view=logs&j=f1d58520-662f-5039-53bc-a27c18ef098d