{"library":"shx","title":"shx: Portable Shell Commands for Node","description":"shx is a command-line wrapper for ShellJS, designed specifically for providing cross-platform Unix-like commands within npm package scripts. It enables developers to use common shell commands such as `rm`, `cp`, `ls`, `mkdir`, `echo`, and `sed` consistently across different operating systems (Unix, Windows) without encountering shell-specific syntax issues. The current stable version, 0.4.0, is based on ShellJS v0.9, and mandates Node.js v18 or newer. Its primary differentiator from ShellJS (which is suitable for longer, programmatic JavaScript scripts) is its focus on simple, one-off command executions in `package.json` scripts, offering portability and ease of integration into build tooling and development workflows. shx's release cadence is tied to its upstream ShellJS dependency. It ensures a consistent CLI experience for basic file system operations.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install shx"],"cli":{"name":"shx","version":null}},"imports":["shx rm -rf build/","\"clean\": \"shx rm -rf \\\"build/**/*.js\\\"\"","\"build-and-clean\": \"shx mkdir dist && shx cp src/*.js dist/ && shx echo 'Build complete.'\""],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"{\n  \"name\": \"my-project\",\n  \"version\": \"1.0.0\",\n  \"scripts\": {\n    \"clean\": \"shx rm -rf dist/\",\n    \"lint\": \"shx ls src/**/*.js | xargs eslint\",\n    \"build\": \"shx mkdir -p dist/ && shx cp src/*.js dist/ && shx echo 'Build artifacts moved to dist/'\",\n    \"postinstall\": \"shx echo 'shx commands are ready!'\"\n  },\n  \"devDependencies\": {\n    \"shx\": \"^0.4.0\",\n    \"eslint\": \"^8.0.0\"\n  }\n}","lang":"json","description":"This `package.json` example demonstrates how to use `shx` for common build script tasks like cleaning directories, copying files, and creating directories, ensuring cross-platform compatibility.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}