-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-app projects config #3281
Comments
…gle workspace. Related ionic-team#3281 Adding `--project` support for almost every Ionic command. Create an `ionic.json` config in project root. This closely mirrors `angular.json` but doesn't depend on it. ``` { "defaultProject": "app", "projects": { "app": { "name": "Ionic App", "type": "angular", "integrations": { "cordova": { "root": "cordova" } }, "hooks": {} } } } ``` Example commands ``` # With project name ionic cordova platform add android --project app # With defaultProject ionic cordova platform add android # Other commands ionic cordova resources --project app ionic cordova plugin add cordova-plugin-splashscreen --project app ionic cordova build --project app ionic cordova run --project app ionic cordova emulate --project app ionic cordova requirements --project app ionic cordova prepare --project app ```
…. Related ionic-team#3281 Adding `--project` support for almost every Ionic command. Create an `ionic.json` config in project root. This closely mirrors `angular.json` but doesn't depend on it. ``` { "defaultProject": "app", "projects": { "app": { "name": "Ionic App", "type": "angular", "integrations": { "cordova": { "root": "cordova" } }, "hooks": {} } } } ``` Example commands ``` # With project name ionic cordova platform add android --project app # With defaultProject ionic cordova platform add android # Other commands ionic cordova resources --project app ionic cordova plugin add cordova-plugin-splashscreen --project app ionic cordova build --project app ionic cordova run --project app ionic cordova emulate --project app ionic cordova requirements --project app ionic cordova prepare --project app ```
Working on a proof of concept that should enable support for multi-app workspaces by adding additional configuration to Constraints:
Case Study: {
"defaultProject": "first-app",
"projects": {
"first-app": {
"type": "angular",
"integrations": {
"cordova": {
"root": "integrations/first-app/cordova"
}
}
},
"second-app": {
"type": "angular",
"integrations": {
"cordova": {
"root": "integrations/second-app/cordova"
},
"capacitor": {
"platforms": {
"electron": {
"root": "integrations/second-app/electron"
}
}
}
}
}
}
} And the following extract from {
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "",
"projects": {
"first-app": {
"root": "projects/first-app/"
},
"second-app": {
"root": "projects/second-app/"
}
}
} We can produce the following directory structure:
When running Ionic commands, the The With this configuration and directory structure in place, we can now run some commands: Generate resources for the second app
Add platform for the second app
Build the first app (via ng-toolkit)
And so on... Existing Apps: To migrate an existing app to the new configuration schema: {
"defaultProject": "app",
"projects": {
"app": { ...yourCurrentConfig }
}
} Other considerations:
|
Yep, Cordova config would need to be stored in separate |
…. Related ionic-team#3281 Adding `--project` support for almost every Ionic command. Create an `ionic.json` config in project root. This closely mirrors `angular.json` but doesn't depend on it. ``` { "defaultProject": "app", "projects": { "app": { "name": "Ionic App", "type": "angular", "integrations": { "cordova": { "root": "cordova" } }, "hooks": {} } } } ``` Example commands ``` # With project name ionic cordova platform add android --project app # With defaultProject ionic cordova platform add android # Other commands ionic cordova resources --project app ionic cordova plugin add cordova-plugin-splashscreen --project app ionic cordova build --project app ionic cordova run --project app ionic cordova emulate --project app ionic cordova requirements --project app ionic cordova prepare --project app ```
* wip: proof of concept for running multiple apps in a single workspace. Related #3281 Adding `--project` support for almost every Ionic command. Create an `ionic.json` config in project root. This closely mirrors `angular.json` but doesn't depend on it. ``` { "defaultProject": "app", "projects": { "app": { "name": "Ionic App", "type": "angular", "integrations": { "cordova": { "root": "cordova" } }, "hooks": {} } } } ``` Example commands ``` # With project name ionic cordova platform add android --project app # With defaultProject ionic cordova platform add android # Other commands ionic cordova resources --project app ionic cordova plugin add cordova-plugin-splashscreen --project app ionic cordova build --project app ionic cordova run --project app ionic cordova emulate --project app ionic cordova requirements --project app ionic cordova prepare --project app ``` * refactor: adapt multi app workspace to single app config By treating each "project" as its own self-contained ionic configuration within "projects" we can reuse most of the existing command logic. * fix: start and config commands * refactor: clean up code and pass cwd to shell commands * fix: syntax and runtime errors * fix: throw exceptions when trying to use unknown project name * fix: throw exceptions more reliably when project type cannot be detected * feat(ng-toolkit): pass through cordova base path to ng cli * test: add a few more tests
Hi all! 👋 Ionic 4 was released! (see the announcement on our blog) But, I still have to write some documentation about a multi-app config for CLI 4. We wanted to make the experience for single-app repos solid first. Please be patient, and thanks for subscribing to this issue for updates! 📝 One bonus: with this, we can also document how to modify |
Moving to ionic-team/ionic-docs#83 |
Just want to thank you guys for the awesome stuff! |
Branching off main issue re: project structure configurability: #2232
We can add support in the Ionic CLI for multi-app projects.
@PoiScript summed it up nicely:
These multi-app projects are typically in the shape of monorepos which have multiple apps and libraries.
angular
. This means a sharedangular.json
at the root of the monorepo.angular.json
. Not a big deal, but it would need to be deletedThe builders in ng-toolkit were built with Angular 6 tooling, so they support any project structure that the Angular CLI does. The issue is how do we map
ionic serve
and related project commands to the requested project such that Ionic and Angular know which project to use.These commands already have a
--project
and--configuration
option to configure which map to configuration withinangular.json
. I think all we need to do is readangular.json
, use the key from--project
and find the projectroot
and then look forionic.config.json
inside the specified directory.cc @stupidawesome
The text was updated successfully, but these errors were encountered: