packages/build-tools/cli.js
async function updateConfig(options, programInstance) {
      await configStore.updateConfig(config => {
        originalConfig = config;

        config.verbosity =
          typeof program.verbosity === 'undefined'
            ? config.verbosity
            : program.verbosity;

        config.openServerAtStart =
          typeof options.open === 'undefined'
            ? config.openServerAtStart
            : options.open;

        config.renderingService =
          typeof options.renderingService === 'undefined'
            ? process.env.TRAVIS
              ? false
              : config.renderingService
            : options.renderingService;

        config.env = process.env.NODE_ENV
          ? process.env.NODE_ENV
          : typeof options.env === 'undefined'
          ? config.env
          : options.env;

        config.webpackStats =
          typeof options.webpackStats === 'undefined'
            ? config.webpackStats
            : options.webpackStats;

        config.webpackDevServer =
          typeof options.webpackDevServer === 'undefined'
            ? config.webpackDevServer
            : options.webpackDevServer;

        config.mode =
          typeof options.mode === 'undefined' ? config.mode : options.mode;

        config.quick =
          typeof options.quick === 'undefined' ? config.quick : options.quick;

        config.watch =
          typeof options.watch === 'undefined' ? config.watch : options.watch;

        config.prod =
          typeof program.prod === 'undefined' ? config.prod : program.prod;

        // automatically set enableSSR to true in prod mode and false in dev mode, unless manually set.
        config.enableSSR = false;

        config.i18n =
          typeof options.i18n === 'undefined'
            ? config.prod
              ? true
              : false
            : options.i18n;

        // If i18n is disabled, ignore and remove lang config settings
        if (config.lang && config.i18n === false) {
          // Remove any lang-specific settings for local dev to speed things up.
          delete config['lang'];
        }

        return config;
      });

      const config = await configStore.getConfig();
      log.dim(`Verbosity: ${config.verbosity}`);
      log.dim(`Prod: ${config.prod}`);
      log.dim(`i18n: ${config.i18n}`);
      log.dim(
        `enableSSR: ${config.enableSSR} ${
          originalConfig.enableSSR ? '(manually set)' : '(auto set)'
        }`,
      );
      log.dim(`Rendering Mode: ${config.mode}`);
      if (config.verbosity > 2) {
        log.dim(`Opening browser: ${config.openServerAtStart}`);
        log.dim(`Quick mode: ${config.quick}`);
        log.dim(`buildDir: ${config.buildDir}`);
        log.dim(`dataDir: ${config.dataDir}`);
        log.dim(`wwwDir: ${config.wwwDir}`);
      }

      // Basically at this point, the cli is bootstrapped and ready to go.
      // Let's build the core bolt manifest
      await buildBoltManifest();
      return config;
    }
async function updateConfig(options, programInstance) {
      await configStore.updateConfig(config => {
        originalConfig = config;

        config.verbosity =
          typeof program.verbosity === 'undefined'
            ? config.verbosity
            : program.verbosity;

        config.openServerAtStart =
          typeof options.open === 'undefined'
            ? config.openServerAtStart
            : options.open;

        config.renderingService =
          typeof options.renderingService === 'undefined'
            ? process.env.TRAVIS
              ? false
              : config.renderingService
            : options.renderingService;

        config.env = process.env.NODE_ENV
          ? process.env.NODE_ENV
          : typeof options.env === 'undefined'
          ? config.env
          : options.env;

        config.webpackStats =
          typeof options.webpackStats === 'undefined'
            ? config.webpackStats
            : options.webpackStats;

        config.webpackDevServer =
          typeof options.webpackDevServer === 'undefined'
            ? config.webpackDevServer
            : options.webpackDevServer;

        config.mode =
          typeof options.mode === 'undefined' ? config.mode : options.mode;

        config.quick =
          typeof options.quick === 'undefined' ? config.quick : options.quick;

        config.watch =
          typeof options.watch === 'undefined' ? config.watch : options.watch;

        config.prod =
          typeof program.prod === 'undefined' ? config.prod : program.prod;

        // automatically set enableSSR to true in prod mode and false in dev mode, unless manually set.
        config.enableSSR = false;

        config.i18n =
          typeof options.i18n === 'undefined'
            ? config.prod
              ? true
              : false
            : options.i18n;

        // If i18n is disabled, ignore and remove lang config settings
        if (config.lang && config.i18n === false) {
          // Remove any lang-specific settings for local dev to speed things up.
          delete config['lang'];
        }

        return config;
      });

      const config = await configStore.getConfig();
      log.dim(`Verbosity: ${config.verbosity}`);
      log.dim(`Prod: ${config.prod}`);
      log.dim(`i18n: ${config.i18n}`);
      log.dim(
        `enableSSR: ${config.enableSSR} ${
          originalConfig.enableSSR ? '(manually set)' : '(auto set)'
        }`,
      );
      log.dim(`Rendering Mode: ${config.mode}`);
      if (config.verbosity > 2) {
        log.dim(`Opening browser: ${config.openServerAtStart}`);
        log.dim(`Quick mode: ${config.quick}`);
        log.dim(`buildDir: ${config.buildDir}`);
        log.dim(`dataDir: ${config.dataDir}`);
        log.dim(`wwwDir: ${config.wwwDir}`);
      }

      // Basically at this point, the cli is bootstrapped and ready to go.
      // Let's build the core bolt manifest
      await buildBoltManifest();
      return config;
    }
async function updateConfig ( options , programInstance ) { await configStore . updateConfig ( config => { originalConfig = config ; config . verbosity = typeof program . verbosity === 'undefined' ? config . verbosity : program . verbosity ; config . openServerAtStart = typeof options . open === 'undefined' ? config . openServerAtStart : options . open ; config . renderingService = typeof options . renderingService === 'undefined' ? process . env . TRAVIS ? false : config . renderingService : options . renderingService ; config . env = process . env . NODE_ENV ? process . env . NODE_ENV : typeof options . env === 'undefined' ? config . env : options . env ; config . webpackStats = typeof options . webpackStats === 'undefined' ? config . webpackStats : options . webpackStats ; config . webpackDevServer = typeof options . webpackDevServer === 'undefined' ? config . webpackDevServer : options . webpackDevServer ; config . mode = typeof options . mode === 'undefined' ? config . mode : options . mode ; config . quick = typeof options . quick === 'undefined' ? config . quick : options . quick ; config . watch = typeof options . watch === 'undefined' ? config . watch : options . watch ; config . prod = typeof program . prod === 'undefined' ? config . prod : program . prod ; // automatically set enableSSR to true in prod mode and false in dev mode, unless manually set. config . enableSSR = false ; config . i18n = typeof options . i18n === 'undefined' ? config . prod ? true : false : options . i18n ; // If i18n is disabled, ignore and remove lang config settings if ( config . lang && config . i18n === false ) { // Remove any lang-specific settings for local dev to speed things up. delete config [ 'lang' ] ; } return config ; } ) ; const config = await configStore . getConfig ( ) ; log . dim ( ` ${ config . verbosity } ` ) ; log . dim ( ` ${ config . prod } ` ) ; log . dim ( ` ${ config . i18n } ` ) ; log . dim ( ` ${ config . enableSSR } ${ originalConfig . enableSSR ? '(manually set)' : '(auto set)' } ` , ) ; log . dim ( ` ${ config . mode } ` ) ; if ( config . verbosity > 2 ) { log . dim ( ` ${ config . openServerAtStart } ` ) ; log . dim ( ` ${ config . quick } ` ) ; log . dim ( ` ${ config . buildDir } ` ) ; log . dim ( ` ${ config . dataDir } ` ) ; log . dim ( ` ${ config . wwwDir } ` ) ; } // Basically at this point, the cli is bootstrapped and ready to go. // Let's build the core bolt manifest await buildBoltManifest ( ) ; return config ; }
Update config with all options flags
@param {Object} options
@param programInstance - The commander `program`
@returns {Object} config - Final updated config
Update config with all options flags