guiguan / file-header

FileHeader for Atom
https://atom.io/packages/file-header
Other
31 stars 21 forks source link

Shebang line handling #62

Open xenialaq opened 5 years ago

xenialaq commented 5 years ago

For a Node.js script (plus else) beginning with a shebang, with Enable Auto Adding Header on Saving turned on, file-header inserts comments before that line. For example:

#!/usr/bin/env node

// Code

becomes

/**
 * @Author: John Doe
 * @Date:   2000-01-01T00:00:00-05:00
 * @Last modified by:   jd
 * @Last modified time: 2000-01-01T00:00:00-05:00
 */

#!/usr/bin/env node

// Code

upon saving, and throws

#!/usr/bin/env node
^

SyntaxError: Invalid or unexpected token
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3
npm ERR! code ELIFECYCLE

when started. Is it possible to handle #! in a different way?