Skip to content

Commit 89ba091

Browse files
author
Capacitor+ Bot
committed
chore: sync upstream PR ionic-team#7870 from @terencehonles
2 parents 270d700 + 2447a9b commit 89ba091

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

cli/src/ios/update.ts

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { copy, remove, pathExists, readFile, realpath, writeFile } from 'fs-extra';
1+
import { copy, remove, pathExists, readFile, writeFile } from 'fs-extra';
22
import { basename, dirname, join, relative } from 'path';
33

44
import c from '../colors';
@@ -120,7 +120,7 @@ export async function installCocoaPodsPlugins(config: Config, plugins: Plugin[],
120120

121121
async function updatePodfile(config: Config, plugins: Plugin[], deployment: boolean): Promise<void> {
122122
const dependenciesContent = await generatePodFile(config, plugins);
123-
const relativeCapacitoriOSPath = await getRelativeCapacitoriOSPath(config);
123+
const relativeCapacitoriOSPath = getRelativeCapacitoriOSPath(config);
124124
const podfilePath = join(config.ios.nativeProjectDirAbs, 'Podfile');
125125
let podfileContent = await readFile(podfilePath, { encoding: 'utf-8' });
126126
podfileContent = podfileContent.replace(/(def capacitor_pods)[\s\S]+?(\nend)/, `$1${dependenciesContent}$2`);
@@ -157,7 +157,7 @@ async function updatePodfile(config: Config, plugins: Plugin[], deployment: bool
157157
}
158158
}
159159

160-
async function getRelativeCapacitoriOSPath(config: Config) {
160+
function getRelativeCapacitoriOSPath(config: Config) {
161161
const capacitoriOSPath = resolveNode(config.app.rootDir, '@capacitor/ios', 'package.json');
162162

163163
if (!capacitoriOSPath) {
@@ -167,24 +167,19 @@ async function getRelativeCapacitoriOSPath(config: Config) {
167167
);
168168
}
169169

170-
return convertToUnixPath(relative(config.ios.nativeProjectDirAbs, await realpath(dirname(capacitoriOSPath))));
170+
return convertToUnixPath(relative(config.ios.nativeProjectDirAbs, dirname(capacitoriOSPath)));
171171
}
172172

173173
async function generatePodFile(config: Config, plugins: Plugin[]): Promise<string> {
174-
const relativeCapacitoriOSPath = await getRelativeCapacitoriOSPath(config);
175-
176-
const capacitorPlugins = plugins.filter((p) => getPluginType(p, platform) === PluginType.Core);
177-
const pods = await Promise.all(
178-
capacitorPlugins.map(async (p) => {
179-
if (!p.ios) {
180-
return '';
181-
}
182-
183-
return ` pod '${p.ios.name}', :path => '${convertToUnixPath(
184-
relative(config.ios.nativeProjectDirAbs, await realpath(p.rootPath)),
185-
)}'\n`;
186-
}),
187-
);
174+
const relativeCapacitoriOSPath = getRelativeCapacitoriOSPath(config);
175+
176+
const pods = plugins
177+
.filter((p) => getPluginType(p, platform) === PluginType.Core && p.ios)
178+
.map((p) =>
179+
` pod '${p.ios.name}', :path => '${convertToUnixPath(
180+
relative(config.ios.nativeProjectDirAbs, p.rootPath),
181+
)}'\n`
182+
);
188183
const cordovaPlugins = plugins.filter((p) => getPluginType(p, platform) === PluginType.Cordova);
189184
cordovaPlugins.map(async (p) => {
190185
const podspecs = getPlatformElement(p, platform, 'podspec');

0 commit comments

Comments
 (0)