Skip to content

Commit

Permalink
fix(cli): capacitor config not being read from multi-project director…
Browse files Browse the repository at this point in the history
…ies (#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
  • Loading branch information
IT-MikeS authored Sep 26, 2022
1 parent ffd1960 commit 0ab4881
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
12 changes: 11 additions & 1 deletion packages/@ionic/cli/src/lib/integrations/capacitor/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { exec, ExecOptions } from 'child_process';
import { parseArgs } from '@ionic/cli-framework';
import { mkdirp, pathExists } from '@ionic/utils-fs';
import { prettyPath } from '@ionic/utils-terminal';
Expand Down Expand Up @@ -190,7 +191,16 @@ export class Integration extends BaseIntegration<ProjectIntegration> {

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

const output = await this.e.shell.cmdinfo('capacitor', args, { cwd: this.root });
const output = await ((cmd: string, opts: ExecOptions): Promise<string | undefined> => {
return new Promise((resolve, reject) => {
exec(cmd, opts, (error, stdout, stderr) => {
if (error) {
reject();
}
resolve(stdout);
})
})
})(`capacitor ${args.join(' ')}`, { cwd: this.root });

if (!output) {
debug('Could not get config from Capacitor CLI (probably old version)');
Expand Down
5 changes: 3 additions & 2 deletions packages/@ionic/lab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@
"@ionic/cli-framework": "5.1.3",
"@ionic/utils-fs": "3.1.6",
"chalk": "^4.0.0",
"express": "^4.16.2",
"express": "4.16.2",
"tslib": "^2.0.1"
},
"devDependencies": {
"@ionic-internal/ionic-ds": "^2.1.0",
"@stencil/core": "~1.8.5",
"@types/express": "^4.11.0",
"@types/express": "4.11.0",
"@types/express-serve-static-core": "4.11.0",
"@types/node": "~10.17.13",
"lint-staged": "^10.0.2",
"rimraf": "^3.0.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/@ionic/v1-toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"chalk": "^4.0.0",
"chokidar": "^3.0.1",
"debug": "^4.0.0",
"express": "^4.16.2",
"express": "4.16.2",
"gulp": "^4.0.2",
"http-proxy-middleware": "^0.20.0",
"tiny-lr": "^1.1.0",
Expand All @@ -51,7 +51,8 @@
},
"devDependencies": {
"@types/debug": "^4.1.1",
"@types/express": "^4.11.0",
"@types/express": "4.11.0",
"@types/express-serve-static-core": "4.11.0",
"@types/gulp": "^4.0.6",
"@types/http-proxy-middleware": "^0.19.0",
"@types/jest": "^26.0.10",
Expand Down

0 comments on commit 0ab4881

Please sign in to comment.