(config: Config, noprompt: boolean, packagemanager: string)
| 51 | let installFailed = false; |
| 52 | |
| 53 | export async function migrateCommand(config: Config, noprompt: boolean, packagemanager: string): Promise<void> { |
| 54 | if (config === null) { |
| 55 | fatal('Config data missing'); |
| 56 | } |
| 57 | |
| 58 | const capMajor = await checkCapacitorMajorVersion(config); |
| 59 | if (capMajor < 7) { |
| 60 | fatal('Migrate can only be used on Capacitor 7, please use the CLI in Capacitor 7 to upgrade to 7 first'); |
| 61 | } |
| 62 | |
| 63 | const jdkMajor = await checkJDKMajorVersion(); |
| 64 | |
| 65 | if (jdkMajor < 21) { |
| 66 | logger.warn('Capacitor 8 requires JDK 21 or higher. Some steps may fail.'); |
| 67 | } |
| 68 | |
| 69 | const variablesAndClasspaths: |
| 70 | | { |
| 71 | variables: any; |
| 72 | 'com.android.tools.build:gradle': string; |
| 73 | 'com.google.gms:google-services': string; |
| 74 | } |
| 75 | | undefined = await getAndroidVariablesAndClasspaths(config); |
| 76 | |
| 77 | if (!variablesAndClasspaths) { |
| 78 | fatal('Variable and Classpath info could not be read.'); |
| 79 | } |
| 80 | |
| 81 | allDependencies = { |
| 82 | ...config.app.package.dependencies, |
| 83 | ...config.app.package.devDependencies, |
| 84 | }; |
| 85 | |
| 86 | const monorepoWarning = |
| 87 | 'Please note this tool is not intended for use in a mono-repo environment, you should migrate manually instead. Refer to https://capacitorjs.com/docs/next/updating/8-0'; |
| 88 | |
| 89 | logger.info(monorepoWarning); |
| 90 | |
| 91 | const { migrateconfirm } = noprompt |
| 92 | ? { migrateconfirm: 'y' } |
| 93 | : await logPrompt(`Capacitor 8 sets a deployment target of iOS ${iOSVersion} and Android 16 (SDK 36). \n`, { |
| 94 | type: 'text', |
| 95 | name: 'migrateconfirm', |
| 96 | message: `Are you sure you want to migrate? (Y/n)`, |
| 97 | initial: 'y', |
| 98 | }); |
| 99 | |
| 100 | if (typeof migrateconfirm === 'string' && migrateconfirm.toLowerCase() === 'y') { |
| 101 | try { |
| 102 | const { depInstallConfirm } = noprompt |
| 103 | ? { depInstallConfirm: 'y' } |
| 104 | : await logPrompt( |
| 105 | `Would you like the migrator to run npm, yarn, pnpm, or bun install to install the latest versions of capacitor packages? (Those using other package managers should answer N)`, |
| 106 | { |
| 107 | type: 'text', |
| 108 | name: 'depInstallConfirm', |
| 109 | message: `Run Dependency Install? (Y/n)`, |
| 110 | initial: 'y', |
no test coverage detected