{"name":"shx","version":"0.1.2","keywords":["shelljs","shell","unix","bash","sh","exec","cli","zsh"],"license":"MIT","_id":"shx@0.1.2","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"},{"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":"4ccce6c7684bd3aad69b480024b0944279687db9","tarball":"http://registry-npm.ywwl.com/shx/download/shx-0.1.2.tgz","integrity":"sha512-SnY+JLJZihfBd0nw5m9OjidiljJXa1PGvpYUB8yzPNCJxbN1dFlt/NppqoYwDIKdN9fpP925z7TkrQklxK3M+Q==","signatures":[{"sig":"MEUCIQDk7CsxVrPteKKH/5zu+3K1WtSTAOU/uibE70U+IoQabwIgcdBRc0f7+iE4+LFJMpB/cYD7iCm09aqiFLODtjtAAro=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":3151,"noattachment":false,"key":"/shx/-/shx-0.1.2.tgz"},"_from":".","files":["lib"],"_shasum":"4ccce6c7684bd3aad69b480024b0944279687db9","gitHead":"643056804d919a7e01857dff8026919d0cd3da4a","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","lint:fix":"npm run lint --silent -- --fix","posttest":"npm run lint --silent","prebuild":"rimraf lib","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":"bash scripts/release.sh major","release:minor":"bash scripts/release.sh minor","release:patch":"bash scripts/release.sh patch"},"_npmUser":{"name":"levithomason","email":"me@levithomason.com"},"repository":{"url":"git+https://github.com/shelljs/shx.git","type":"git"},"_npmVersion":"3.8.6","description":"Portable Shell Commands for Node","directories":{},"_nodeVersion":"6.0.0","dependencies":{"shelljs":"^0.7.0"},"devDependencies":{"nyc":"^6.4.0","chai":"^3.5.0","mocha":"^2.4.5","sinon":"^1.17.3","watch":"^0.17.1","eslint":"^1.10.3","rimraf":"^2.5.2","codecov":"^1.0.1","babel-cli":"^6.6.5","dirty-chai":"^1.2.2","sinon-chai":"^2.8.0","concurrently":"^2.0.0","babel-register":"^6.7.2","babel-preset-es2015":"^6.6.0","eslint-plugin-react":"^3.16.1","eslint-config-airbnb":"^5.0.1"},"_npmOperationalInternal":{"tmp":"tmp/shx-0.1.2.tgz_1462993760430_0.6730909741017967","host":"packages-12-west.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":1462993762972,"_cnpm_publish_time":1462993762972,"dist-tags":{"latest":"0.4.0"}}