-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: windows build with ping.js #836
Conversation
There are two issues/PRs regarding ping.js updates. Can either of these be folded into this work to creating a larger update? |
Sorry for the misunderstanding. I added clarification to the original post: The
All that this PR does is to make sure that This PR is not modifying the function of src/ping.js at all, so it does not make sense to combine the above PR and issue into this PR.
|
@AtofStryker |
@MikeMcC399 I can take care of that. @lmiller1990 can you take a look here as well? |
🚀 |
🎉 This PR is included in version 5.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR fixes an issue building and committing the action on Microsoft Windows.
Issue
On Windows, compiling the source code using vercel/ncc would cause Windows-style
CRLF
end-of-line characters to be embedded in dist/index.js, but only for the portion of code coming from src/ping.js. Other parts of the file dist/index.js were using unix-styleLF
as end-of-line character.Carrying out the same action on a unix system such as Ubuntu results in only
LF
characters being used.This would lead to unnecessary
git
differences if the action were changed and committed to GitHub from unix and Windows in turn.Resolution
The
run format
command is changed from:"format": "prettier --write index.js"
to"format": "prettier --write index.js src/ping.js"
prettier is now used additionally on src/ping.js to pre-process this source file and convert the end-of-line character consistently to
LF
before it is fed toncc build
for compilation.The Prettier: End of Line option is set to
lf
by default inv2.0.0
and is not overridden in .prettierrc.json. The action currently uses v2.8.4 of Prettier, so this default applies already.This PR is a prerequisite for re-enabling a husky pre-commit hook (see also #743) so that it can work consistently across operating systems (unix / Windows).
Verification
Ubuntu
On Ubuntu 22.04, execute:
confirm the message:
"nothing to commit, working tree clean"
Microsoft Windows
Move to Microsoft Windows (11 Pro) and execute
Confirm that the default value of
true
is set (see Git Configuration). If not, then executegit config --global core.autocrlf true
Now execute:
npm ci npm run format npm run build git add . git status
confirm the message:
"nothing to commit, working tree clean"