{"name":"shx","version":"0.2.0","keywords":["shelljs","shell","unix","bash","sh","exec","cli","zsh"],"license":"MIT","_id":"shx@0.2.0","maintainers":[{"name":"ariporad","email":"ari@ariporad.com"},{"name":"levithomason","email":"me@levithomason.com"},{"name":"nfischer","email":"ntfschr@gmail.com"}],"contributors":[{"url":"http://ariporad.com/","name":"Ari Porad","email":"ari@ariporad.com"},{"url":"https://github.com/levithomason","name":"Levi Thomason","email":"me@levithomason.com"},{"name":"Nate Fischer","email":"ntfschr@gmail.com"}],"homepage":"https://github.com/shelljs/shx#readme","bugs":{"url":"https://github.com/shelljs/shx/issues"},"bin":{"shx":"lib/cli.js"},"dist":{"shasum":"43fd7c4b9abb011ca3607971e5bb5a9e1369b5e5","tarball":"http://registry-npm.ywwl.com/shx/download/shx-0.2.0.tgz","integrity":"sha512-ju8mf/zhtmGI6AElUclRdS8RdKAHDoLaX1FkoL7w3F6tZFJZGTOpORtZa/kuMJZVPxjITRV7ElvD8zqRhn5P/g==","signatures":[{"sig":"MEYCIQCjdokD748Sb9jYw6Vwh2z7ZcltB5TtD4aEMNgCZu/ZwwIhAPDLGvMyDsErYvcmixZNiBvC7DBeTilTCzkzUI+wNHr8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":6891,"noattachment":false,"key":"/shx/-/shx-0.2.0.tgz"},"_from":".","files":["lib"],"_shasum":"43fd7c4b9abb011ca3607971e5bb5a9e1369b5e5","gitHead":"92c16d765afcff0660fcb8aae4efe3cc58d150d1","scripts":{"dev":"concurrently -rk 'npm run build:watch' 'npm run lint:watch'","lint":"eslint .","test":"nyc --reporter=text --reporter=lcov mocha","build":"babel src -d lib","codecov":"codecov","lint:fix":"npm run lint --silent -- --fix","posttest":"npm run lint --silent","prebuild":"rimraf lib","changelog":"shelljs-changelog","lint:watch":"watch 'npm run lint --silent' src test","prepublish":"npm run build","test:watch":"concurrently -rk 'npm run test --silent -- -w' 'npm run lint:watch'","build:watch":"npm run build -- -w","release:major":"shelljs-release major","release:minor":"shelljs-release minor","release:patch":"shelljs-release patch"},"_npmUser":{"name":"nfischer","email":"ntfschr@gmail.com"},"deprecated":"critical bug fixed in v0.2.1","repository":{"url":"git+https://github.com/shelljs/shx.git","type":"git"},"_npmVersion":"3.10.8","description":"Portable Shell Commands for Node","directories":{},"_nodeVersion":"6.7.0","dependencies":{"shelljs":"^0.7.3","minimist":"^1.2.0","es6-object-assign":"^1.0.3"},"devDependencies":{"nyc":"^6.4.0","mocha":"^2.4.5","watch":"^0.18.0","eslint":"^2.10.1","rimraf":"^2.5.2","should":"^11.1.1","codecov":"^1.0.1","babel-cli":"^6.6.5","concurrently":"^2.1.0","babel-register":"^6.7.2","shelljs-release":"^0.2.0","shelljs-changelog":"^0.2.0","babel-preset-es2015":"^6.6.0","shelljs-plugin-open":"^0.1.1","eslint-plugin-import":"^1.8.0","eslint-config-airbnb-base":"^3.0.1"},"_npmOperationalInternal":{"tmp":"tmp/shx-0.2.0.tgz_1478589819985_0.4677979866974056","host":"packages-18-east.internal.npmjs.com"},"readme":"# Shx\n\n[![GitHub Actions](https://img.shields.io/github/actions/workflow/status/shelljs/shx/main.yml?style=flat-square&logo=github)](https://github.com/shelljs/shx/actions/workflows/main.yml)\n[![Codecov](https://img.shields.io/codecov/c/github/shelljs/shx/main.svg?style=flat-square&label=coverage)](https://codecov.io/gh/shelljs/shx)\n[![npm version](https://img.shields.io/npm/v/shx.svg?style=flat-square)](https://www.npmjs.com/package/shx)\n[![npm downloads](https://img.shields.io/npm/dm/shx.svg?style=flat-square)](https://www.npmjs.com/package/shx)\n\n`shx` is a wrapper around [ShellJS](https://github.com/shelljs/shelljs) Unix\ncommands, providing an easy solution for simple Unix-like, cross-platform\ncommands in npm package scripts.\n\n`shx` is proudly tested on every LTS node release since <!-- start minVersion -->`v18`<!-- stop minVersion -->!\n\n## Difference Between ShellJS and shx\n\n- **ShellJS:** Good for writing long scripts, all in JS, running via NodeJS (e.g. `node myScript.js`).\n- **shx:** Good for writing one-off commands in npm package scripts (e.g. `\"clean\": \"shx rm -rf out/\"`).\n\n## Install\n\n```shell\nnpm install shx --save-dev\n```\nThis will allow using `shx` in your `package.json` scripts.\n\n## Usage\n\n### Command Line\n\nIf you'd like to use `shx` on the command line, install it globally with the `-g` flag.\nThe following code can be run *either a Unix or Windows* command line:\n\n```Bash\n$ shx pwd                       # ShellJS commands are supported automatically\n/home/username/path/to/dir\n\n$ shx ls                        # files are outputted one per line\nfile.txt\nfile2.txt\n\n$ shx rm *.txt                  # a cross-platform way to delete files!\n\n$ shx ls\n\n$ shx echo \"Hi there!\"\nHi there!\n\n$ shx touch helloworld.txt\n\n$ shx cp helloworld.txt foobar.txt\n\n$ shx mkdir sub\n\n$ shx ls\nfoobar.txt\nhelloworld.txt\nsub\n\n$ shx rm -r sub                 # options work as well\n\n$ shx --silent ls fakeFileName  # silence error output\n\n$ shx --negate test -d dir      # Negate status code output (e.g., failed commands will now have status 0)\n```\n\nAll commands internally call the ShellJS corresponding function, guaranteeing\ncross-platform compatibility.\n\n### package.json\n\nShellJS is good for writing long scripts. If you want to write bash-like,\nplatform-independent scripts, we recommend you go with that.\n\nHowever, `shx` is ideal for one-liners inside `package.json`:\n\n```json\n{\n  \"scripts\": {\n    \"clean\": \"shx rm -rf \\\"build/**/*.js\\\" \\\"build/output\\\" && shx echo \\\"Done cleaning\\\"\"\n  }\n}\n```\n\nIt's safe to use `&&` and `||` operators in npm package scripts. These will be\ninterpreted by the operating system's shell (`sh` on Unix, `cmd.exe` on\nWindows). If you're using glob operators like `*` or `**`, then we recommend to\n**put these in double quotes**, which ensures that `shx` will expand the glob\nrather than the operating system shell.\n\n> [!IMPORTANT]\n> Windows treats single quotes (ex. `'some string'`) differently than double\n> quotes.\n> [We recommend](https://github.com/shelljs/shx/issues/165#issuecomment-563127983)\n> wrapping your arguments in **escaped double quotes** so that your code is\n> compatible cross platform (ex. `\"clean\": \"shx echo \\\"some string\\\"\"`).\n\n## Command reference\n\nShx exposes [most ShellJS\ncommands](https://github.com/shelljs/shelljs#command-reference). If a command is\nnot listed here, assume it's supported!\n\n### sed\n\nShx provides unix-like syntax on top of `shell.sed()`. So ShellJS code like:\n\n```js\nshell.sed('-i', /original string/g, 'replacement', 'filename.txt');\n```\n\nwould turn into the following Shx command:\n\n```sh\nshx sed -i \"s/original string/replacement/g\" filename.txt\n```\n\n**Note:** like unix `sed`, `shx sed` treats `/` as a special character, and\n[this must be\nescaped](https://github.com/shelljs/shx/issues/169#issuecomment-563013849) (as\n`\\/` in the shell, or `\\\\/` in `package.json`) if you intend to use this\ncharacter in either the regex or replacement string. Do **not** escape `/`\ncharacters in the file path.\n\n### Unsupported Commands\n\nAs mentioned above, most ShellJS commands are supported in `shx`. Due to the\ndifferences in execution environments between ShellJS and `shx` (JS vs CLI) the\nfollowing commands are not supported:\n\n| Unsupported command | Recommend workaround |\n| ------------------- | -------------------- |\n| `shx cd`            | Just use plain old `cd` (it's the same on windows too) |\n| `shx pushd`         | Just use plain old `pushd`. Use forward slashes and double-quote the path. (e.g. `pushd \"../docs\"`. This would fail on Windows without the quotes) |\n| `shx popd`          | Just use plain old `popd` |\n| `shx dirs`          | No workaround |\n| `shx set`           | See below |\n| `shx exit`          | Just use plain old `exit` |\n| `shx exec`          | Instead of `shx exec cmd`, just use plain old `cmd` |\n| `shx ShellString`   | No workaround (but why would you want this?) |\n\n### Shx options\n\nShx allows you to modify its behavior by passing arguments. Here's a list of\nsupported options:\n\n| [`set`](https://github.com/shelljs/shelljs#setoptions) flag | [`shell.config`](https://github.com/shelljs/shelljs#configuration) setting | shx command | Effect |\n|:---:| --- | --- | --- |\n| `-e` | `config.fatal = true` | Not supported | Exit upon first error. |\n| `-v` | `config.verbose = true` | `shx --verbose cd foo` | Log the command as it's run. |\n| `-f` | `config.noglob = true` | `shx --noglob cat '*.txt'` | Don't expand wildcards. |\n| N/A | `config.silent = true` | `shx --silent cd noexist` | Don't show error output. |\n| N/A | N/A | `shx --negate test -d dir` | Runs the specified command but negates the exit status. Failed command = status 0, successful command = status 1. |\n| N/A | N/A | `shx --help` | Show help text. |\n| N/A | N/A | `shx --version` | Print the shx version. |\n\n## Team\n\n| [![Nate Fischer](https://avatars.githubusercontent.com/u/5801521?s=130)](https://github.com/nfischer) | [![Ari Porad](https://avatars1.githubusercontent.com/u/1817508?v=3&s=130)](http://github.com/ariporad) | [![Levi Thomason](https://avatars1.githubusercontent.com/u/5067638?v=3&s=130)](https://github.com/levithomason) |\n|:---:|:---:|:---:|\n| [Nate Fischer](https://github.com/nfischer) | [Ari Porad](http://github.com/ariporad) | [Levi Thomason](https://github.com/levithomason) |\n","publish_time":1478589821840,"_cnpm_publish_time":1478589821840,"dist-tags":{"latest":"0.4.0"}}