generators/app/index.js
function () {
      var done = this.async();
      var questions = [];
      var choices = [
        {
          name: 'Standard Preset',
          value: 'standard'
        },
        {
          name: 'Minimum Preset',
          value: 'minimum'
        },
        {
          name: 'Custom Configuration (Advanced)',
          value: 'custom'
        }
      ];
      var defaultType = 'standard';

      if (!this.skipWelcomeMessage) {
        this.log(yosay('Welcome to ' + this.pkg.name + ' v' + this.pkg.version));
      }

      if (!this.configType) {
        if (this.config.existed) {
          choices.splice(2, 0, {
            name: 'User Preset',
            value: 'user'
          });
          defaultType = 'user';
        }
        questions.push({
          type: 'list',
          name: 'configType',
          message: 'Setup Type',
          choices: choices,
          default: defaultType
        });
      }

      this.prompt(questions, function (answers) {
        if (typeof answers.configType !== 'undefined') {
          this.configType = answers.configType;
        }

        // Preset for skipping prompt
        switch (this.configType) {
          case 'standard':
            this.preset = standardPreset;
            break;
          case 'minimum':
            this.preset = minimumPreset;
            break;
          case 'user':
            this.preset = this.config.getAll();
            break;
          case 'custom':
            this.preset = {};
            break;
        }

        // Initial settings
        this.settings = _.assign({}, defaultConfig, this.config.getAll());

        done();
      }.bind(this));
    }
function () {
      var done = this.async();
      var questions = [];
      var choices = [
        {
          name: 'Standard Preset',
          value: 'standard'
        },
        {
          name: 'Minimum Preset',
          value: 'minimum'
        },
        {
          name: 'Custom Configuration (Advanced)',
          value: 'custom'
        }
      ];
      var defaultType = 'standard';

      if (!this.skipWelcomeMessage) {
        this.log(yosay('Welcome to ' + this.pkg.name + ' v' + this.pkg.version));
      }

      if (!this.configType) {
        if (this.config.existed) {
          choices.splice(2, 0, {
            name: 'User Preset',
            value: 'user'
          });
          defaultType = 'user';
        }
        questions.push({
          type: 'list',
          name: 'configType',
          message: 'Setup Type',
          choices: choices,
          default: defaultType
        });
      }

      this.prompt(questions, function (answers) {
        if (typeof answers.configType !== 'undefined') {
          this.configType = answers.configType;
        }

        // Preset for skipping prompt
        switch (this.configType) {
          case 'standard':
            this.preset = standardPreset;
            break;
          case 'minimum':
            this.preset = minimumPreset;
            break;
          case 'user':
            this.preset = this.config.getAll();
            break;
          case 'custom':
            this.preset = {};
            break;
        }

        // Initial settings
        this.settings = _.assign({}, defaultConfig, this.config.getAll());

        done();
      }.bind(this));
    }
function ( ) { var done = this . async ( ) ; var questions = [ ] ; var choices = [ { name : 'Standard Preset' , value : 'standard' } , { name : 'Minimum Preset' , value : 'minimum' } , { name : 'Custom Configuration (Advanced)' , value : 'custom' } ] ; var defaultType = 'standard' ; if ( ! this . skipWelcomeMessage ) { this . log ( yosay ( 'Welcome to ' + this . pkg . name + ' v' + this . pkg . version ) ) ; } if ( ! this . configType ) { if ( this . config . existed ) { choices . splice ( 2 , 0 , { name : 'User Preset' , value : 'user' } ) ; defaultType = 'user' ; } questions . push ( { type : 'list' , name : 'configType' , message : 'Setup Type' , choices : choices , default : defaultType } ) ; } this . prompt ( questions , function ( answers ) { if ( typeof answers . configType !== 'undefined' ) { this . configType = answers . configType ; } // Preset for skipping prompt switch ( this . configType ) { case 'standard' : this . preset = standardPreset ; break ; case 'minimum' : this . preset = minimumPreset ; break ; case 'user' : this . preset = this . config . getAll ( ) ; break ; case 'custom' : this . preset = { } ; break ; } // Initial settings this . settings = _ . assign ( { } , defaultConfig , this . config . getAll ( ) ) ; done ( ) ; } . bind ( this ) ) ; }
Setup prompting type
Setup prompting type