Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 '
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}`
);