ionic-team / ionic-team/ionic-cli

bug: multi-app doesn't properly configure capacitor.config.json per project

Open
#4,656 1 comment 0 reactions 0 assignees View on GitHub
triage
Dominant language
TypeScript
Stars
2k
Forks
682
PR merge metrics
No merged PRs in 30d

Description

**Description:**
Establishing a multi-app project structure, such as for a monorepo, creates a root `capacitor.config.json` file in addition to `capacitor.config.json` files in each project's directory. However, only the `capacitor.config.json` file at the root of the repository contains all required Capacitor configuration options. The `capacitor.config.json` files within each project's directory contains only the `appName` property.

**Steps to Reproduce:**

```bash
mkdir sample-monorepo && cd ./sample-monorepo
npx lerna init
ionic init --multi-app
cd ./packages
ionic start app1 blank --type=react
ionic start app2 blank --type=react --no-deps
```

Output Files:

- Root folder: [capacitor.config.json](https://github.com/ehorodyski-ionic/cap-react-lerna-monorepo/commit/71caf0c1a2254331494578d775bc85865d3e59cc#diff-ec2b53f1220a8bca613b0f050e250e7869ef60b2c5bc3de7cbb55f98ad0999f4)
- App One: "Employee App” [capacitor.config.json](https://github.com/ehorodyski-ionic/cap-react-lerna-monorepo/commit/71caf0c1a2254331494578d775bc85865d3e59cc#diff-20154324b00f53761b4f9f7e6516f198c974f08a00a33a359794ec73f8e7f779)
- App Two: "Customer App" [capacitor.config.json](https://github.com/ehorodyski-ionic/cap-react-lerna-monorepo/commit/71caf0c1a2254331494578d775bc85865d3e59cc#diff-b88ec38539bf156f5409fe61c9accba12cc62f1c8620b69d6cad2469e7b57ea6)

**Output:**

**My `ionic info`:**

```
[WARN] Multi-app workspace detected, but cannot determine which project to use.

Please set a defaultProject in ./ionic.config.json or specify the project
using the global --project option. Read the documentation[1] for more
information.

[1]: https://ion.link/multi-app-docs

Ionic:

Ionic CLI : 6.13.1 (/Users/eric/npm-global/lib/node_modules/@ionic/cli)

Utility:

cordova-res (update available: 0.15.3) : 0.15.2
native-run (update available: 1.3.0) : 1.2.2

System:

NodeJS : v14.15.1 (/usr/local/bin/node)
npm : 6.14.11
OS : macOS Big Sur
```

**Other Information:**

This can be resolved by copy & pasting the root config to each project's `capacitor.config.json` file and modifying the package name and bundle. It is unknown if this root config file serves a purpose however.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.