{"id":14982096,"url":"https://github.com/sun-zheng-an/gulp-shell","last_synced_at":"2025-05-15T06:09:03.891Z","repository":{"id":14374376,"uuid":"17084398","full_name":"sun-zheng-an/gulp-shell","owner":"sun-zheng-an","description":"A handy command line interface for gulp","archived":false,"fork":false,"pushed_at":"2023-01-04T21:41:10.000Z","size":1469,"stargazers_count":480,"open_issues_count":16,"forks_count":62,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-14T10:42:42.992Z","etag":null,"topics":["command","gulp","gulp-plugin","shell"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sun-zheng-an.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-22T12:31:54.000Z","updated_at":"2024-11-19T00:05:28.000Z","dependencies_parsed_at":"2023-01-13T20:00:14.769Z","dependency_job_id":null,"html_url":"https://github.com/sun-zheng-an/gulp-shell","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sun-zheng-an%2Fgulp-shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sun-zheng-an%2Fgulp-shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sun-zheng-an%2Fgulp-shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sun-zheng-an%2Fgulp-shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sun-zheng-an","download_url":"https://codeload.github.com/sun-zheng-an/gulp-shell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254283350,"owners_count":22045141,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command","gulp","gulp-plugin","shell"],"created_at":"2024-09-24T14:04:47.108Z","updated_at":"2025-05-15T06:09:03.812Z","avatar_url":"https://github.com/sun-zheng-an.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-shell\n\n[![NPM version](https://img.shields.io/npm/v/gulp-shell.svg)](https://npmjs.org/package/gulp-shell)\n[![Build Status](https://img.shields.io/travis/sun-zheng-an/gulp-shell/master.svg)](https://travis-ci.org/sun-zheng-an/gulp-shell)\n[![Coveralls Status](https://img.shields.io/coveralls/sun-zheng-an/gulp-shell/master.svg)](https://coveralls.io/r/sun-zheng-an/gulp-shell)\n[![Dependency Status](https://img.shields.io/david/sun-zheng-an/gulp-shell.svg)](https://david-dm.org/sun-zheng-an/gulp-shell)\n[![Downloads](https://img.shields.io/npm/dm/gulp-shell.svg)](https://npmjs.org/package/gulp-shell)\n\n\u003e A handy command line interface for gulp\n\n## Installation\n\n```shell\nnpm install --save-dev gulp-shell\n```\n\n## Usage\n\n```js\nconst gulp = require('gulp')\nconst shell = require('gulp-shell')\n\ngulp.task('example', () =\u003e {\n  return gulp\n    .src('*.js', { read: false })\n    .pipe(shell(['echo \u003c%= file.path %\u003e']))\n})\n```\n\nOr you can use this shorthand:\n\n```js\ngulp.task('greet', shell.task('echo Hello, World!'))\n```\n\nYou can find more examples in the [gulpfile](https://github.com/sun-zheng-an/gulp-shell/blob/master/gulpfile.ts) of this project.\n\n**WARNING**: Running commands like ~~`gulp.src('').pipe(shell('whatever'))`~~ is [considered as an anti-pattern](https://github.com/sun-zheng-an/gulp-shell/issues/55). **PLEASE DON'T DO THAT ANYMORE**.\n\n## API\n\n### shell(commands, options) or shell.task(commands, options)\n\n#### commands\n\ntype: `string` or `Array\u003cstring\u003e`\n\nA command can be a [template][] which can be interpolated by some [file][] info (e.g. `file.path`).\n\n**WARNING**: [Using command templates can be extremely dangerous](https://github.com/sun-zheng-an/gulp-shell/issues/83). Don't shoot yourself in the foot by ~~passing arguments like `$(rm -rf $HOME)`~~.\n\n#### options.cwd\n\ntype: `string`\n\ndefault: [`process.cwd()`](http://nodejs.org/api/process.html#process_process_cwd)\n\nSets the current working directory for the command. This can be a [template][] which can be interpolated by some [file][] info (e.g. `file.path`).\n\n#### options.env\n\ntype: `object`\n\nBy default, all the commands will be executed in an environment with all the variables in [`process.env`](http://nodejs.org/api/process.html#process_process_env) and `PATH` prepended by `./node_modules/.bin` (allowing you to run executables in your Node's dependencies).\n\nYou can override any environment variables with this option.\n\nFor example, setting it to `{ PATH: process.env.PATH }` will reset the `PATH` if the default one brings your some troubles.\n\n#### options.shell\n\ntype: `string`\n\ndefault: `/bin/sh` on UNIX, and `cmd.exe` on Windows\n\nChange it to `bash` if you like.\n\n#### options.quiet\n\ntype: `boolean`\n\ndefault: `false`\n\nBy default, it will print the command output.\n\n#### options.verbose\n\ntype: `boolean`\n\ndefault: `false`\n\nSet to `true` to print the command(s) to stdout as they are executed\n\n#### options.ignoreErrors\n\ntype: `boolean`\n\ndefault: `false`\n\nBy default, it will emit an `error` event when the command finishes unsuccessfully.\n\n#### options.errorMessage\n\ntype: `string`\n\ndefault: `` Command `\u003c%= command %\u003e` failed with exit code \u003c%= error.code %\u003e ``\n\nYou can add a custom error message for when the command fails.\nThis can be a [template][] which can be interpolated with the current `command`, some [file][] info (e.g. `file.path`) and some error info (e.g. `error.code`).\n\n#### options.templateData\n\ntype: `object`\n\nThe data that can be accessed in [template][].\n\n[template]: http://lodash.com/docs#template\n[file]: https://github.com/wearefractal/vinyl\n\n## Changelog\n\nDetails changes for each release are documented in the [release notes](https://github.com/sun-zheng-an/gulp-shell/releases).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsun-zheng-an%2Fgulp-shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsun-zheng-an%2Fgulp-shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsun-zheng-an%2Fgulp-shell/lists"}