Skip to content

Commit

Permalink
Check which extension for the project to print out on the run instruc…
Browse files Browse the repository at this point in the history
…tions for iOS
  • Loading branch information
Lucas Bento committed May 9, 2019
1 parent e7342d6 commit 876bfe2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
4 changes: 3 additions & 1 deletion packages/cli/src/commands/init/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ export default (async function initialize(
try {
await createProject(projectName, options, version);

printRunInstructions(process.cwd(), projectName);
await execa('rm', ['-rf', 'ios/Lol.xcworkspace']);

await printRunInstructions(process.cwd(), projectName);
} catch (e) {
logger.error(e.message);
fs.removeSync(projectName);
Expand Down
17 changes: 10 additions & 7 deletions packages/cli/src/commands/init/printRunInstructions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@
*/

import path from 'path';
import fs from 'fs-extra';
import chalk from 'chalk';
import {logger} from '@react-native-community/cli-tools';

function printRunInstructions(projectDir: string, projectName: string) {
async function printRunInstructions(projectDir: string, projectName: string) {
const absoluteProjectDir = path.resolve(projectDir);
const xcodeProjectPath = `${path.resolve(
projectDir,
'ios',
projectName,
)}.xcworkspace`;
const iosProjectDir = path.resolve(projectDir, 'ios');

const iosPodsFile = path.resolve(iosProjectDir, `${projectName}.xcworkspace`);
const isUsingPods = await fs.pathExists(iosPodsFile);

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

logger.log(`
Expand Down

0 comments on commit 876bfe2

Please sign in to comment.