tiktok / rush-plugins

MIT License
17 stars 2 forks source link

[rush-init-project-plugin] rush update generates files with windows newlines (CRLF) on MacOS #8

Closed kostyamm closed 10 months ago

kostyamm commented 10 months ago

Summary

Running the rush update on MacOS causes the command-line.json file in autoinstallers directory to change the line format to Windows lines (CRLF).

Repro steps

  1. Be on MacOS (or presumably *nix would have the same issue)
  2. Run rush update
  3. Look at the generated files. They all use windows newlines:

Expected result: These files should use Unix (LF) style newlines (i.e. \n)

Actual result: These files use Windows (CRLF) style newlines (i.e. \r\n)

Details

Question Answer
@microsoft/rush version 5.90.2
rushVersion 5.90.2
Operating system MacOS 14.1.1
Node.js version 18.18.2
chengcyber commented 10 months ago

Hi kostyamm, I can not reproduce your issue on my side. Could you kindly check is there any .gitattributes file in your repository?

This file is controlling the eol for specific patterns. Related doc: https://git-scm.com/docs/gitattributes#_eol

If everything seems to be good, could you provide a reproduciable repository? We can help to do further investigation based on this repo.

kostyamm commented 10 months ago

Hi, yes, we have a .gitattributes with attribute like this command-line.json eol=lf

kostyamm commented 10 months ago

Solved the problem by removing the command-line.json eol=lf artibute in .gitattributes and also to prevent prettier from changing the file format we added an exception for this file in .prettierignore

If you don't use prettier it is enough to remove the attribute