How to use the @react-native-community/cli-tools.logger.success function in @react-native-community/cli-tools

To help you get started, we’ve selected a few @react-native-community/cli-tools 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 react-native-community / cli / packages / cli / src / commands / install / install.ts View on Github external
async function install(args: Array, ctx: Config): Promise {
  const name = args[0];

  logger.info(`Installing "${name}"...`);
  await PackageManager.install([name], {root: ctx.root});

  // Reload configuration to see newly installed dependency
  const newConfig = loadConfig();

  logger.info(`Linking "${name}"...`);
  await link.func([name], newConfig, {platforms: undefined});

  logger.success(`Successfully installed and linked "${name}"`);
}
github react-native-community / cli / packages / cli / src / commands / upgrade / upgrade.ts View on Github external
if (!newVersion) {
    return;
  }

  const patch = await getPatch(currentVersion, newVersion, ctx);

  if (patch === null) {
    return;
  }

  if (patch === '') {
    logger.info('Diff has no changes to apply, proceeding further');
    await installDeps(newVersion);
    await installCocoaPodsDeps(projectDir, thirdPartyIOSDeps);

    logger.success(
      `Upgraded React Native to v${newVersion} 🎉. Now you can review and commit the changes`,
    );
    return;
  }
  let patchSuccess;

  try {
    fs.writeFileSync(tmpPatchFile, patch);
    patchSuccess = await applyPatch(currentVersion, newVersion, tmpPatchFile);
  } catch (error) {
    throw new Error(error.stderr || error);
  } finally {
    try {
      fs.unlinkSync(tmpPatchFile);
    } catch (e) {
      // ignore
github react-native-community / cli / packages / platform-ios / src / commands / runIOS / index.ts View on Github external
const iosDeployOutput = child_process.spawnSync(
    'ios-deploy',
    iosDeployInstallArgs,
    {encoding: 'utf8'},
  );

  if (iosDeployOutput.error) {
    throw new CLIError(
      `Failed to install the app on the device. We've encountered an error in "ios-deploy" command: ${
        iosDeployOutput.error.message
      }`,
    );
  }

  return logger.success('Installed the app on the device.');
}
github react-native-community / cli / packages / platform-ios / src / commands / runIOS / index.ts View on Github external
['-c', 'Print:CFBundleIdentifier', path.join(appPath, 'Info.plist')],
      {encoding: 'utf8'},
    )
    .trim();

  logger.info(`Launching "${chalk.bold(bundleID)}"`);

  const result = child_process.spawnSync('xcrun', [
    'simctl',
    'launch',
    selectedSimulator.udid,
    bundleID,
  ]);

  if (result.status === 0) {
    logger.success('Successfully launched the app on the simulator');
  } else {
    logger.error('Failed to launch the app on simulator', result.stderr);
  }
}
github react-native-community / cli / packages / cli / src / commands / install / uninstall.ts View on Github external
)}`,
    );
    throw new CLIError(
      `Unknown package name "${chalk.bgRed.dim(
        name,
      )}". The package you are trying to uninstall is not present in your "package.json" dependencies.`,
    );
  }

  logger.info(`Unlinking "${name}"...`);
  await unlink.func([name], ctx, {});

  logger.info(`Uninstalling "${name}"...`);
  await PackageManager.uninstall([name], {root: ctx.root});

  logger.success(`Successfully uninstalled and unlinked "${name}"`);
}
github react-native-community / cli / packages / cli / src / commands / link / linkAssets.ts View on Github external
Object.keys(platforms || {}).forEach(platform => {
    const linkConfig =
      platforms[platform] &&
      platforms[platform].linkConfig &&
      platforms[platform].linkConfig();

    if (!linkConfig || !linkConfig.copyAssets || !project[platform]) {
      return;
    }

    logger.info(`Linking assets to ${platform} project`);

    linkConfig.copyAssets(assets, project[platform]);
  });

  logger.success('Assets have been successfully linked to your project');
}