Repository navigation
fix(cli): improve handling of Windows CRLF line endings - #25
Merged
Merged
Conversation
On Windows, lines usually end with `\r\n`/CRLF/␍␊. Although YAML supports this as a line-break, our regex was incorrectly breaking this up, which was causing the `\r` character to be appending into some strings, instead of `\r\n`.
On Windows, files are normally checked-out with `git config core.autocrlf true`, which will replace `'\n'`/LF chars with `'\r\n'`/CRLF chars. We should handle this in our unit tests, otherwise tests will fail on Windows CI.
Updates the newly created `packages/cli/CHANGELOG.md` file.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
jgreywolf
approved these changes
Apr 23, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a regex that was incorrectly breaking up
'\r\n'/CRLF/␍␊ line-breaks (commonly used in Windows OSes) to just plain'\r'. And it seems like the YAML library we're using: https://www.npmjs.com/package/yaml seems to not register just\ras a line-break (although the YAML Spec v1.2.2 § 5.4 Line Break Characters does seem to say that either\r,'\n'or'\r\n'can be used as a line break).On Windows, files are normally checked-out with
git config core.autocrlf true, which will replace'\n'/LF/␊ chars with'\r\n'/CRLF/␍␊ chars. We should also handle this in our unit tests, otherwise tests will fail on Windows.