Skip to content

tornqvist/shx

 
 

Repository files navigation

Shx

Travis AppVeyor

shx is a wrapper around ShellJS Unix commands, providing an easy solution for simple Unix-like, cross-platform commands in npm package scripts.

Example

The following code can be run either a Unix or Windows command line:

$ shx pwd                       # ShellJS commands are supported automatically
/home/username/path/to/dir

$ shx ls                        # files are outputted one per line
file.txt
file2.txt

$ shx rm *.txt                  # a cross-platform way to delete files!

$ shx ls

$ shx echo "Hi there!"
Hi there!

$ shx touch helloworld.txt

$ shx cp helloworld.txt foobar.txt

$ shx mkdir sub

$ shx ls
foobar.txt
helloworld.txt
sub

$ shx rm -r sub                 # options work as well

All commands internally call the ShellJS corresponding function, guaranteeing cross-platform compatibility.

Advantages over ShellJS

ShellJS is good for writing long scripts. If you want to write bash-like, platform-independent scripts, we recommend you go with that.

However, shx is ideal for one-liners inside package.json:

{
  "scripts": {
    "clean": "shx rm -rf build dist && shx echo Done"
  }
}

Team

Nate Fischer Ari Porad Levi Thomason
Nate Fischer Ari Porad Levi Thomason

About

Portable Shell Commands for Node

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%