Skip to content

Commit

Permalink
fix(cli): proper plugin module patch in monorepos (#6589)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored May 12, 2023
1 parent b209760 commit d49e632
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions cli/src/tasks/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { fatal } from '../errors';
import { logger, logPrompt, logSuccess } from '../log';
import { getPlugins } from '../plugin';
import { deleteFolderRecursive } from '../util/fs';
import { resolveNode } from '../util/node';
import { runCommand, getCommandOutput } from '../util/subprocess';
import { extractTemplate } from '../util/template';

Expand Down Expand Up @@ -840,28 +841,28 @@ export async function patchOldCapacitorPlugins(
return await Promise.all(
androidPlugins.map(async p => {
if (p.manifest?.android?.src) {
const buildGradlePath = join(
const buildGradlePath = resolveNode(
config.app.rootDir,
'node_modules',
p.id,
p.manifest.android.src,
'build.gradle',
);
const manifestPath = join(
const manifestPath = resolveNode(
config.app.rootDir,
'node_modules',
p.id,
p.manifest.android.src,
'src',
'main',
'AndroidManifest.xml',
);
const gradleContent = readFile(buildGradlePath);
if (!gradleContent?.includes('namespace')) {
logger.warn(
`${p.id} doesn't officially support Capacitor ${coreVersion} yet, doing our best moving it's package to build.gradle so it builds`,
);
movePackageFromManifestToBuildGradle(manifestPath, buildGradlePath);
if (buildGradlePath && manifestPath) {
const gradleContent = readFile(buildGradlePath);
if (!gradleContent?.includes('namespace')) {
logger.warn(
`${p.id} doesn't officially support Capacitor ${coreVersion} yet, doing our best moving it's package to build.gradle so it builds`,
);
movePackageFromManifestToBuildGradle(manifestPath, buildGradlePath);
}
}
}
}),
Expand Down

0 comments on commit d49e632

Please sign in to comment.