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

Bad line ending breaks barrelsby usage when running on Linux. #34

Closed
nozzlegear opened this issue Aug 28, 2017 · 4 comments
Closed

Bad line ending breaks barrelsby usage when running on Linux. #34

nozzlegear opened this issue Aug 28, 2017 · 4 comments
Assignees

Comments

@nozzlegear
Copy link
Contributor

Hey, I've been having this problem for a while. barrelsby will break any build process that uses it on Linux due to bad line endings on #! /usr/bin/env node in barrelsby/bin/index.js:

image

I can get around this by installing the dos2unix on my Linux distro, which takes a file and converts its line endings to a unix format. After installing that I can run dos2unix node_modules/barrelsby/bin/index.js before running barrelsby, which fixes the problem but it'd be better if it was fixed in the package itself.

@bencoveney bencoveney mentioned this issue Aug 28, 2017
@ghost ghost assigned bencoveney Aug 28, 2017
@ghost ghost added the in progress label Aug 28, 2017
@bencoveney
Copy link
Owner

bencoveney commented Aug 28, 2017

Hi @nozzlegear thanks for the bug report.

I think I've got a fix (npm test now creates UNIX style line endings in the /bin directory).

I am trying to confirm whether this change will be passed through NPM (npm install git+https://git@github.com/bencoveney/barrelsby.git#f34b374df438d08e368b00cbcc69b4d827201f79) however installing the specified commit still gives me CRLF in index.ts locally and I can't quite work out whether this is happening because of Windows, Git, NPM etc.

Possibly I might publish a beta version and see if that resolves the problem on your linux machine.

@bencoveney
Copy link
Owner

I have published a beta version (0.0.5) which seems to be giving LF endings for me now but will wait to get confirmation from you that it is working before I merge and close and publish for real.

As an aside, I notice that you have the --delete flag set on all barrelsby scripts. I had opted not to include it by default (as it is destructive and could delete files) but your usage is convincing me its a more useful default.

Do you think the --delete option would be worth setting by default? Another option might be to identify barrelsby barrels with a comment so that it is safer to work out which files should be deleted.

@nozzlegear
Copy link
Contributor Author

Looks like it's working now in 0.0.5! I was able to install and run with no problems on Ubuntu.

Regarding the --delete option, at least for me it would be great for it to be default or have it figure out which files were generated by barrelsby and safely delete/overwrite those. In my case I never modify barrel files by hand and just have barrelsby export an entire folder for me, so it's sort of confusing for it to run but not update a barrel when I forget the --delete flag.

@bencoveney
Copy link
Owner

A bit late but this is available now in a non-beta version (0.0.8)

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