Pronounced "gimmicks".
This tool is similar to the official NPM tool "npx", but "gmx" attempts to do less, but do less better.
If local executables exist in ./node_modules/.bin
, gmx will use those first.
For example, if you have a local and global version of nodemon, gmx -- nodemon
, will use the local version
if you are within the project, otherwise if your cwd is outside the project, will use the global version of nodemon.
Just depends on your cwd.
npm install -g gmx
$ gmx echo 'foobar'
You may want to run a local version of typescript/tsc or nodemon, so you would do:
$ gmx -- tsc -w
or:
$ gmx -- nodemon
$ gmx --exec='tsc -w'
or for short:
$ gmx -e 'tsc -w'
Bash does a fine job of running things in series, so we don't need to help bash with that,
but if you want to run commands in parallel, use gmx:
$ gmx -e 'echo "foo"' -e 'exit 3' -e 'echo "baz"'
the above will exit with code 1, as evidence by the output from:
$ gmx -e 'echo "foo"' -e 'exit 3' -e 'echo "baz"'; echo $?
if we run the above, we get:
foo
baz
1
to exit the gmx
process with 0 if any subcommand exits with 0, use the --any
option:
$ gmx --any -e 'echo "foo"' -e 'exit 3' -e 'echo "baz"'; echo $?
now we get:
foo
baz
0