I am planing to make something similar as lodash custom builds. So in general I want to let user write command like:
npm install -g
Theproperty returns an array containing the command line
arguments passed when the Node.js process was launched. The first
element will be process.execPath. The second element will be the path
any additional command line arguments.
snippet -f -a
[ 'node', 'path/to/file' ]
node bin/index.js -f -a
[ 'node', 'path/to/file', '-f', '-a' ]
It take a time however I have a solution now so hope it help someone later.
Where was a problem:
I noticed that my windows has default program to run
.js file set to
NODE.js and because it's default setting of course all
.js files are opening without parameter.
So in my case every
.js file open with NODE no matter what, I try to changed it to open with something like PSPAD or similar but this basicly open editor instead of execute file.
How did I fix it:
./bin/index.jsbinary file (basicly removed
#!/usr/bin/env nodeon top of
package.jsonand changed all dependency on
Woala! it works :)
p.s. As I mentioned at start I believe there is an option to run this with
.js as well but I wasn't able to find it. So please if anyone will find it let me know.