ionic-team / ionic-team/ionic-cli
ionic/cli commands in a (react based) monorepo aren't working consistently
- Ngôn ngữ chính
- TypeScript
- Star
- 2k
- Fork
- 682
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
**Description:**
ionic cli commands in a (react based) monorepo aren't working consistently.
**Steps to Reproduce:**
As per instructions, I've defined the `ionic.config.json` file at the root of my (Nx) monorepo, which has the following structure:
```
apps/
-- myapp/
dist/
-- apps/
-- myapp/
libs/
node_modules/
ionic.config.json
package.json
```
This is `ionic.config.json`:
```
{
"defaultProject": "myapp",
"projects": {
"reactr": {
"name": "myapp",
"integrations": {
"capacitor": {}
},
"type": "react",
"root": "apps/myapp"
}
}
}
```
Issues:
1. ionic cli searches the app root for custom build scripts
`ionic serve` doesn't work, as I'm not using react-scripts. Fine.
I tried adding `"ionic:serve": "npm start"` to my root `package.json` to no avail. I had to create `apps/myapp/package.json` and add the scripts there. Not too bad, but not intuitive and it tooks some trial & error.
2. `ionic cap` commands searches the app root for node_modules!
ionic capacitor is searched in `apps/myapp/node_modules/` instead of the root `node_modules`, so I've had to also add `@capacitor/core` and `@capacitor/cli` to `apps/myapp/package.json`, effectively duplicating these dependencies (in monorepos you want only 1 node_modules usually).
3. `ionic cap open ` must be launched in the app root
While ionic serve/build work from the monorepo root, ionic cap must be launched from the app's root, despite having specified the app's root in ionic.config.json
**My `ionic info`:**
```
Ionic:
Ionic CLI : 6.19.0 (C:\Users\andre\AppData\Roaming\nvm\v14.18.3\node_modules\@ionic\cli)
Ionic Framework : @ionic/react 6.0.11 (C:\Users\andre\Code\reac-tr\node_modules\@ionic\react)
Capacitor:
Capacitor CLI : 3.4.3
@capacitor/android : 3.4.3
@capacitor/core : 3.4.3
@capacitor/ios : 3.4.3
Utility:
cordova-res : 0.15.4
native-run : 1.5.0
System:
NodeJS : v14.18.3 (C:\Program Files\nodejs\node.exe)
npm : 6.14.15
OS : Windows 10
```
**Other Information:**
Nx monorepo with a react app
Hướng dẫn đóng góp
Hướng nghiên cứu
Start by reproducing the three reported behaviors from the Nx monorepo root using ionic.config.json, the root package.json, and apps/myapp/package.json. Compare ionic serve/build with ionic cap commands and verify whether the configured app root and root node_modules are handled consistently; done means the documented commands work from the monorepo root without duplicated dependencies.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- react, typescript
- Lĩnh vực
- cli, tooling
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100