Description
I would like to purpose that this is a bug because it causes needless trouble in cross platform environments and I cannot find a single reason for why we insist on having CR
LF
on Windows any more.
Expected behavior:
Linux/OS X users don't run into subtle issues because of carriage return in bin scripts.
Actual behavior:
When a TypeScript project is built on Windows and then published to NPM, the default new line options is CR
LF
. If your package.json
has a bin
script with a shebang like this #!/usr/bin/env node
TypeScript will rewrite this with a CR
LF
line ending which breaks on at least Mac OS X with the following error env: node\r: No such file or directory error Command failed with exit code 127
(haven't tested this elsewhere).
I'm raising this as a bug because it has non obvious implications for people developing software with TypeScript if they publish their code to NPM. And I don't think that there is a valid reason for why CR
LF
should be used on Windows at all. It's an archaic historical artifact that should have been laid to rest a very long time ago.
I'm going to be bold and suggest that the option --newLine
should never have been added. That it should be deprecated and that the option should be ignored. And that TypeScript only emit LF
from now on.