Skip to content

Commit ef9b2fc

Browse files
authored
refactor: remove useless parameter (#1906)
1 parent 4054b41 commit ef9b2fc

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

packages/cli-doctor/src/tools/installPods.ts

+3-10
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {Loader} from '../types';
1313

1414
async function runPodInstall(
1515
loader: Loader,
16-
directory: string,
1716
shouldHandleRepoUpdate: boolean = true,
1817
) {
1918
try {
@@ -37,7 +36,7 @@ async function runPodInstall(
3736
*/
3837
if (stderr.includes('pod repo update') && shouldHandleRepoUpdate) {
3938
await runPodUpdate(loader);
40-
await runPodInstall(loader, directory, false);
39+
await runPodInstall(loader, false);
4140
} else {
4241
loader.fail();
4342
logger.error(stderr);
@@ -117,13 +116,7 @@ async function installCocoaPods(loader: Loader) {
117116
}
118117
}
119118

120-
async function installPods({
121-
directory,
122-
loader,
123-
}: {
124-
directory: string;
125-
loader?: Loader;
126-
}) {
119+
async function installPods(loader?: Loader) {
127120
loader = loader || new NoopLoader();
128121
try {
129122
if (!fs.existsSync('ios')) {
@@ -152,7 +145,7 @@ async function installPods({
152145
await installCocoaPods(loader);
153146
}
154147

155-
await runPodInstall(loader, directory);
148+
await runPodInstall(loader);
156149
} finally {
157150
process.chdir('..');
158151
}

packages/cli/src/commands/init/init.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ async function createFromTemplate({
140140
npm,
141141
loader,
142142
root: projectDirectory,
143-
directory,
144143
});
145144
} else {
146145
loader.succeed('Dependencies installation skipped');
@@ -154,12 +153,10 @@ async function createFromTemplate({
154153
}
155154

156155
async function installDependencies({
157-
directory,
158156
npm,
159157
loader,
160158
root,
161159
}: {
162-
directory: string;
163160
npm?: boolean;
164161
loader: Loader;
165162
root: string;
@@ -173,7 +170,7 @@ async function installDependencies({
173170
});
174171

175172
if (process.platform === 'darwin') {
176-
await installPods({directory, loader});
173+
await installPods(loader);
177174
}
178175

179176
loader.succeed();

packages/cli/src/commands/upgrade/upgrade.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -216,17 +216,15 @@ const installDeps = async (
216216
}
217217
};
218218

219-
const installCocoaPodsDeps = async (projectDir: string) => {
219+
const installCocoaPodsDeps = async () => {
220220
if (process.platform === 'darwin') {
221221
try {
222222
logger.info(
223223
`Installing CocoaPods dependencies ${chalk.dim(
224224
'(this may take a few minutes)',
225225
)}`,
226226
);
227-
await installPods({
228-
directory: projectDir.split('/').pop() || '',
229-
});
227+
await installPods();
230228
} catch (error) {
231229
if ((error as UpgradeError).stderr) {
232230
logger.debug(
@@ -372,7 +370,7 @@ async function upgrade(argv: Array<string>, ctx: Config) {
372370
if (patch === '') {
373371
logger.info('Diff has no changes to apply, proceeding further');
374372
await installDeps(projectDir, newVersion, repoName);
375-
await installCocoaPodsDeps(projectDir);
373+
await installCocoaPodsDeps();
376374

377375
logger.success(
378376
`Upgraded React Native to v${newVersion} 🎉. Now you can review and commit the changes`,
@@ -413,7 +411,7 @@ async function upgrade(argv: Array<string>, ctx: Config) {
413411
}
414412
} else {
415413
await installDeps(projectDir, newVersion, repoName);
416-
await installCocoaPodsDeps(projectDir);
414+
await installCocoaPodsDeps();
417415
logger.info('Running "git status" to check what changed...');
418416
await execa('git', ['status'], {stdio: 'inherit'});
419417
}

0 commit comments

Comments
 (0)