Allowing for Extensible App Architecture in VueJs - vue.js

I am creating a VueJS app currently that will be open sourced. This app will have a similar internal version as well that includes some differences such as additional features / different auth mechanism etc. I want an architecture where the open source version of the app will be the source of truth. The internal version of the app will extend off the open source app and modify as needed. I am wondering how to achieve this with VueJS with as little code duplication as possible. Ideally, I want to be able to push changes to the open source repo and get updates to the internal version of the app as well.
Note: I have seen examples on the web of this sort of being done with Angular.
The app is split into modules and each module is shipped as an npm module. Then the internal version of the app downloads these modules as npm dependencies and then uses Angular's module system (NgModule) to do code extension.

Related

Creation of SDK in React Native and generate .aar file to integrate with native apps

The main objectve we are looking for is to create an SDK of a react native app by providing an .aar file and giving it it clients so our app can be intgrated in clients (Native) app with minimal configuration and without actual exchange of code from both the ends (excluding some custom files that act aas a ode of communication fbetween client and our app).
I have gone through below articles to achieve the same :-
https://medium.com/#gauravasrivastava89/sdk-development-with-react-native-part-1-46580839eae9
https://medium.com/#jyubinpatel/make-reactnative-module-as-a-library-and-how-its-used-into-android-native-application-35b13f65ac7c
while following the steps from the same iam not able to move past the step where i have to install maven-publish as i cannot find it or it may have been depricated.
Image for Maven-publish
i Need help regrading following 2 usecases.
1.Is there any easier way to generate .aar file without needing clients codebase or if needed with updated libraries and methods.
2.if there is any other approach to fullfill the objective of sharing sdk and including for clients without exposing the code it would be very helpful.

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

React Native adding and remove packages as features or plugin at runtime

I am working on building a modular React Native App for Enterprises in which it requires adding or remove packages as features or plugins (without updating the app). The following shall be a process
An enterprise user shall download and install a base mobile Android/iOS app (build in React Native) in a mobile handset
From the back-end, multiple packages or features (may defer with other enterprises) shall be configured for an enterprise
The multiple pre-built packages/modules shall be kept at a store at the backend
The enterprise user shall automatically get the packages as features in the mobile app using step 1 above, post step 2
I don't have any issue handling and building the backend and react native app. I am struggling that how dynamically adding/removing a package is possible in the existing base mobile app based on backend configuration.
If those packages/features are javascript only you can try codepush. This will allow to change the js bundle runtime. Check out this section: Dynamic Deployment Assignment
However if those packages require native implementation the only solution would be to split your code. This way you would need to ship every package in the apk, but the main bundle will contain only the code of the "base" app and the other code with the additional features would be loaded runtime. This will also bring a huge performance boost.
You can easily control which user sees what by conditionally rendering the screens by a role or whatever.
For code splitting you can check out these repos:
react-native-bundle-splitter or repack

Vue Native: Error when running in browser

I've just created a new "vue native" project. I didn't change anything in the default blank app.
I managed to run it on my android device, but impossible to run it on my browser.
I run "npm start" => "metro bundler" opens.
Then I click on "Run in web browser" and I get the error below :
Again, I didn't change anything. I just want to start the default app generated automatically when starting a new project.
Anyone already faced this problem?
Thank you
"This is a known issue, and it seems running vue-native app in web is not possible at the moment, because AppEntry.js tries to import ../../App. The default packager configuration specifies .json as a valid file extension. For some reason, in web, Expo seems to be looking for App.json and ignores App.vue."
https://github.com/GeekyAnts/vue-native-core/issues/268
See the official statement from vue-native creators 2020 7th of July:
"On iOS and Android, Metro is the only component required in the JS build pipeline. We have a custom transformer (in vue-native-scripts) which Metro uses to convert .vue files into equivalent React Native code, which then effectively gets piped into the default Babel transformer used by Metro (for .js) files.
On web, though, Webpack needs to be used for intermediate transformations so that the code can run on web. Metro is used here too, but not for the transformation.
From my findings, the Expo Webpack config uses the babel-loader for handling .js files. So we'd probably need a custom Webpack loader for .vue files (or maybe some other mechanism which can do the job). My guess is that the transformer exported by vue-native-scripts would help in making a loader. But the loader needs to meet the Webpack loader API requirements and expose raw, pitch etc. as described here. We haven't worked out the details of the implementation yet.On iOS and Android, Metro is the only component required in the JS build pipeline. We have a custom transformer (in vue-native-scripts) which Metro uses to convert .vue files into equivalent React Native code, which then effectively gets piped into the default Babel transformer used by Metro (for .js) files.
On web, though, Webpack needs to be used for intermediate transformations so that the code can run on web. Metro is used here too, but not for the transformation.
From my findings, the Expo Webpack config uses the babel-loader for handling .js files. So we'd probably need a custom Webpack loader for .vue files (or maybe some other mechanism which can do the job). My guess is that the transformer exported by vue-native-scripts would help in making a loader. But the loader needs to meet the Webpack loader API requirements and expose raw, pitch etc. as described here. We haven't worked out the details of the implementation yet."
https://github.com/GeekyAnts/vue-native-core/issues/268#issuecomment-640222479
Good news that devices and on simulator running works with expo, and mostly vue-native was designed to run on mobile devices not on web :)
For the web you can have a similar codebase using vuejs.