Skip to content

Commit 0ca282b

Browse files
fix: support Capacitor 1 apps (#4758)
1 parent 44f2c30 commit 0ca282b

File tree

1 file changed

+9
-2
lines changed
  • packages/@ionic/cli/src/lib/integrations/capacitor

1 file changed

+9
-2
lines changed

packages/@ionic/cli/src/lib/integrations/capacitor/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,16 @@ export class Integration extends BaseIntegration<ProjectIntegration> {
195195
if (!output) {
196196
debug('Could not get config from Capacitor CLI (probably old version)');
197197
return;
198+
} else {
199+
try {
200+
// Capacitor 1 returns the `command not found` error in stdout instead of stderror like in Capacitor 2
201+
// This ensures that the output from the command is valid JSON to account for this
202+
return JSON.parse(output);
203+
} catch(e) {
204+
debug('Could not get config from Capacitor CLI (probably old version)', e);
205+
return;
206+
}
198207
}
199-
200-
return JSON.parse(output);
201208
});
202209

203210
getCapacitorConfig = lodash.memoize(async (): Promise<CapacitorConfig | undefined> => {

0 commit comments

Comments
 (0)