Open Jamesernator opened 7 years ago
Ah yep, that makes sense.
What about supporting a special comment at the start of JS source files, e.g.
//!/usr/bin/env babel-node
That would help portability, but commandMap would be nicer so that I can just run all my js files with babel-node
without having to add a shebang line to every file.
Okay yeah I understand. Are you able to submit a PR, it would be welcome. Probably just something that merges a user supplied config with the default one.
I did it a bit brutally (because I don't know atom very well yet) in #90,
my config.cson is:
"*":
# ...
runner:
extCommands:
".js": "babel-node --presets /home/caub/.npm-global/lib/node_modules/@babel/preset-env"
".spec.js": "jest"
which allows me to run babel-node
Something that would be helpful to me is the ability to override the values in commandMap in script-runner.coffee with custom interpreters.
In my case I would like to be able override
scope: '^source\\.js', command: 'node'
withscope: '^source\\.js', command: 'babel-node'
. It's particularly helpful to avoid adding shebang lines everywhere especially given that shebangs aren't part of JavaScript's grammar which means I can't just take my file and use it in the browser.