yn-prompt

1.0.7 • Public • Published

yn-prompt

NodeJS module.

When input yes or no, use this yn-prompt module.

Its dependency is the prompt module.

installation

npm i yn-prompt

api

ynPrompt( msg, pattern );

usecase1

var ynPrompt = require('yn-prompt');
ynPrompt("Do you want to copy node_modules directory into the release folder?(y/n)").then( function( yn ) {
 
  if( yn.toUpperCase() !== 'Y' ) return;
 
  return ynPrompt("Do you want devDependency?(y/n)");
 
}).then( function( yn ) {
 
  if( yn.toUpperCase() !== 'Y' ) {
    // todo: copy both devDependencies and dependencies
  } else {
    // todo: copy only dependencies
  }
});

usecase2 with gulp

var gulp = require('gulp');
var ynPrompt = require('yn-prompt');
 
var goContinue = false;
gulp.task('question', function( done ) {
 
    var result = syncExec('svn status');
    console.warn( result.stdout );
 
    ynPrompt('Check the uncommited files. continue? (y/n)').then(( yn ) => {
 
        if( yn.toUpperCase() === 'Y' ) {
            goContinue = true;
        }
        done();
    });
});
gulp.task('preversion',['question'], function( done ) {
    if( ! goContinue ) {
        logger.info('canceled version up process');
        throw { errorDesc: 'canceled version up process' };
    }
 
    done();
});

License: MIT

Readme

Keywords

none

Package Sidebar

Install

npm i yn-prompt

Weekly Downloads

3

Version

1.0.7

License

none

Last publish

Collaborators

  • b6pzeusbc54tvhw5jgpyw8pwz2x6gs