Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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: [],
},
};
}
}
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();
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.
}
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.
}
if (!replacements) {
replacements = {};
}
const contentChangedCallback = alwaysOverwrite ? (_, contentChanged) =>
alwaysOverwriteContentChangedCallback(
srcPath,
relativeDestPath,
contentChanged
) : (_, contentChanged) =>
upgradeFileContentChangedCallback(
srcPath,
relativeDestPath,
contentChanged
);
copyAndReplace(
srcPath,
path.join(destRoot, relativeDestPath),
replacements,
contentChangedCallback
);
}
if (!replacements) {
replacements = {};
}
const contentChangedCallback = alwaysOverwrite ? (_, contentChanged) =>
alwaysOverwriteContentChangedCallback(
srcPath,
relativeDestPath,
contentChanged
) : (_, contentChanged) =>
upgradeFileContentChangedCallback(
srcPath,
relativeDestPath,
contentChanged
);
copyAndReplace(
srcPath,
path.join(destRoot, relativeDestPath),
replacements,
contentChangedCallback
);
}
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
/**
* 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();
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
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);
});
}