How to prevent Vercel preview builds? - vercel

How to prevent preview builds other than production branch in Vercel?
I am wondering how to prevent builds other than the production branch because I am getting too many builds in one push because I am using monorepo.

Related

Does Expo EAS build command update previously released app?

I have built production app with EAS Build and published to app stores.
Build versions uses channel production which is linked to branch production
I want to build new version, download it and publish via store in "traditional way" so I build new production app on channel production.
What will happen with the app already installed on users devices? Will expo build add new update to branch production so users will download the update just after build finishes?
Or old app version will not receive an update and new version will be available only after app store review?
Thanks for clarify!
Edit:
As I found here it depends on runtime version. If the same runtime version is specified, update will be applied to installed apps.

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 deploy codespush bundle on old targets when there are native changes on the new build

Before i continue, let me let you know that i know the code to deply to a targeted build for codepush
appcenter codepush release-react -a aountName/appName -d Production -m --description "CommentHere" -t versionName
I have tried to figure this out on my own and i have not been able to.
I have several versions of my app which i have deploy using CodePush and everything works well but I started having fears of crashes when i installed new packages on the latest build.
This implies the current code base would have new native differences as compaird to the old version.
The question is how can i deploy my new build with new native codes
and packages present to an old version of my app which does not have those
native packages without running into several crashes from all the users using the old version of the app...
I ask this cos i have a feeling if i push the new build with the new changes in UI and native chnages to the old version of my app, the app old app would crash.
If a bug comes in for an old version, how do I fix it and deploy it
for the old version only? Bugs may be critical and not everyone will
have the latest version of the app Or, the bug may only exist on a old
version of the app.
I await your response.
Code push will not affect any native code written within the Android or the iOS projects of a React-Native application. If you read the documentations carefully, it specifically says that it does not change / modify / update the native portion of the app.
Why?
This is because of the way the CodePush mechanism works. In essence, CodePush only stores and triggers the update of the JS bundle of the React-Native application.
This is why we wrap only the JS main app instance with CodePush HOC (Higher Order Component). This is what's happening when you do:
CodePush(MyApp); //wrapping the js bundle at app-root
So, unfortunately in your case, if there are native codes involved, regardless of deployment to a new or old version of the app, it has to be a AppStore / Playstore driven deployment.

Running two Expo Release Channels on the same device?

I have a testing and production release channel, on TestFlight and the App Store, respectively. I want the ability to run both on the same device. Otherwise if there is an issue with my testing release channel me and my beta users are blocked from using the working production channel (as least without constantly downloading and overwriting the TestFlight vs App Store versions)
I tried https://medium.com/#ywongcode/building-multiple-versions-of-a-react-native-app-4361252ddde5, but it seems like most of the configurations were reverted on build, and I wound up with the same bundleIdentifier and therefore I could not download the TestFlight testing version without removing the App Store version.
I think your best bet is to release multiple apps from 1 source code. We ran into this problem as well and ended up releasing separate test (internal testing), beta (external testing) and production apps. Each with their own app logo, app name and expo release channel. As far as I know, there is no way to switch release channel after your app has been built.
Alternatively you could (beta) test your app by pointing your users to https://exp.host/#username/yourApp?release-channel=. This way your testers can test most of your app’s functionally in the Expo Go app.
You can use iOS Build Configurations and Android Build Variants to easily create different apps within one project.

How to publish and keep multiple versions of an React Native app installed?

I am in need of advice of how to deal with something:
I have an app that will soon be published to App Store and Google Play, I would like to find a way to have a clone of this app with less features, this clone is meant to give a taste of the app for users and also for the salesman of the company to demonstrate it, also I would like to keep both apps installed in the same device, so in the case of the salesman, they could demonstrate with this "demo app" and also use the real app for their own purposes.
I know that I could just have a beta user group on TestFlight and Google Play but that would need me to register those users or give them a link to register as beta and would not be possible to have both apps installed.
I want to make this "demonstration app" to be downloadable from the stores, it would have different API calls from the real app, different icon, etc...
but I would like to avoid having to maintain and copying every change from the "production" app to the "demo" app.
The option I thought: create a branch and rename the app to the new signature, name, icons and so I will just have to always pull the diff from the origin/master branch and publish it on the stores, but it didn't worked, since xcode breaks the app and give me random errors when I do it.
I would appreciate to receive ideas and workarounds for this.
I can currently have four different versions of an app I developed installed. The solution for this really depends on your setup, but here is currently how I do it1. It is not the only way but it works for me and I find the issues that this setup causes so small that it doesn't really bother me.
iOS
The simplest solution for iOS is to have different Bundle Identifiers. This requires you to have different provisioning profiles. One provisioning profile for each development environment (if you want to put them on device for testing away from the development machine they need to be distribution profiles) and one profile for submission to the App Store.
Xcode has the ability to manage different environments with different provisioning profiles, however this caused me major issues when using CocoaPods and I ended up having to stop Xcode from managing it.
What I do now is I add a script to my workflow2 that forces the correct Bundle Identifier for the environment. If I want to build locally, I just manually change the Bundle Identifier and the provisioning profile (it only takes a second)
Android
For Android I use the built in flavors to manage the different environments. It is really easy to set up. in my app/build.gradle I added the following:
flavorDimensions "version"
productFlavors {
dev {
dimension "version"
applicationIdSuffix ".dev"
}
uat {
dimension "version"
applicationIdSuffix ".uat"
}
staging {
dimension "version"
applicationIdSuffix ".staging"
}
prod {
dimension "version"
applicationIdSuffix ".prod"
}
}
This adds a applicationIdSuffix to your builds which means that you can install multiple types on to your device. Using flavors is a really powerful way to manage your android applications. You can read more about using flavors here
One important point to note is that using flavors does change how you have to run your application.
Instead of using react-native run-android I now have to use react-native run-android --variant=devDebug.
When I want to build it instead of using ./gradlew assembleRelease, I have to use ./gradlew assembledevRelease (you have to change this for each flavor that you use)
There is also a small bug with react-native that when using the --variant flag it doesn't launch the app, so you just have to click on the icon on the device. But if you launch it from Android Studio it launches just fine.
So if you launch your application from Android Studio, or add the appropriate scripts to your package.json these issues melt away.
1 I don't use Expo for my production applications, only for prototyping, so these solutions are for full react-native applications with access to native code.
2 I use Bitrise to build my apps so it is easy to add bash scripts or similar to the build process.
If you want them to download the apps from stores then apps have to have different package/applicationIDs.
I've worked on a react native project recently and we actually handled staging and production apps in single branch. Although we didn't release staging app on play store, we were sharing using Google drive and since both app had different packages, it was possible to install both of them together.
To change the applicationId, you need to make changes in app's build.gradle file in Android. Simply add .demo or .anything at the end of your production applicationId. And also change your api end point and App name and icons if you'd like. So this becomes cumbersome doing manually after sometime because you have to change back and forth. So we wrote a shell script to make all these changes before building the apk.
We actually didn't need to install 2 versions on iPhone, so we didn't do anything about it. Also I'm not familiar with iOS development but I guess process will be somewhat similar.
Now we don't have to keep track of changes from one branch to another. Setup(Shell scripts) will take some but it will be worth it.