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

When file has a shebang, it should be kept intact (just like the BOM prefix) #5

Open
GerHobbelt opened this issue Aug 8, 2020 · 1 comment · May be fixed by #6 or hemanth/node-prepend-file#16

Comments

@GerHobbelt
Copy link
Contributor

Example:

#!/usr/bin/env node
require('../');

should become

#!/usr/bin/env node
//
// As per https://medium.com/netscape/a-guide-to-create-a-nodejs-command-line-package-c2166ad0452e
//
require('../');

when appending the text

//
// As per https://medium.com/netscape/a-guide-to-create-a-nodejs-command-line-package-c2166ad0452e
//

Notes

  • I had a look how this can be fixed. That's a spot of bother as there's two ways:
    • either ditch the prepend-file module and redo+augment that functionality
    • or inject this functionality (shebang detection & handling) in the prepend-file module, which feels kinda wrong.
  • PR is forthcoming: I'm taking the second route and forking prepend-file + PR that one.
GerHobbelt added a commit to GerHobbelt/node-prepend-to-js-file that referenced this issue Aug 8, 2020
GerHobbelt added a commit to GerHobbelt/node-prepend-to-js-file that referenced this issue Aug 8, 2020
- clean up *before* rather than *after*: we want to *start* clean, if we leave a bit of stuff for post-test scrutiny that's okay. Anyway, had a couple of nasty surprises by crashing tests and the *after* code not working, anyway.
GerHobbelt added a commit to GerHobbelt/prepend-header that referenced this issue Aug 8, 2020
GerHobbelt added a commit to GerHobbelt/prepend-header that referenced this issue Aug 8, 2020
…stead of prepend-file.

# Conflicts:
#	package.json
@GerHobbelt
Copy link
Contributor Author

BTW: took the second route instead of the first as I consider code duplication far worse than a fork + augment edit.

The fix in the prepend-to-je-file has been tested there:

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