Appearance
Getting Started
This plugin configures Ionic and Capacitor for an Angular application.
Install Plugin
INFO
This plugin configures an already existing Angular application.
Please, visit the Nx documentation to generate an application before continuing.
bash
npm install @nxext/ionic-angular --save-dev
Add Ionic-angular to a new Project
- Optional generate the new project : Nx doc
nx g @nx/angular:application my-app --directory=apps/my-app
- Now, change the configuration of the app, to support ionic-angular: Nxext doc
nx g @nxext/ionic-angular:configuration my-app
Capacitor
Running the configuration generator will set up the Capacitor CLI by
- Adding new targets inside your
project.json
.
These targets let you interact with the Capacitor CLI.
See the related documentation for more details.
Add Capacitor to an existing project
- Follow the step
1.
and2.
as they are required.
This library isn't ment to replace@nx/angular
but just to add an additional logic - Now, every
@capacitor
module will have to be declared inside the newly createdpackage.json
like follow
jsonc
// ./apps/my-app/package.json
{
"name": "my-app",
"devDependencies": {
"@capacitor/android": "../../node_modules/@capacitor/android",
"@capacitor/app": "../../node_modules/@capacitor/app",
"@capacitor/cli": "../../node_modules/@capacitor/cli",
"@capacitor/core": "../../node_modules/@capacitor/core",
"@capacitor/ios": "../../node_modules/@capacitor/ios",
// Example of a new capacitor plugin
"@capacitor-community/apple-sign-in": "../../node_modules/@capacitor-community/apple-sign-in",
"@capacitor/camera": "../../node_modules/@capacitor/camera"
}
}
Add Native Platforms
- Add the native
android
andios
platforms
nx run my-app:add:ios
nx run my-app:add:android
Sync Native Platform
- Running the sync command will update the native platform dependencies and copy a build of your frontend project to the Capacitor project:
nx run my-app:sync:ios
nx run my-app:sync:android
Additional: Podfile
- You may want to, (re)init your Podfile
a. Open themy-app/ios/App
folder in your terminal b. Runpod install
Open Native platform
- Finally, you can open the native platform in it's respective IDE:
nx run my-app:open:ios
nx run my-app:open:android
Migrate from non nx repo
- Follow steps
1. - 3.
- Copy your code inside your project
- Follow by the step
4.
then8. - 11.
Should be now working, open an issue in case you encounter any errors