Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: init run instructions to show workspace #566

Merged
merged 1 commit into from
Jul 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions packages/cli/src/commands/init/printRunInstructions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,27 @@ import chalk from 'chalk';
import {logger} from '@react-native-community/cli-tools';

function printRunInstructions(projectDir: string, projectName: string) {
const relativeProjectDir = path.relative(projectDir, projectName);
const iosProjectDir = path.resolve(projectDir, `${projectName}/ios`);

const iosProjectDir = path.resolve(projectDir, 'ios');
const iosPodsFile = path.resolve(iosProjectDir, `${projectName}.xcworkspace`);
const isUsingPods = fs.existsSync(iosPodsFile);

const relativeXcodeProjectPath = path.relative(
process.cwd(),
'..',
isUsingPods
? iosPodsFile
: path.resolve(iosProjectDir, `${projectName}.xcodeproj`),
);

logger.log(`
${chalk.cyan(`Run instructions for ${chalk.bold('iOS')}`)}:
• cd ${relativeProjectDir} && react-native run-ios
- or -
• cd ${projectName} && react-native run-ios
${chalk.dim('- or -')}
• Open ${relativeXcodeProjectPath} in Xcode or run "xed -b ios"
• Hit the Run button

${chalk.green(`Run instructions for ${chalk.bold('Android')}`)}:
• Have an Android emulator running (quickest way to get started), or a device connected.
• cd ${relativeProjectDir} && react-native run-android
• cd ${projectName} && react-native run-android
`);
}

Expand Down