(config: Config, platformName: string, inline = false)
| 45 | } |
| 46 | |
| 47 | export async function copy(config: Config, platformName: string, inline = false): Promise<void> { |
| 48 | await runTask(c.success(c.strong(`copy ${platformName}`)), async () => { |
| 49 | const result = await checkWebDir(config); |
| 50 | if (result) { |
| 51 | throw result; |
| 52 | } |
| 53 | |
| 54 | await runHooks(config, platformName, config.app.rootDir, 'capacitor:copy:before'); |
| 55 | |
| 56 | const allPlugins = await getPlugins(config, platformName); |
| 57 | let usesFederatedCapacitor = false; |
| 58 | if (allPlugins.filter((plugin) => plugin.id === '@ionic-enterprise/federated-capacitor').length > 0) { |
| 59 | usesFederatedCapacitor = true; |
| 60 | } |
| 61 | |
| 62 | let usesLiveUpdates = false; |
| 63 | if (allPlugins.filter((plugin) => plugin.id === '@capacitor/live-updates').length > 0) { |
| 64 | usesLiveUpdates = true; |
| 65 | } |
| 66 | |
| 67 | let usesSSLPinning = false; |
| 68 | if ( |
| 69 | allPlugins.filter( |
| 70 | (plugin) => plugin.id === '@ionic-enterprise/ssl-pinning' || plugin.id === '@capacitor/ssl-pinning', |
| 71 | ).length > 0 |
| 72 | ) { |
| 73 | usesSSLPinning = true; |
| 74 | } |
| 75 | |
| 76 | if (platformName === config.ios.name) { |
| 77 | if (usesFederatedCapacitor) { |
| 78 | await copyFederatedWebDirs(config, await config.ios.webDirAbs); |
| 79 | if (config.app.extConfig?.plugins?.FederatedCapacitor?.liveUpdatesKey) { |
| 80 | await copySecureLiveUpdatesKey( |
| 81 | config.app.extConfig.plugins.FederatedCapacitor.liveUpdatesKey, |
| 82 | config.app.rootDir, |
| 83 | config.ios.nativeTargetDirAbs, |
| 84 | ); |
| 85 | } |
| 86 | } else { |
| 87 | await copyWebDir(config, await config.ios.webDirAbs, config.app.webDirAbs); |
| 88 | } |
| 89 | if (usesLiveUpdates && config.app.extConfig?.plugins?.LiveUpdates?.key) { |
| 90 | await copySecureLiveUpdatesKey( |
| 91 | config.app.extConfig.plugins.LiveUpdates.key, |
| 92 | config.app.rootDir, |
| 93 | config.ios.nativeTargetDirAbs, |
| 94 | ); |
| 95 | } |
| 96 | if (usesSSLPinning && config.app.extConfig?.plugins?.SSLPinning?.certs) { |
| 97 | await copySSLCert( |
| 98 | config.app.extConfig.plugins.SSLPinning?.certs as unknown as string[], |
| 99 | config.app.rootDir, |
| 100 | await config.ios.webDirAbs, |
| 101 | ); |
| 102 | } |
| 103 | await copyCapacitorConfig(config, config.ios.nativeTargetDirAbs); |
| 104 | const cordovaPlugins = await getCordovaPlugins(config, platformName); |
no test coverage detected