{"id":15637804,"url":"https://github.com/freyskeyd/gulp-prompt","last_synced_at":"2025-04-05T08:06:32.104Z","repository":{"id":12686506,"uuid":"15358700","full_name":"Freyskeyd/gulp-prompt","owner":"Freyskeyd","description":"Add interactive console prompts to gulp","archived":false,"fork":false,"pushed_at":"2022-12-06T19:46:56.000Z","size":222,"stargazers_count":102,"open_issues_count":19,"forks_count":25,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-29T07:05:53.179Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Freyskeyd.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-21T12:39:58.000Z","updated_at":"2023-06-06T16:40:03.000Z","dependencies_parsed_at":"2023-01-12T07:00:32.560Z","dependency_job_id":null,"html_url":"https://github.com/Freyskeyd/gulp-prompt","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freyskeyd%2Fgulp-prompt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freyskeyd%2Fgulp-prompt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freyskeyd%2Fgulp-prompt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freyskeyd%2Fgulp-prompt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Freyskeyd","download_url":"https://codeload.github.com/Freyskeyd/gulp-prompt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305933,"owners_count":20917208,"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":[],"created_at":"2024-10-03T11:12:53.646Z","updated_at":"2025-04-05T08:06:32.079Z","avatar_url":"https://github.com/Freyskeyd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gulp prompt\n\nIf you are interested in getting involved please send us an e-mail or open an issue.\nThere are a couple of open issues and small clean up projects that we could use some help with.\n\n\u003ca href=\"https://codeclimate.com/github/shannonlal/gulp-prompt/maintainability\"\u003e\u003cimg src=\"https://api.codeclimate.com/v1/badges/b9e10756dc89eb1d7c19/maintainability\" /\u003e\u003c/a\u003e\n\nAdd interaction to gulp tasks.\n\n## .confirm([options])\n\nOptions:\n\n - **message** - Message to be displayed\n - **default** - Default response if none is provided\n\nThis method will allow the pipe to continue if the user input is true, otherwise, it will be terminated.\n\nDefault usage:\n```javascript\n\ngulp.src('test.js')\n\t.pipe(prompt.confirm())\n\t.pipe(gulp.dest('dest'));\n\n```\n\nIf a string is provided to the options, it will be set as the message:\n```javascript\n\ngulp.src('test.js')\n\t.pipe(prompt.confirm('Are you ready for Gulp?'))\n\t.pipe(gulp.dest('dest'));\n\n```\n\nExample when using options:\n```javascript\n\ngulp.src('test.js')\n\t.pipe(prompt.confirm({\n\t\tmessage: 'Continue?',\n\t\tdefault: true\n\t}))\n\t.pipe(gulp.dest('dest'));\n\n```\n\n## .prompt(questions, callback)\n\nThis is a clean pass-through function for gulp to utilize the full [Inquirer.js Library](https://github.com/SBoudrias/Inquirer.js), please refer to them for documentation on corresponding parameters.\n\nPlease note that all types are avaiable, not just the examples below.\n\nExample Input:\n```javascript\n\ngulp.src('test.js')\n\t.pipe(prompt.prompt({\n\t\ttype: 'input',\n\t\tname: 'task',\n\t\tmessage: 'Which task would you like to run?'\n\t}, function(res){\n\t\t//value is in res.task (the name option gives the key)\n\t}));\n\n```\n\nExample Checkbox:\n```javascript\n\ngulp.src('test.js')\n\t.pipe(prompt.prompt({\n\t\ttype: 'checkbox',\n\t\tname: 'bump',\n\t\tmessage: 'What type of bump would you like to do?',\n\t\tchoices: ['patch', 'minor', 'major']\n\t}, function(res){\n\t\t//value is in res.bump (as an array)\n\t}));\n\n```\n\nExample Password:\n```javascript\n\ngulp.src('test.js')\n\t.pipe(prompt.prompt({\n\t\ttype: 'password',\n\t\tname: 'pass',\n\t\tmessage: 'Please enter your password'\n\t}, function(res){\n\t\t//value is in res.pass\n\t}));\n\n```\n\nExample Multiple:\n```javascript\n\ngulp.src('test.js')\n\t.pipe(prompt.prompt([{\n\t\ttype: 'input',\n\t\tname: 'first',\n\t\tmessage: 'First question?'\n\t},\n\t{\n\t\ttype: 'input',\n\t\tname: 'second',\n\t\tmessage: 'Second question?'\n\t}], function(res){\n\t\t//value is in res.first and res.second\n\t}));\n\n```\n\nExample Validation:\n```javascript\n\ngulp.src('test.js')\n\t.pipe(prompt.prompt({\n\t\ttype: 'password',\n\t\tname: 'pass',\n\t\tmessage: 'Please enter your password',\n\t\tvalidate: function(pass){\n\n\t\t\tif(pass !== '123456'){\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t}, function(res){\n\t\t//value is in res.pass\n\t}));\n\n```\n\nExample List Selection:\n[Note: see sample file]( examples/list-selection-gulpfile.js)\n```javascript\n\n    gulp.src( './package.json' )\n        .pipe( prompt.prompt({\n            type:'list',\n            name:'env',\n            message:'Please enter selection?',\n            choices: ['a','b','c','d','e','f', 'g', 'h'],\n            pageSize:'3'\n        }, (res) =\u003e {\n            console.log('Result', res);\n        }) );\n\n```\n\nExample Templating:\nThis was a fix to the issue #8 (https://github.com/Freyskeyd/gulp-prompt/issues/8)\n[Note: see sample file]( examples/template-replacement-gulpfile.js)\n```javascript\n\n    return gulp.src( './package.json' )\n        .pipe( prompt.confirm({\n            type:'input',\n            name:'env',\n            message:'Hello \u003c%= user %\u003e, please enter selection?',\n            templateOptions:{ 'user': 'fred' }\n        }, (res) =\u003e {\n            console.log('Result', res);\n        }) );\n```\n\nExample Chaining Prompts:\nThis was a fix to the issue #35 (https://github.com/Freyskeyd/gulp-prompt/issues/35)\nThis was a fix to the issue #34 (https://github.com/Freyskeyd/gulp-prompt/issues/34)\n[Note: see sample file]( examples/chain-confirm-gulpfile.js)\n```javascript\n\n\tvar index =0;\n\n\tvar chainFunction = function ( options, resp ){\n\t\tconsole.log( 'Here is the selection ', resp);\n\t\tif( index \u003c= 3){\n\t\t\toptions.message = `Hello this is iteration ${index}`;\n\t\t\tindex++;\n\t\t\treturn options;\n\t\t}else{\n\t\t\treturn;\n\t\t}\n\t};\n\n\tgulp.task( 'chainConfirm',  () =\u003e {\n\t\treturn gulp.src( '../package.json' )\n\t\t\t.pipe( prompt.confirm({\n\t\t\t\ttype:'input',\n\t\t\t\tname:'env',\n\t\t\t\tmessage:'Hello First interation, please enter selection?',\n\t\t\t\tchainFunction:chainFunction\n\t\t\t}, (res) =\u003e {\n\t\t\t\tconsole.log('Result', res);\n\t\t\t}) );\n\t});\n```\n\nThis was a fix to the issue #60 (https://github.com/Freyskeyd/gulp-prompt/issues/60)\n[Note: see sample file]( examples/chain-prompt-gulpfile.js)\n```javascript\n\n\tvar index =0;\n\n\tvar chainFunction = function ( options, resp ){\n\t\tconsole.log( 'Here is the selection ', resp);\n\t\tif( index \u003c= 3){\n\t\t\toptions.message = `Hello this is iteration ${index}`;\n\t\t\tindex++;\n\t\t\treturn options;\n\t\t}else{\n\t\t\treturn;\n\t\t}\n\t};\n\n\tgulp.task( 'chainConfirm',  () =\u003e {\n\t\treturn gulp.src( '../package.json' )\n\t\t\t.pipe( prompt.prompt({\n\t\t\t\ttype:'input',\n\t\t\t\tname:'env',\n\t\t\t\tmessage:'Hello First interation, please enter selection?',\n\t\t\t\tchainFunction:chainFunction\n\t\t\t}, (res) =\u003e {\n\t\t\t\tconsole.log('Result', res);\n\t\t\t}) );\n\t});\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreyskeyd%2Fgulp-prompt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreyskeyd%2Fgulp-prompt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreyskeyd%2Fgulp-prompt/lists"}