Closed imhoffd closed 5 years ago
Has this been documented?
@ehorodyski Not yet, but subscribe to this issue for updates.
@dwieeb Hi, when will any updates?
👋
I added some docs for multi-app here: https://beta.ionicframework.com/docs/cli/configuration#multi-app-projects
Please feel free to provide any feedback! I tried to keep it framework-agnostic. Additional configuration is necessary for Angular. I think these are the best docs they have for that: https://github.com/angular/angular-cli/wiki/stories-multiple-projects
It's a new feature for both Ionic and Angular, so there isn't much documentation/tutorials out there yet.
EDIT: you will need Ionic CLI 4.3.0+
@dwieeb thanks for this. I've been looking forward to it. Suggestions I would have would be:
Clarify the initial app starting process. Do you still create the initial app with the ionic-cli? Do you pass any special parameters when doing so? Manually create your ionic.config.json?
Are the lib and apps folders created automatically with ionic-cli, angular-cli, or manually? In the example folder structure photo under https://beta.ionicframework.com/docs/cli/configuration#multi-app-config-file, apps is under src, but in the code example under https://beta.ionicframework.com/docs/cli/configuration#adding-an-app-to-a-multi-app-project it would appear that the apps folder is a direct child of the root project folder.
It's a great start, I think just a little more documentation and clarification would get things going down a smooth path.
@travismarx Thanks for the feedback! 👍 Yeah it's certainly not a smooth process yet. In fact, I found a bug while writing the setup steps, which should clear up some things.
It would be nice to know the process needed to have a monorepo with both ionic and angular apps with shared components/services/pojos.
@davl3232 You might check my feedback / POC on this topic here: https://medium.com/agorapulse-stories/sharing-ngrx-based-logic-between-angular5-web-app-and-ionic3-mobile-app-77c19470cccc
I've recently upgraded the demo repo to Angular6 and Ionic4 with the multi-app projects config for Ionic: https://github.com/benorama/ngrx-demo-workspace
You might also check https://nstudio.io/xplat/
Thank you @benorama!
using ionic g service services/data-feed --project=benight-admin
got this =>
> ng generate service services/data-feed --project=benight-admin
Two or more projects are using identical roots. Unable to determine project using current working directory. Using default workspace project instead.
so it would be nice to give --project support to @ionic/schematics-angular
aswell
@idanzapp That specific error looks like an issue with your angular.json
configuration, but there are quite a few improvements we need to make to properly handle generate
for multi-app projects.
Just created a few issues that people can subscribe to if they like:
thanks @dwieeb ill stay tunned, i know the warning is due to my angular.json, but im sharing tsconfig.json, theme, and enviroments through 3 apps, and i had to do some weird stuff in order to get paths on tsconfig working
I don't think the docs are correct.
If a multi-app project is detected during ionic start, the CLI will add the app configuration to the root ionic.config.json file instead of creating a project-specific one.
However, if I create a basic ionic.config.json
with the following contents, and run ionic start
, no projects are added to the existing config in the root, but instead a new one is created in a sub-folder.
{
"projects": {}
}
Seems like it's a chicken-egg problem. To create a multi-app project, one needs to have already filled in the config with dummy data, otherwise ionic-cli
won't detect the multi-app setup. Simply having "projects": {}
is not sufficient.
This should be clarified in the docs somehow. Likely, the way the tools works should be updated too. The ionic start
script should be able to run without any project currently loaded (as there might be none).
Thanks @Binero! I just pushed a fix for that. It will be included in CLI 4.4.0 (probably will be released tomorrow).
CLI 4.4.0 is out!
I'm gonna consider this issue resolved.
Please follow these issues for updates about multi-app re: ionic generate
:
See https://github.com/ionic-team/ionic-cli/issues/3281