ionic-team / ionic-docs

https://ionicframework.com/docs
Apache License 2.0
592 stars 3.03k forks source link

Document multi-app config #83

Closed imhoffd closed 5 years ago

imhoffd commented 6 years ago

See https://github.com/ionic-team/ionic-cli/issues/3281

ehorodyski commented 6 years ago

Has this been documented?

imhoffd commented 6 years ago

@ehorodyski Not yet, but subscribe to this issue for updates.

vadost commented 6 years ago

@dwieeb Hi, when will any updates?

imhoffd commented 6 years ago

👋

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+

travismarx commented 6 years ago

@dwieeb thanks for this. I've been looking forward to it. Suggestions I would have would be:

It's a great start, I think just a little more documentation and clarification would get things going down a smooth path.

imhoffd commented 6 years ago

@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.

davl3232 commented 6 years ago

It would be nice to know the process needed to have a monorepo with both ionic and angular apps with shared components/services/pojos.

benorama commented 6 years ago

@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/

davl3232 commented 6 years ago

Thank you @benorama!

idanzapp commented 6 years ago

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

imhoffd commented 6 years ago

@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:

idanzapp commented 6 years ago

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

Binero commented 6 years ago

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": {}
}
Binero commented 6 years ago

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).

imhoffd commented 6 years ago

Thanks @Binero! I just pushed a fix for that. It will be included in CLI 4.4.0 (probably will be released tomorrow).

imhoffd commented 6 years ago

CLI 4.4.0 is out!

imhoffd commented 5 years ago

I'm gonna consider this issue resolved.

Please follow these issues for updates about multi-app re: ionic generate: