Skip to content
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(cli): win EOL conversion for gen templates #2540

Merged
merged 4 commits into from
Nov 3, 2023
Merged

Conversation

frankcalise
Copy link
Contributor

Please verify the following:

  • Generators.md has been updated with changes

Describe your PR

  • Closes Ignite generators don't work on Windows #2253
  • This attempts to autocorrect an EOL issue with the generator template files by doing the following:
    • Checks to see if running on Windows
    • Looks for the unix2dos cli utility
    • If found, applies this to each of the template files found from the boilerplate
    • If not found or application fails, will output a warning at the end of terminal output to check the EOL in templates
    • Added extra debug logging
  • Updated documentation to make note about this issue with Windows

Testing

This was manually tested by doing the following:

  1. Clone ignite-cli project on a Windows machine
  2. Convert boilerplate\ignite\templates\**\*.ts*.ejs files EOL to LF on purpose (likely CRLF after cloning)
  3. Generate a new Pizza App locally, ie:
    node bin/ignite new PizzaWin --overwrite --debug --install-deps=false --targetPath="C:\temp\PizzaWin" --git --bundle=com.pizzawin --remove-demo=false --packager=yarn
  4. Observe that the files in the project path's ignite\templates has the template files with the CRLF EOL

Screenshots

Terminal Warning Upon Failure

image

Extra Debug Logging

image

@morganick
Copy link
Contributor

I'm surprised that git doesn't automatically handle this with: https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings

Copy link
Contributor

@joshuayoes joshuayoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this solution. I have two small changes requested but conceptually this looks great.

src/commands/new.ts Outdated Show resolved Hide resolved
src/commands/new.ts Show resolved Hide resolved
src/commands/new.ts Outdated Show resolved Hide resolved
@joshuayoes
Copy link
Contributor

I'm surprised that git doesn't automatically handle this with: https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings

This is probably because we aren't using git to copy these files over, we are essentially using copy and paste on the system.

Co-authored-by: Joshua Yoes <[email protected]>
Copy link
Contributor

@joshuayoes joshuayoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frankcalise frankcalise merged commit ebdc55a into master Nov 3, 2023
@frankcalise frankcalise deleted the fix/windows-gen branch November 3, 2023 00:58
infinitered-circleci pushed a commit that referenced this pull request Nov 3, 2023
## [8.10.1](v8.10.0...v8.10.1) (2023-11-03)

### Bug Fixes

* **cli:** win EOL conversion for gen templates ([#2540](#2540) by [@frankcalise](https://github.com/frankcalise)) ([ebdc55a](ebdc55a))
@infinitered-circleci
Copy link

🎉 This PR is included in version 8.10.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ignite generators don't work on Windows
4 participants