Execute package the node way


#1

Hey everybody!

I want to fix a bug of my atom-minify package. But I have the following problem with that:

I use the node-minify package which has the following internal code – I modified it, so you understand what’s the problem about:

var exec = require('child_process').exec;
command = '"C:/Users/username/AppData/Local/atom/app-1.0.0/atom.exe" "uglify-js/bin/uglifyjs" --output "/path/to/min.js" "/path/to/js"';
exec(command /* ... */ )

Normally, node-minify works with node and so, the command would look like this:

command = '"/path/to/node.exe" "uglify-js/bin/uglifyjs" --output "/path/to/min.js" 

Is there a way to let atom exeute uglify-js the way node does? I hope you understand what I mean?!


#2

I can’t answer that question, although I do know that Atom doesn’t just wrap node so you can’t just execute it the same way and get node functionality.
Someone else may have a quick solution for you.

But does it have to be run as a command line call, is there no way to do it from within the application?


#3

Well, there are two possibilites:

  1. I wrap node-minify, but as you mentioned already, it’s a lil crappy…
  2. My package does not depend on node-minify and I write everything on my on, means that my package only depends on the used minifiers.

I think the future solution will be number 2, but it’s a lil work until I finish that.

The idea of this thread was looking for a quick fix for my problem. But Google did not tell me a nice solution, so I did not expect one :wink: