-
Notifications
You must be signed in to change notification settings - Fork 157
Fix shebang and header ordering #1032
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
Conversation
(One possible reason to object: shebangs ought to refer to a file's actual contents, not the contents of a derived file. |
For files intended to run with
But for files intended to be compiled with
just like in example from #1030. Flipping lines can stay, but I would rather test the compiled code for starting from |
@nazar-pc, what do you think about that? If ``#!/usr/bin/env node``
console.log 'Hello' compiled by default to #!/usr/bin/env node
// Generated by LiveScript 1.5.0
(function(){
console.log('Hello');
}).call(this); would that look good to you? |
Having both support for running original script with LiveScript and compiled with Node directly seems highly unlikely, but still possible. So if I understand correctly #!/usr/bin/env lsc
``#!/usr/bin/env node``
console.log 'Hello' would be still compiled by default to #!/usr/bin/env node
// Generated by LiveScript 1.5.0
(function(){
console.log('Hello');
}).call(this); and work properly all the time. I'm fine with that, makes perfect sense. |
f6f9c34
to
9de5704
Compare
Earlier support for shebang lines in the compiled output moved them before the default function wrapper, but not before the default LiveScript header comment. This moves shebangs above the header comment as well.
9de5704
to
ceec281
Compare
Found minor issue with this: /**
* Whatever
*/ is compiled to /**
* Whatever
*/
// Generated by LiveScript 1.5.0 instead of previous // Generated by LiveScript 1.5.0
/**
* Whatever
*/ GitHub seems to use this header for identifying whether Would you be so kind to fix this and add one more test case? |
I'll look into it, thanks! |
Earlier support for shebang lines in the compiled output moved them before the default function wrapper, but not before the default LiveScript header comment. This moves shebangs above the header comment as well.
Fixes #1030.
#1030 seems like a reasonable request to me, but I might be missing some reason not to do this—speak up here if you can think of any. (There's some prior discussion at #497, which mostly just rejects new explicit compiler options in favor of the existing workarounds, but nobody proposed what #1030 proposes.) I'll hold this PR for two weeks, merging on or after April 10 if there are no objections.
Edit: It looks like #1030 as written isn't a good idea, so this PR now targets this comment.