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

ember g route my-route always turns the router.js file into crlf mode #130

Open
keanedawg opened this issue Jan 17, 2020 · 2 comments
Open

Comments

@keanedawg
Copy link

Output from ember version --verbose && npm --version && yarn --version:

ember-cli: 3.13.2
http_parser: 2.8.0
node: 8.11.3
v8: 6.2.414.54
uv: 1.19.1
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
nghttp2: 1.32.0
napi: 3
openssl: 1.0.2o
icu: 60.1
unicode: 10.0
cldr: 32.0
tz: 2017c
os: win32 x64
6.5.0
bash: yarn: command not found

I am able to recreate the bug from the following:

0.) open Git Bash

1.) Ember new testbug

2.) cd testbug/app

3.) check the newline character type (should all be set to UNIX)

find . -not \( -path './.git' -prune \) -type f -print0 | xargs -0 dos2unix -ih


     DOS    UNIX     MAC     BOM  TXTBIN       FILE
       0      14       0  no_bom    text    ./app.js
       0       0       0  no_bom    text    ./components/.gitkeep
       0       0       0  no_bom    text    ./controllers/.gitkeep
       0       0       0  no_bom    text    ./helpers/.gitkeep
       0      25       0  no_bom    text    ./index.html
       0       0       0  no_bom    text    ./models/.gitkeep
       0       3       0  no_bom    text    ./resolver.js
       0      12       0  no_bom    text    ./router.js
       0       0       0  no_bom    text    ./routes/.gitkeep
       0       0       0  no_bom    text    ./styles/app.css
       0       4       0  no_bom    text    ./templates/application.hbs
       0       0       0  no_bom    text    ./templates/components/.gitkeep

4.) ember g route test-route

5.) find . -not \( -path './.git' -prune \) -type f -print0 | xargs -0 dos2unix -ih


     DOS    UNIX     MAC     BOM  TXTBIN       FILE
       0      14       0  no_bom    text    ./app.js
       0       0       0  no_bom    text    ./components/.gitkeep
       0       0       0  no_bom    text    ./controllers/.gitkeep
       0       0       0  no_bom    text    ./helpers/.gitkeep
       0      25       0  no_bom    text    ./index.html
       0       0       0  no_bom    text    ./models/.gitkeep
       0       3       0  no_bom    text    ./resolver.js
      13       0       0  no_bom    text    ./router.js
       0       0       0  no_bom    text    ./routes/.gitkeep
       0       4       0  no_bom    text    ./routes/test-route.js
       0       0       0  no_bom    text    ./styles/app.css
       0       4       0  no_bom    text    ./templates/application.hbs
       0       0       0  no_bom    text    ./templates/components/.gitkeep
       0       0       0  no_bom    text    ./templates/test-route.hbs

The router.js file has mysteriously converted into CRLF format.

@keanedawg
Copy link
Author

I have also noticed this same thing occurs when performing ember d route my-route

Copy link
Member

rwjblue commented Feb 11, 2020

ember-cli does not control the generation (or insertion) of this file. The route blueprint in ember-source (here calls in to ember-router-generator to get the updated code to write (see here). I think maybe we need to add another option to recast.print for it to autodetect the right line endings to use? Not sure exactly what needs to be done to fix that but I think the issue should be moved over into ember-router-generator's repo.

@rwjblue rwjblue transferred this issue from ember-cli/ember-cli Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants