Skip to content

Commit 5abea6e

Browse files
committed
fix: simplify receiving checksum from Podfile
1 parent bfdfac9 commit 5abea6e

File tree

1 file changed

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

1 file changed

+11
-18
lines changed

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

+11-18
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
IOSDependencyConfig,
1414
} from '@react-native-community/cli-types';
1515
import {ApplePlatform} from '../types';
16-
import readline from 'readline';
1716

1817
interface ResolvePodsOptions {
1918
forceInstall?: boolean;
@@ -65,26 +64,20 @@ export function compareMd5Hashes(hash1?: string, hash2?: string) {
6564
return hash1 === hash2;
6665
}
6766

68-
async function getChecksum(podfileLockPath: string) {
69-
const fileStream = fs.createReadStream(podfileLockPath);
67+
async function getChecksum(
68+
podfileLockPath: string,
69+
): Promise<string | undefined> {
70+
const file = fs.readFileSync(podfileLockPath, 'utf8');
7071

71-
const rl = readline.createInterface({
72-
input: fileStream,
73-
crlfDelay: Infinity,
74-
});
72+
const checksumLine = file
73+
.split('\n')
74+
.find((line) => line.includes('PODFILE CHECKSUM'));
7575

76-
let lines = [];
77-
for await (const line of rl) {
78-
lines.push(line);
76+
if (checksumLine) {
77+
return checksumLine.split(': ')[1];
78+
} else {
79+
return undefined;
7980
}
80-
81-
lines = lines.reverse();
82-
83-
return lines
84-
.filter((line) => line.includes('PODFILE CHECKSUM'))[0]
85-
.split(': ')[1]
86-
87-
return undefined;
8881
}
8982

9083
async function install(

0 commit comments

Comments
 (0)