ioquatix / script-runner

This package will run various script files inside of Atom. It currently supports JavaScript, CoffeeScript, Ruby, and Python. You can add more.
http://atom.io/packages/script-runner
Other
62 stars 23 forks source link

Add custom commandMap #68

Open Jamesernator opened 7 years ago

Jamesernator commented 7 years ago

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' with scope: '^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.

ioquatix commented 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
Jamesernator commented 7 years ago

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.

ioquatix commented 7 years ago

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.

caub commented 6 years ago

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