How to use the react-dev-utils/openBrowser function in react-dev-utils

To help you get started, we’ve selected a few react-dev-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github michalkvasnicak / spust / packages / spust / src / start.js View on Github external
if (e instanceof UnexpectedServerTerminationError) {
            console.log(e.stderr);
          } else if (e instanceof ServerSpawnFailureError) {
            console.log(e.stderr);
          }

          console.log();
        });

        console.log(chalk.cyan('ℹ️  Keeping previous server running.'));
      }

      // if apps wasn't compiled yet, open browser (if user's did not tell otherwise)
      if (!doNotOpenBrowser && !isCompiled) {
        openBrowser(
          url.format({
            protocol,
            hostname: 'localhost',
            port: webpackPort,
          }),
        );
      }

      // print nice info :)
      printInstructions(urls);
    }

    // clear last spawn errors
    serverManager.clearSpawnErrors();

    // set flag that it has been successfully compiled
github umijs / umi / packages / af-webpack / src / dev.js View on Github external
urls.lanUrlForTerminal ? `  - Network: ${chalk.cyan(urls.lanUrlForTerminal)}` : '',
        ].join('\n'),
      );
      console.log();
    }

    onCompileDone({
      port,
      isFirstCompile,
      stats,
      server,
    });

    if (isFirstCompile) {
      isFirstCompile = false;
      openBrowser(urls.localUrlForBrowser);
      send({
        type: DONE,
        urls: {
          local: urls.localUrlForTerminal,
          lan: urls.lanUrlForTerminal,
          rawLocal: urls.localUrlForBrowser,
          rawLanUrl: urls.rawLanUrl,
        },
      });
    }
  });
github interactivethings / catalog / cli / src / bin / catalog-start.js View on Github external
const run = async (catalogSrcDir: void | string, options: {port: number, https: boolean, host: string}) => {
  clearConsole();

  console.log(infoMessage('Starting Catalog …'));
  const framework = await detectFramework();
  const paths = await loadPaths(catalogSrcDir, undefined, framework);
  const port = await detect(options.port);

  const url = (options.https ? 'https' : 'http') + '://' + options.host + ':' + port + '/';

  const webpackConfig = await loadWebpackConfig({paths, dev: true, framework, url, publicPath: '/'});

  await setupCatalog(paths);
  await runDevServer(webpackConfig, options.host, port, options.https, paths, framework);

  openBrowser(url);
};
github govau / performance-dashboard / client / scripts / start.js View on Github external
devServer.listen(CONFIG.WEBPACK_PORT, CONFIG.WEBPACK_HOST, function (err) {
  if (err) {
    console.log(err);
  }
  clearConsole();

  console.log(chalk.cyan('Starting the development server...'));
  openBrowser('http://localhost:8080');
});
github govau / performance-dashboard / client / scripts / devServer.js View on Github external
devServer.listen(CONFIG.WEBPACK_PORT, CONFIG.WEBPACK_HOST, function(err) {
  if (err) {
    console.log(err);
  }
  clearConsole();

  console.log(chalk.cyan('Starting the development server...'));
  openBrowser('http://localhost:3000');
});
github expo / expo-cli / packages / expo-cli / src / commands / start.js View on Github external
async function tryOpeningDevToolsAsync({ rootPath, exp, options }): Promise {
  const devToolsUrl = await DevToolsServer.startAsync(rootPath);
  log(`Expo DevTools is running at ${chalk.underline(devToolsUrl)}`);

  if (!options.nonInteractive && !exp.isDetached) {
    if (await UserSettings.getAsync('openDevToolsAtStartup', true)) {
      log(`Opening DevTools in the browser... (press ${chalk.bold`shift-d`} to disable)`);
      openBrowser(devToolsUrl);
    } else {
      log(
        `Press ${chalk.bold`d`} to open DevTools now, or ${chalk.bold`shift-d`} to always open it automatically.`
      );
    }
  }
}
github expo / expo-cli / packages / xdl / src / Web.ts View on Github external
export async function openProjectAsync(
  projectRoot: string
): Promise<{ success: true; url: string } | { success: false; error: Error }> {
  try {
    let url = await UrlUtils.constructWebAppUrlAsync(projectRoot);
    if (!url) {
      throw new Error('Webpack Dev Server is not running');
    }
    openBrowser(url);
    return { success: true, url };
  } catch (e) {
    Logger.global.error(`Couldn't start project on web: ${e.message}`);
    return { success: false, error: e };
  }
}
github pixeloven / pixeloven / packages / pixeloven-tasks / src / serve.ts View on Github external
server(host, chosenPort, (error?: Error) => {
                if (error) {
                    handleError(error);
                }
                logger.info("Starting development server...");
                if (MACHINE === "host") {
                    logger.info("Application will launch automatically.");
                    openBrowser(baseUrl);
                }
            });
        })