Skip to content

Commit

Permalink
fix(cli): projectDir is only set in recent versions
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Aug 28, 2024
1 parent e14ca25 commit 580a073
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-rabbits-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rnx-kit/cli": patch
---

`projectDir` is only set in recent versions of `@react-native-community/cli`
8 changes: 6 additions & 2 deletions packages/cli/src/build/ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export function buildIOS(
const { sourceDir, xcodeProject } = config.project[platform] ?? {};
if (!sourceDir || !xcodeProject) {
const root = platform.substring(0, platform.length - 2);
logger.fail(`No ${root}OS project was found`);
logger.fail(
`No ${root}OS project was found; did you forget to run 'pod install'?`
);
process.exitCode = 1;
return Promise.resolve(1);
}
Expand All @@ -27,6 +29,8 @@ export function buildIOS(
return Promise.resolve(1);
}

const xcworkspace = path.resolve(sourceDir, projectDir, name);
const xcworkspace = projectDir
? path.resolve(sourceDir, projectDir, name)
: path.resolve(sourceDir, name);
return runBuild(xcworkspace, buildParams, logger);
}
5 changes: 0 additions & 5 deletions packages/cli/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ export function rnxRun(
return runIOS(config, buildParams);
case "macos":
return runMacOS(config, buildParams);
default:
// @ts-expect-error Safe guard against user input
console.error(`Unsupported platform: ${buildParams.platform}`);
process.exitCode = 1;
return Promise.resolve();
}
}

Expand Down

0 comments on commit 580a073

Please sign in to comment.