shelljs
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
ShellJS is a robust solution for bringing Unix shell commands to Node.js, with multi-platform support for Windows, Linux, and OS X. It aids in replacing shell scripts with JavaScript, serving as a portable shell scripting library. This library has wide usage in various popular projects like Firebug, JSHint, ESLint, and Yeoman. Not only it streamlines shell operations into a consistent API, but is also an effective tool to eliminate the dependency on Unix commands and write OS-agnostic code.
To utilize ShellJS, you must first install it via npm with the following command:
$ npm install [-g] shelljs
Once installed, you can use ShellJS in your Node.js projects by requiring the ShellJS module:
var shell = require('shelljs');
Now you can use shell commands as JavaScript functions. For instance:
if (!shell.which('git')) {
shell.echo('Sorry, this script requires git');
shell.exit(1);
}
ShellJS commands can be used individually or chained together, allowing comprehensive bash-like scripting in JavaScript. Also note that you should refrain from using a global import for ShellJS i.e., require('shelljs/global')
because it pollutes the global namespace.
The documents for ShellJs can be found on the same GitHub repository, located in the README file. You can access all the comprehensive documentation features related to ShellJs at https://github.com/shelljs/shelljs. You may also refer to https://www.npmjs.com/package/shelljs and http://documentup.com/shelljs/shelljs for its latest release and updates. For more profound details, you can visit the Wiki page linked within the GitHub repository.