How to use @react-native-community/cli - 10 common examples

To help you get started, we’ve selected a few @react-native-community/cli 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 Marwan01 / food-converter / node_modules / react-native / jest / hasteImpl.js View on Github external
function getPlugins() {
  try {
    // @todo do not rely on private files
    const findPlugins = require('@react-native-community/cli/build/core/findPlugins')
      .default;

    return findPlugins(path.resolve(__dirname, pluginsPath));
  } catch (e) {
    return {
      haste: {
        providesModuleNodeModules: [],
        platforms: [],
      },
    };
  }
}
github a-tarasyuk / create-rx-app / template / common / scripts / react-native.js View on Github external
if (
  process.argv.includes('run-ios') && !process.argv.includes('--simulator')
) {
  process.argv.push('--simulator');
  process.argv.push('iPhone 11'); // Set Default simulator
}

require('@react-native-community/cli').run();
github mauron85 / react-native-background-geolocation / scripts / postunlink.js View on Github external
const path = require('path');
const config = require('./config');
const isInstalled = require('./isInstalled');

if (isInstalled.forAndroid()) {
  const revokePatch = require('@react-native-community/cli/build/commands/link/android/patches/revokePatch').default;
  const makeSettingsPatch = require('@react-native-community/cli/build/commands/link/android/patches/makeSettingsPatch').default;
  revokePatch(
    config.settingsGradlePath,
    makeSettingsPatch(
      config.commonModuleName,
      { sourceDir: path.join(config.moduleDir, 'android', config.commonModuleDir) },
      config
    )
  );
}


if (isInstalled.forIos()) {
  // we should remove background modes and usage descriptions here
  // It will destroy all project customizations, so we rather leave it as is.
}
github mauron85 / react-native-background-geolocation / scripts / postunlink.js View on Github external
const path = require('path');
const config = require('./config');
const isInstalled = require('./isInstalled');

if (isInstalled.forAndroid()) {
  const revokePatch = require('@react-native-community/cli/build/commands/link/android/patches/revokePatch').default;
  const makeSettingsPatch = require('@react-native-community/cli/build/commands/link/android/patches/makeSettingsPatch').default;
  revokePatch(
    config.settingsGradlePath,
    makeSettingsPatch(
      config.commonModuleName,
      { sourceDir: path.join(config.moduleDir, 'android', config.commonModuleDir) },
      config
    )
  );
}


if (isInstalled.forIos()) {
  // we should remove background modes and usage descriptions here
  // It will destroy all project customizations, so we rather leave it as is.
}
github microsoft / react-native-windows / vnext / local-cli / generator-common / index.js View on Github external
if (!replacements) {
    replacements = {};
  }
  const contentChangedCallback = alwaysOverwrite ? (_, contentChanged) =>
  alwaysOverwriteContentChangedCallback(
    srcPath,
    relativeDestPath,
    contentChanged
  ) : (_, contentChanged) =>
    upgradeFileContentChangedCallback(
      srcPath,
      relativeDestPath,
      contentChanged
    );

  copyAndReplace(
    srcPath,
    path.join(destRoot, relativeDestPath),
    replacements,
    contentChangedCallback
  );
}
github microsoft / react-native-windows / current / local-cli / generator-common / index.js View on Github external
if (!replacements) {
    replacements = {};
  }
  const contentChangedCallback = alwaysOverwrite ? (_, contentChanged) =>
  alwaysOverwriteContentChangedCallback(
    srcPath,
    relativeDestPath,
    contentChanged
  ) : (_, contentChanged) =>
    upgradeFileContentChangedCallback(
      srcPath,
      relativeDestPath,
      contentChanged
    );

  copyAndReplace(
    srcPath,
    path.join(destRoot, relativeDestPath),
    replacements,
    contentChangedCallback
  );
}
github microsoft / react-native-windows / vnext / local-cli / generator-common / index.js View on Github external
const fs = require('fs');
const chalk = require('chalk');
const path = require('path');
const copyAndReplace = require('@react-native-community/cli/build/tools/copyAndReplace').default;
const walk = require('@react-native-community/cli/build/tools/walk').default;
const prompt = require('@react-native-community/cli/build/tools/generator/promptSync').default();

function createDir(destPath) {
  if (!fs.existsSync(destPath)) {
    fs.mkdirSync(destPath);
  }
}

function copyAndReplaceWithChangedCallback(srcPath, destRoot, relativeDestPath, replacements, alwaysOverwrite) {
  if (!replacements) {
    replacements = {};
  }
  const contentChangedCallback = alwaysOverwrite ? (_, contentChanged) =>
  alwaysOverwriteContentChangedCallback(
    srcPath,
    relativeDestPath,
    contentChanged
github microsoft / react-native-windows / current / local-cli / rnpm / windows / src / windows.js View on Github external
/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License.
 */
'use strict';

const Common = require('./common');
const chalk = require('chalk');
const execSync = require('child_process').execSync;
const path = require('path');
const prompt = require('@react-native-community/cli/build/tools/generator/promptSync').default();

const REACT_NATIVE_WINDOWS_GENERATE_PATH = function() {
  return path.resolve(
    process.cwd(),
    'node_modules',
    'react-native-windows',
    'local-cli',
    'generate-windows.js'
  );
};

module.exports = function (config, args, options) {
  const name = args[0] ? args[0] : Common.getReactNativeAppName();
  const ns = options.namespace ? options.namespace : name;
  const version = options.windowsVersion ? options.windowsVersion : Common.getReactNativeVersion();
github microsoft / react-native-windows / current / local-cli / generator-common / index.js View on Github external
const fs = require('fs');
const chalk = require('chalk');
const path = require('path');
const copyAndReplace = require('@react-native-community/cli/build/tools/copyAndReplace').default;
const walk = require('@react-native-community/cli/build/tools/walk').default;
const prompt = require('@react-native-community/cli/build/tools/generator/promptSync').default();

function createDir(destPath) {
  if (!fs.existsSync(destPath)) {
    fs.mkdirSync(destPath);
  }
}

function copyAndReplaceWithChangedCallback(srcPath, destRoot, relativeDestPath, replacements, alwaysOverwrite) {
  if (!replacements) {
    replacements = {};
  }
  const contentChangedCallback = alwaysOverwrite ? (_, contentChanged) =>
  alwaysOverwriteContentChangedCallback(
    srcPath,
    relativeDestPath,
    contentChanged
github microsoft / react-native-windows / vnext / local-cli / generator-common / index.js View on Github external
function copyAndReplaceAll(srcPath, destPath, relativeDestDir, replacements, alwaysOverwrite) {
  walk(srcPath).forEach(absoluteSrcFilePath => {
    const filename = path.relative(srcPath, absoluteSrcFilePath);
    const relativeDestPath = path.join(relativeDestDir, filename);
    copyAndReplaceWithChangedCallback(absoluteSrcFilePath, destPath, relativeDestPath, replacements, alwaysOverwrite);
  });
}