Skip to content

Commit baf30f9

Browse files
committed
fix: add missing logic from merge
1 parent 2f7cc6d commit baf30f9

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

cli/src/util/cordova-ios.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
getPluginPlatform,
1414
getPluginType,
1515
} from '../plugin';
16+
import { setAllStringIn } from '../tasks/migrate';
1617
import type { Plugin } from '../plugin';
1718
import { extractTemplate } from '../util/template';
1819

@@ -352,7 +353,21 @@ export async function generateCordovaPackageFile(p: Plugin, config: Config): Pro
352353
publicHeadersPath: "."`;
353354
}
354355

355-
const content = `// swift-tools-version: 5.9
356+
const platformTag = getPluginPlatform(p, platform);
357+
358+
if (platformTag.$?.package) {
359+
const packageSwiftPath = join(p.rootPath, 'Package.swift');
360+
let content = await readFile(packageSwiftPath, { encoding: 'utf-8' });
361+
content = content.replace(`apache`, `ionic-team`).replaceAll(`cordova-ios`, `capacitor-swift-pm`);
362+
content = setAllStringIn(
363+
content,
364+
`url: "https://github.com/ionic-team/capacitor-swift-pm.git",`,
365+
`)`,
366+
` from: "${iosPlatformVersion}"`,
367+
);
368+
await writeFile(packageSwiftPath, content);
369+
} else {
370+
const content = `// swift-tools-version: 5.9
356371
357372
import PackageDescription
358373
@@ -379,4 +394,5 @@ let package = Package(
379394
]
380395
)`;
381396
await writeFile(join(config.ios.cordovaPluginsDirAbs, 'sources', p.name, 'Package.swift'), content);
397+
}
382398
}

0 commit comments

Comments
 (0)