MCPcopy
hub / github.com/ionic-team/capacitor / generateCordovaPackageFile

Function generateCordovaPackageFile

cli/src/ios/update.ts:104–122  ·  view source on GitHub ↗
(p: Plugin, config: Config)

Source from the content-addressed store, hash-verified

102}
103
104async function generateCordovaPackageFile(p: Plugin, config: Config) {
105 const iosPlatformVersion = await getCapacitorPackageVersion(config, config.ios.name);
106
107 const platformTag = getPluginPlatform(p, platform);
108 if (platformTag.$?.package) {
109 const packageSwiftPath = join(p.rootPath, 'Package.swift');
110 let content = await readFile(packageSwiftPath, { encoding: 'utf-8' });
111 content = content.replace(`apache`, `ionic-team`).replaceAll(`cordova-ios`, `capacitor-swift-pm`);
112 content = setAllStringIn(
113 content,
114 `url: "https://github.com/ionic-team/capacitor-swift-pm.git",`,
115 `)`,
116 ` from: "${iosPlatformVersion}"`,
117 );
118 await writeFile(packageSwiftPath, content);
119 } else {
120 await writeGeneratedPackageSwift(p, config, iosPlatformVersion);
121 }
122}
123
124function buildBinaryTargetEntries(p: Plugin, frameworks: any[]): { binaryTargetsText: string; binaryDepsText: string } {
125 const customXcframeworks = frameworks.filter((f: any) => f.$.custom === 'true' && f.$.src.endsWith('.xcframework'));

Callers 1

Calls 5

getPluginPlatformFunction · 0.90
setAllStringInFunction · 0.90
readFileFunction · 0.85

Tested by

no test coverage detected