src/commands/start.js
async function start(opts: *) {
  const isTaken = await isPortTaken(opts.port);
  if (isTaken) {
    if (!opts.no_interactive) {
      const { userChoice } = await inquirer.prompt({
        type: 'list',
        name: 'userChoice',
        message: `Port ${opts.port} is already in use. What should we do?`,
        choices: [
          `Kill process using port ${opts.port} and start Haul`,
          'Quit',
        ],
      });
      if (userChoice === 'Quit') {
        process.exit();
      }
      try {
        await killProcess(opts.port);
      } catch (e) {
        logger.error(`Could not kill process! Reason: \n ${e.message}`);
        process.exit(1);
      }
      logger.info(`Successfully killed processes.`);
    } else {
      logger.error(
        `Could not spawn process! Reason: Port ${opts.port} already in use.`
      );
      process.exit(1);
    }
  }

  const directory = process.cwd();
  const configPath = getWebpackConfigPath(directory, opts.config);

  let assetsDest;
  if (opts.assetsDest) {
    assetsDest = path.isAbsolute(opts.assetsDest)
      ? opts.assetsDest
      : path.join(directory, opts.assetsDest);
  } else {
    assetsDest = fs.mkdtempSync(path.join(os.tmpdir(), 'haul-start-'));
  }

  const configOptions = {
    root: directory,
    assetsDest,
    dev: opts.dev,
    minify: opts.minify,
    port: opts.port,
    eager: opts.eager,
    disableHotReloading: !opts.hotReloading,
  };

  createServer({
    configPath,
    configOptions,
  }).listen(opts.port);
}
async function start(opts: *) {
  const isTaken = await isPortTaken(opts.port);
  if (isTaken) {
    if (!opts.no_interactive) {
      const { userChoice } = await inquirer.prompt({
        type: 'list',
        name: 'userChoice',
        message: `Port ${opts.port} is already in use. What should we do?`,
        choices: [
          `Kill process using port ${opts.port} and start Haul`,
          'Quit',
        ],
      });
      if (userChoice === 'Quit') {
        process.exit();
      }
      try {
        await killProcess(opts.port);
      } catch (e) {
        logger.error(`Could not kill process! Reason: \n ${e.message}`);
        process.exit(1);
      }
      logger.info(`Successfully killed processes.`);
    } else {
      logger.error(
        `Could not spawn process! Reason: Port ${opts.port} already in use.`
      );
      process.exit(1);
    }
  }

  const directory = process.cwd();
  const configPath = getWebpackConfigPath(directory, opts.config);

  let assetsDest;
  if (opts.assetsDest) {
    assetsDest = path.isAbsolute(opts.assetsDest)
      ? opts.assetsDest
      : path.join(directory, opts.assetsDest);
  } else {
    assetsDest = fs.mkdtempSync(path.join(os.tmpdir(), 'haul-start-'));
  }

  const configOptions = {
    root: directory,
    assetsDest,
    dev: opts.dev,
    minify: opts.minify,
    port: opts.port,
    eager: opts.eager,
    disableHotReloading: !opts.hotReloading,
  };

  createServer({
    configPath,
    configOptions,
  }).listen(opts.port);
}
Starts development server