How to use the @haul-bundler/core.getReactNativeVersion function in @haul-bundler/core

To help you get started, we’ve selected a few @haul-bundler/core 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 callstack / haul / packages / haul-cli / src / commands / init.ts View on Github external
async function checkProject(progress: Ora, cwd: string, runtime: Runtime) {
  progress.start('Checking project files');
  await delay(1000);

  // Are we inside a React Native project?
  if (getReactNativeVersion(cwd)) {
    progress.succeed('Project looks good');
  } else {
    progress.fail(dedent`
    This doesn't seem to be a React Native project.

    Make sure you have a ${runtime.logger.enhanceWithModifier(
      'bold',
      'package.json'
    )} file with ${runtime.logger.enhanceWithModifier(
      'bold',
      'react-native'
    )} in dependencies, and you have installed these dependencies.

    To generate a React Native project, run ${runtime.logger.enhanceWithModifier(
      'bold',
      'react-native init '
github callstack / haul / packages / haul-cli / src / commands / init.ts View on Github external
async handler() {
      let exitCode = 0;
      try {
        const cwd = process.cwd();
        const rnVersion = getReactNativeVersion(cwd);

        if (!rnVersion) {
          runtime.logger.error(
            'Cannot find React Native. Are you in React Native project?'
          );
          runtime.complete(1);
        }

        const progress = ora().start('Detecting Haul preset version...');

        const babelPreset = '@haul-bundler/babel-preset-react-native';
        const haulPreset = await getAvailableHaulPreset(
          progress,
          `@haul-bundler/preset-${rnVersion!.major}.${rnVersion!.minor}`
        );