Skip to content

Commit 0ab4881

Browse files
authored
fix(cli): capacitor config not being read from multi-project directories (#4909)
* fix(cli): use exec to run cap command in right cwd * chore: fix deps causing build errors * chore: cleanup * chore: promise should reject from exec error
1 parent ffd1960 commit 0ab4881

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { exec, ExecOptions } from 'child_process';
12
import { parseArgs } from '@ionic/cli-framework';
23
import { mkdirp, pathExists } from '@ionic/utils-fs';
34
import { prettyPath } from '@ionic/utils-terminal';
@@ -190,7 +191,16 @@ export class Integration extends BaseIntegration<ProjectIntegration> {
190191

191192
debug('Getting config with Capacitor CLI: %O', args);
192193

193-
const output = await this.e.shell.cmdinfo('capacitor', args, { cwd: this.root });
194+
const output = await ((cmd: string, opts: ExecOptions): Promise<string | undefined> => {
195+
return new Promise((resolve, reject) => {
196+
exec(cmd, opts, (error, stdout, stderr) => {
197+
if (error) {
198+
reject();
199+
}
200+
resolve(stdout);
201+
})
202+
})
203+
})(`capacitor ${args.join(' ')}`, { cwd: this.root });
194204

195205
if (!output) {
196206
debug('Could not get config from Capacitor CLI (probably old version)');

packages/@ionic/lab/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@
4444
"@ionic/cli-framework": "5.1.3",
4545
"@ionic/utils-fs": "3.1.6",
4646
"chalk": "^4.0.0",
47-
"express": "^4.16.2",
47+
"express": "4.16.2",
4848
"tslib": "^2.0.1"
4949
},
5050
"devDependencies": {
5151
"@ionic-internal/ionic-ds": "^2.1.0",
5252
"@stencil/core": "~1.8.5",
53-
"@types/express": "^4.11.0",
53+
"@types/express": "4.11.0",
54+
"@types/express-serve-static-core": "4.11.0",
5455
"@types/node": "~10.17.13",
5556
"lint-staged": "^10.0.2",
5657
"rimraf": "^3.0.0",

packages/@ionic/v1-toolkit/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"chalk": "^4.0.0",
4343
"chokidar": "^3.0.1",
4444
"debug": "^4.0.0",
45-
"express": "^4.16.2",
45+
"express": "4.16.2",
4646
"gulp": "^4.0.2",
4747
"http-proxy-middleware": "^0.20.0",
4848
"tiny-lr": "^1.1.0",
@@ -51,7 +51,8 @@
5151
},
5252
"devDependencies": {
5353
"@types/debug": "^4.1.1",
54-
"@types/express": "^4.11.0",
54+
"@types/express": "4.11.0",
55+
"@types/express-serve-static-core": "4.11.0",
5556
"@types/gulp": "^4.0.6",
5657
"@types/http-proxy-middleware": "^0.19.0",
5758
"@types/jest": "^26.0.10",

0 commit comments

Comments
 (0)