Skip to content

Commit 4a06a0c

Browse files
authored
feat: have pod install error message show correct directory (react-native-community#1428)
1 parent fa0d09b commit 4a06a0c

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ async function createFromTemplate({
133133

134134
if (!skipInstall) {
135135
await installDependencies({
136-
projectName,
137136
npm,
138137
loader,
139138
root: projectDirectory,
139+
directory,
140140
});
141141
} else {
142142
loader.succeed('Dependencies installation skipped');
@@ -150,12 +150,12 @@ async function createFromTemplate({
150150
}
151151

152152
async function installDependencies({
153-
projectName,
153+
directory,
154154
npm,
155155
loader,
156156
root,
157157
}: {
158-
projectName: string;
158+
directory: string;
159159
npm?: boolean;
160160
loader: ora.Ora;
161161
root: string;
@@ -169,7 +169,7 @@ async function installDependencies({
169169
});
170170

171171
if (process.platform === 'darwin') {
172-
await installPods({projectName, loader});
172+
await installPods({directory, loader});
173173
}
174174

175175
loader.succeed();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ async function generateProject(
8989
if (process.platform === 'darwin') {
9090
logger.info('Installing required CocoaPods dependencies');
9191

92-
await installPods({projectName: newProjectName});
92+
await installPods({directory: destinationRoot});
9393
}
9494

9595
printRunInstructions(destinationRoot, newProjectName);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ const installCocoaPodsDeps = async (projectDir: string) => {
201201
)}`,
202202
);
203203
await installPods({
204-
projectName: projectDir.split('/').pop() || '',
204+
directory: projectDir.split('/').pop() || '',
205205
});
206206
} catch (error) {
207207
if (error.stderr) {

packages/cli/src/tools/installPods.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type PromptCocoaPodsInstallation = {
1616

1717
async function runPodInstall(
1818
loader: ora.Ora,
19-
projectName: string,
19+
directory: string,
2020
shouldHandleRepoUpdate: boolean = true,
2121
) {
2222
try {
@@ -39,11 +39,11 @@ async function runPodInstall(
3939
*/
4040
if (stderr.includes('pod repo update') && shouldHandleRepoUpdate) {
4141
await runPodUpdate(loader);
42-
await runPodInstall(loader, projectName, false);
42+
await runPodInstall(loader, directory, false);
4343
} else {
4444
loader.fail();
4545
throw new Error(
46-
`Failed to install CocoaPods dependencies for iOS project, which is required by this template.\nPlease try again manually: "cd ./${projectName}/ios && pod install".\nCocoaPods documentation: ${chalk.dim.underline(
46+
`Failed to install CocoaPods dependencies for iOS project, which is required by this template.\nPlease try again manually: "cd ./${directory}/ios && pod install".\nCocoaPods documentation: ${chalk.dim.underline(
4747
'https://cocoapods.org/',
4848
)}`,
4949
);
@@ -162,10 +162,10 @@ async function installCocoaPods(loader: ora.Ora) {
162162
}
163163

164164
async function installPods({
165-
projectName,
165+
directory,
166166
loader,
167167
}: {
168-
projectName: string;
168+
directory: string;
169169
loader?: ora.Ora;
170170
}) {
171171
loader = loader || new NoopLoader();
@@ -192,7 +192,7 @@ async function installPods({
192192
await installCocoaPods(loader);
193193
}
194194

195-
await runPodInstall(loader, projectName);
195+
await runPodInstall(loader, directory);
196196
} catch (error) {
197197
throw error;
198198
} finally {

0 commit comments

Comments
 (0)