Deploy Ionic app with AppFlow in a sub-directory? - ionic4

I have an ionic v4 app that is located in a sub-directory of a much larger mono-repo with various other Angular applications. The mobile app shares some typing files and some services with the other applications.
I was wondering if there is a way to use AppFlow to build the mobile app as a sub-directory of a larger repo or does it need to be it's own repo?

Related

Best way to send source maps to Sentry but keep them off production website and app

I have a Ionic Vue web-based PWA and web-based mobile app. Recently I added Sentry into the mix and used the Sentry webpack plugin to upload source maps to Sentry. Everything works great when the Vue/JavaScript crashes I get the proper line/column info on the error but I noticed on the web-based version of the app that webpack shows the source code for the entire Vue app. I'd like to prevent that.
Here is my workflow: I commit to github main and it kicks off a github action which builds the project and finally deploys to Firebase hosting. I'm thinking I need to have two actions, one for building and sending to Firebase, and another for building and uploading source maps. I also use Ionic AppFlow for deploying to mobile apps (iOS/Android) so I'm thinking I need to prevent AppFlow from building/sending sourcemaps too.
So... how do I do this? Both Github actions and AppFlow see things as "production" mode. And AppFlow doesn't support environment variables at the pay level I'm at. Is there a way to have multiple vue.config.js files I can have?

Nuxt & Capacitor - Unable to add android support

I have a Nuxt 2 app. I'm following the docs to add Capacitor and Android Support.
Everything is fine up to the point of running npx cap add android. The android folder is generated however there are errors in the terminal
√ Adding native android project in android in 342.51ms
√ Syncing Gradle in 944.40μp
√ add in 345.44ms
× copy android - failed!
[error] The web assets directory (.\.nuxt) must contain an index.html file.
It will be the entry point for the web portion of the Capacitor app.
√ Updating Android plugins in 33.68ms
× update android - failed!
[error] Error: ENOENT: no such file or directory, open
'<sourceroot>\android\app\src\main\assets\capacitor.plugins.json'
I’m not running Nuxt in static mode (due to routes and content pulled in dynamically from a CMS). So I run nuxt build which generates the output into a folder named .nuxt by default.
However nuxt build doesn’t create an index.html as an entry point, the nuxt build actually states Entrypoint app = server.js server.js.map. Hence the error above where it can’t find index.html in the .nuxt directory.
Does anyone know a way to resolve this? Or have implemented Capacitor with a Nuxt SPA?
I’ve found resources when using nuxt generate for a static app but not nuxt build for a spa like in my case.
I have a Nuxt2 web app with servers (app server and separate API server), also deployed as an Android app on the Play Store (in alpha testing). Both app flavours look and behave identical and use the same API server, as I desire.
IMHO, in the lifetime of your (universal) app, BOTH build and generate will get leveraged:
build, likely by whatever web app host you use (ie AWS, Heroku, etc), during deployment of the web app.
generate by yourself, when you're ready to submit to the app stores (Apple, Google, etc), making use of Capacitor.
Let's say you have a new feature to add to the app. On that day, you make git commits and increment your version number and when you're ready to deploy the update...
For the web app...
Make commit(s) and version number change
Deploy to your app host, which for most people, will also run the build step for you
The only time I ever run build locally is when I need to make final tests, troubleshoot bugs or make optimizations (e.g. lower final package size).
For the Android or iOS apps...
Make commit(s) and version number change
nuxt generate
Run Capacitor sync (however which way you do it (for me I use: npx cap sync)
Prepare the app store build & submit (however which way you do it)
What nuxt generate does for you, and what Capacitor needs, is a fully rendered snapshot of all your app views together, all at once. It's the equivalent of a web app user opening all your app's views all at once (e.g. 50 browser tabs), pulling all components/styles/etc into their local browser. This fully rendered app state ultimately gets bundled and is what will get submitted to the app store(s).
In Nuxt docs and terminal output, they seem to strongly suggest that if you're using nuxt generate, that you want to be using target: static, however I will say you should completely ignore this advice. Static is what you'd consider if you had a "brochureware" website or some recipe book app that you update once-in-awhile. It goes as far as in the terminal output of nuxt generate, even if I have target: server defined, you'll still see a line saying something along the lines of "Outputting for target static...". Just ignore it.
There is hardly anything static about a typical universal web app.
I personally use target: server with nuxt generate and I haven't seen any problems in the app (web or Android version).

How to fix optimazition error publish in play store

my apk is 1.4MB but error is "This APK results in unused code and resources being sent to users. Your app could be smaller if you used the Android App Bundle. By not optimizing your app for device configurations, your app is larger to download and install on users' devices than it needs to be. Larger apps see lower install success rates and take up storage on users' devices."
how to fix this error
It's only a warning, not an error.
For an app that small I wouldn't worry.
It's not something that's made its way into the Ionic ecosystem yet but I heard that if you open up your project in Android Studio and then do the build through there you can create an app bundle.
I'm not totally sure that its fully tested for Ionic so you might have issues with this, but Android have published a full guide:
https://developer.android.com/guide/app-bundle#get_started
This is what they say:
Download Android Studio 3.2 or higher—it's the easiest way
to add dynamic feature modules and build app bundles.
Add support for Dynamic Delivery
by including a base module, organizing code and resources for configuration
APKs, and, optionally, adding dynamic feature modules.
Build an Android App Bundle using Android Studio.
If you're not using the IDE, you can instead build an app bundle from the
command line.
Test your Android App Bundle by using it to generate APKs that
you deploy to a device.
Enroll into app signing by Google Play.
Otherwise, you can't upload your app bundle to the Play Console.
Publish your app bundle to Google Play.

Expo release channels and project folder

I am using Expo’s managed workflow. My app uses google authentication to sign in. During development I was using the Expo client for android and as per the docs I used 'Expo.Google' to achieve google authentication and it worked as intended.
After developing the app, I built a staging version of my app (standalone app) by typing 'expo build:android -t apk --release-channel staging-v1' in my project directory. After the build was finished, I downloaded and installed the apk on my android phone. Only then I realized that I didn’t change 'Expo.Google' to 'GoogleSignIn' which is required for standalone apps.
I can change that in my project files and then publish it to the staging-v1 channel. I think this would make google authentication work in the standalone app but it would also change my project files and then it won’t work in the Expo client. So, do I need to create and maintain two different project folders which would basically be the same except for the google authentication part? In general, how should I manage the channels and the corresponding project files?

Integrate Ionic Sass Customization in IBM Worklight

I want to integrate Ionic Sass Customization in IBM Worklight hybrid mobile application. can any one help , Not sure what are the dependencies to make this work. Ionic is really cool in customization of themes in IONIC Mobile Apps.
http://learn.ionicframework.com/videos/sass/
Thanks in advance.
Because Worklight/MFP does not support the Cordova CLI and Ionic deeply integrates their CLI with the Cordova CLI, the approach I believe you should take is:
Create a skeleton app in Worklight Studio, integrated with Ionic. You can look at the Starter Application (for MFP 6.3), that also has a version using Ionic.
Once you have that, you'll need to create an app purely with Ionic, and create the theme you like the most
Then you need to copy over the CSS files or their contents, whatever, to the Worklight/MFP project and manually integrate the two (references in the HEAD or the contents injected into the CSS files
Not a nice approach, but since there is no Worklight > Cordova CLI integrate, the process is not nice.