react-native-dotenv doesn't work with EAS builds - react-native

We used dotenv lib with classic builds and it worked fine providing a possibility to manage different environments. But it stopped working when we moved to EAS builds.
What are possible solutions?

I tried to replace dotenv with a combination of direnv tool and EAS secrets but then I accidentally found this file in Expo github repo. It seems like creating .easignore file copying .gitignore file excluding env files makes dotenv work with EAS.

react-native-dotenv maintainer here. Be careful NOT to commit .env to git. This is a major security risk. .env files are in .gitignore for a very good reason. Instead, the EAS documentation says :
To create app-specific secrets, navigate to the "Secrets" tab in your project dashboard.

Related

.env variables working on expo published app but not from google play build

My app is working properly locally and also from the QR code on the Expo published app page.
On my production build on Google Play though, the .env files are undefined and not loading at all (I am using dotenv-react-native).
This may be due to the fact that my .env file was in .gitignore while I was building my first android build? I updated it with an OTA update after by creating a .easignore file and excluding the .env file. Does it not work with OTA updates? Do I need to rebuild the application or is it some other issue?

Npm Install Strapi to existing NextJS project

I'm new to React, NextJS, and Npm, I recently created a Next app using this command:
npx create-next-app#latest
And now I want to add Strapi to the same project. I used this command to install Strapi:
npx create-strapi-app#latest my-project --quickstart
Using this command, it will create a new project, for Strapi.
I see that the Next and the Strapi projects share a lot of files, such as the files in the node_modules folder. Is there a way to have those in the same project? or would that make a mess?
I came to the conclusion that having those two apps on two different directories, with each having their own config files, and other modules, is the right way. We will end up with a lot of files and folders that exist in both apps, but it is simply best that we isolate these two apps from each other completely, because:
They have different config files, in most of the folders.
they are two different apps, Stapi being the backend api and the admin dashboard, and the Nextjs app being the rest of the website.
If those two apps were combined, we would end up with a directory-structure that would be very hard to work with.
In a larger project we might have more api or apps that run independently, and it's best to have those on different directories and ports. And having some duplicate files across all the apps, wouldn't affect performance, and wouldn't take much storage.

How to make pod install ignore linked lib internal node_modules in react native?

I'm writing an internal UI library here.
I'm using react-native-builder-bob and it works great, I can test my components in the example folder/app and focus on the library development, but when I link the lib into my-app (yarn link && cd ../my-app/ && yarn link my-lib) and run a pod install (cd ios && pod install), the dependencies from the example app end up in my-app podfile.lock like this:
EXSplashScreen:
:path: "../node_modules/my-library/example/node_modules/expo-splash-screen/ios"
I'm not ok with it ending up as a direct dependency. And I'm definitely not OK with it breaking my app on launch (my app doesn't use expo) because I don't even invoque any of expo stuff.
So, how can I make sure that I can develop and test things in both projects (example and my-app) without one interfering into each other?
I know I can:
delete example node modules when writing my-app code: but I don't want to do that.
pack the lib with yarn pack, extract the tar contents and link that instead (it doesn't include the example folder)... but it's somehow weird
make the Podfile RN script ignore the example folder.. but I don't know how to do it, and will it work for android?
Edit:
About the option 3, it seems that the script that includes sub folders is the react-native-unimodules cocoapods.rb one, it fetches all packages that have unimodules.json
It's not a direct dependency. Unfortunately npm link/yarn link doesn't have the same behavior as a published package. It's also intended for development and not for consuming the package in an app.
To have the proper behavior, you need to publish the package to a registry and consume it from there. The example isn't uploaded when publishing.
To test this behavior locally you can:
Use something like https://verdaccio.org/ for a local NPM server
Run npm pack to create a tgz package that you can install with yarn install /path/to/file

What's the proper way to publish an electron app into Nexus

I have an electron app that needs to run on multiple architectures.
I use electron-packager to make a distribution folder.
I originally tried to npm publish this folder to a nexus repo.
npm publish strips the node_modules out of the built app which would make it break. As far as I can tell, there is no way to stop it from doing so.
Does anyone know the path I should be taking?
I am new to electron AND nexus so take my analysis with a grain of salt

Automating npm and webpack with Phonegap build

I'm building a PhoneGap app with PhoneGap build. I'd like to sync the app with my Git repository at BitBucket. The problem is that I ignore the files that are in my node_modules folder and the dist files that are generated by WebPack. So I want to automatically run an npm install and webpack before PhoneGap builds the app.
I have looked into hooks, and they seem like exactly what I need. However, I can't seem to get them to work. For example, I made a folder hooks/before_build and placed a test script in there that just echos back the word "test". But I don't see the output of that anywhere in the build log. I also added it specifically to my config.xml without any output.
It seems unusual that I haven't been able to find anywhere that explains this, but I can't seem to find anywhere.
Could anyone share how they have their build system set up, or provide relevant links?