Skip to content

Commit b99f2bc

Browse files
committed
fix: return undefined if Podfile.lock not found
1 parent 5abea6e commit b99f2bc

File tree

1 file changed

+11
-7
lines changed
  • packages/cli-platform-apple/src/tools

1 file changed

+11
-7
lines changed

packages/cli-platform-apple/src/tools/pods.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,19 @@ export function compareMd5Hashes(hash1?: string, hash2?: string) {
6767
async function getChecksum(
6868
podfileLockPath: string,
6969
): Promise<string | undefined> {
70-
const file = fs.readFileSync(podfileLockPath, 'utf8');
70+
try {
71+
const file = fs.readFileSync(podfileLockPath, 'utf8');
7172

72-
const checksumLine = file
73-
.split('\n')
74-
.find((line) => line.includes('PODFILE CHECKSUM'));
73+
const checksumLine = file
74+
.split('\n')
75+
.find((line) => line.includes('PODFILE CHECKSUM'));
7576

76-
if (checksumLine) {
77-
return checksumLine.split(': ')[1];
78-
} else {
77+
if (checksumLine) {
78+
return checksumLine.split(': ')[1];
79+
}
80+
81+
return undefined;
82+
} catch {
7983
return undefined;
8084
}
8185
}

0 commit comments

Comments
 (0)