Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/social-rivers-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"cmake-rn": patch
---

Assert the existence of CMakeList.txt before passing control to CMake
9 changes: 9 additions & 0 deletions packages/cmake-rn/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Option,
spawn,
oraPromise,
assertFixable,
} from "@react-native-node-api/cli-utils";
import { isSupportedTriplet } from "react-native-node-api";

Expand Down Expand Up @@ -131,6 +132,14 @@ for (const platform of platforms) {

program = program.action(
async ({ target: requestedTargets, ...baseOptions }) => {
assertFixable(
fs.existsSync(path.join(baseOptions.source, "CMakeLists.txt")),
`No CMakeLists.txt found in source directory: ${chalk.dim(baseOptions.source)}`,
{
instructions: `Change working directory into a directory with a CMakeLists.txt, create one or specify the correct source directory using --source`,
},
);

const buildPath = getBuildPath(baseOptions);
if (baseOptions.clean) {
await fs.promises.rm(buildPath, { recursive: true, force: true });
Expand Down
Loading