(dependencyManager: string, runInstall: boolean, config: Config)
| 326 | } |
| 327 | |
| 328 | async function installLatestLibs(dependencyManager: string, runInstall: boolean, config: Config) { |
| 329 | const pkgJsonPath = join(config.app.rootDir, 'package.json'); |
| 330 | const pkgJsonFile = readFile(pkgJsonPath); |
| 331 | if (!pkgJsonFile) { |
| 332 | return; |
| 333 | } |
| 334 | const pkgJson: any = JSON.parse(pkgJsonFile); |
| 335 | |
| 336 | for (const devDepKey of Object.keys(pkgJson['devDependencies'] || {})) { |
| 337 | if (libs.includes(devDepKey)) { |
| 338 | pkgJson['devDependencies'][devDepKey] = coreVersion; |
| 339 | } else if (plugins.includes(devDepKey)) { |
| 340 | pkgJson['devDependencies'][devDepKey] = pluginVersion; |
| 341 | } |
| 342 | } |
| 343 | for (const depKey of Object.keys(pkgJson['dependencies'] || {})) { |
| 344 | if (libs.includes(depKey)) { |
| 345 | pkgJson['dependencies'][depKey] = coreVersion; |
| 346 | } else if (plugins.includes(depKey)) { |
| 347 | pkgJson['dependencies'][depKey] = pluginVersion; |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2), { |
| 352 | encoding: 'utf-8', |
| 353 | }); |
| 354 | |
| 355 | if (runInstall) { |
| 356 | rimraf.sync(join(config.app.rootDir, 'node_modules/@capacitor/!(cli)')); |
| 357 | await runCommand(dependencyManager, ['install']); |
| 358 | if (dependencyManager == 'yarn') { |
| 359 | await runCommand(dependencyManager, ['upgrade']); |
| 360 | } else { |
| 361 | await runCommand(dependencyManager, ['update']); |
| 362 | } |
| 363 | } else { |
| 364 | logger.info(`Please run an install command with your package manager of choice. (ex: yarn install)`); |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | async function writeBreakingChanges() { |
| 369 | const breaking = [ |
no test coverage detected