react-native set ENVFILE file for builds / archives - xcode

I'm really confused about production / development builds in react-native. I can get my app working on both iOS and Android by using the package scripts in the terminal
ENVFILE='/path/to/.env' react-native run-ios
ENVFILE='/path/to/.env' react-native run-android
Thats great for running my app locally, but how do I run this command when creating archives through xcode?
I successfully installed react-native-config and I have the variables I need in the JS and native files, its just the final step of using this is prod or staging builds for devices.
I've managed to create fastlane scripts that build and deploy my app (and I can reference my .env vars in fastlane scripts) but that still doesn't bundle my app with the .env vars inside. Its probably something obvious but i'm not understanding the concept at all.
Ive been referencing this tutorial here, and noticing the part about adding a pre-script to each Scheme in xcode:
".env" > /tmp/envfile
But I dont know what the current working directory on that script is, and Im using yarn workspaces so my node_modules folder is not at the root of the RN project (doesnt that even matter?). I've tried multiple paths to my .env from here but nothing works, but I also dont know how to test this script.

I've successfully gotten it to work using Fastlane. I followed this guide for the Fastlane setup:
https://github.com/thecodingmachine/react-native-boilerplate/blob/master/documentation/docs/3_Guides/BetaBuild.md
After following the guide, I moved the Fastlane directory to the root of the project (and updated all paths).
And after that added the ENV variable when running the command, for example: ENVFILE=.env.beta fastlane ios, which is easy to add as a script in package.json.
It's also possible to use the dotenv feature in Fastlane, see https://github.com/fastlane/fastlane/issues/13494#issuecomment-428941643.
Bottom line is that Fastlane will use the environment variable when running the packager, meaning that react-native-config will successfully pick it up and use the proper env-file.

Related

poetry on heroku: can't find (any!) modules after many tries

I'm trying to move to poetry as a system for python virtual environments, but I've never deployed it to heroku before, and am having no luck at all.
I've tried this now with two different fresh poetry projects, and two different fresh git repositories. I:
create a fresh poetry project
initialize it as a git repo
add all the relevant libraries (poetry add flask gunicorn etc)
add the SINGLE file that holds the entire app, and push it to heroku, which is configured with the poetry buildpack from https://elements.heroku.com/buildpacks/moneymeets/python-poetry-buildpack
When I try to run the file directly, my Procfile is "web: python project/website.py", I get "ModuleNotFoundError: No module named 'flask'" (which is imported in the first line of the file)
When I try to run the file indirectly (because maybe it makes a difference?) my Procfile is "web: gunicorn wsgi:app", I get "bash: gunicorn: command not found"
I am absolutely certain that the pyproject.toml is up to date, and have manually verified that the requirements.txt file it produces contains both flask, and gunicorn, by looking at the build files on the heroku server with "heroku run bash"
I have tried resetting the heroku cache, manually creating requirements.txt before build, emptying, and then re-filling requirements.txt, and other things I'm sure too. I get one of these two errors, every time. ALL of the questions I see about this issue just ask if the libraries are in the requirements files. Mine are. They are not being seen, or found, or noticed, or used, or something.
I have absolutely no idea what else to do. After this many tries the only sane thing would seem to be to just use pipenv, but the error seems so flagrant, and presumably simple, that it's driving me completely nuts.
EDITS (in response to comment): My file tree has changed through different attempts to make things work, so I've tried a number of configurations. Sometimes the Procfile and app file are in the same, top-level directory -- I've also tried having a runserver script at the top level, and putting the app script inside another directory.
I have also tried having, and not having, local requirements.txt files, in case poetry wasn't successfully creating them as it's supposed to, but the poetry build-back does appear to successfully build its own when launched on heroku. I examined that one, on the heroku machine, and it contained lines for both flask, and gunicorn (among others, but these are the specific two the system says are missing)
Test to run locally "poetry run flask run".

How to build VSCode app bundle from source

I'm trying to build VSCode from source on Mac, and make an app bundle. I tried following these instructions which suggest you can run gulp vscode-darwin to package VSCode for Mac.
I tried that. It definitely compiles some stuff and it doesn't print any errors, but there's no VSCode-darwin.app anywhere. What am I missing?
Ugh this is stupid. gulp vscode-darwin does build the app bundle, but it saves it in the parent directory. I.e. if you run npx gulp vscode-darwin in the root of the vscode repo, the output will be at ../VSCode-darwin, not in out, out-build, out-vscode, or .build as you might expect.

nativescript 5.1 and tns_modules folder in IOS build

I had this issue before with some app (N 4.1).
Now i'm doing another app, and i have the same issue :
First, im preparing build:
tns build ios --for-device --release --provision MY_Provision
Nativescript is doing build, so next i'm opening it in XCode, and doing some twaks like version number etc...
Lastly i'm doing "Archieve" and trying to Validate this archieve.
The result is error, in the previous app written in N 4.1 i had the same but with another plugin, and now validation throws: Invalid build structure - binary app/rns_modules.fstevents.lib/binding/Release/FILE NAME.
many errors regarding this folder.
So i've just removed this directory and done another archieve and validation - app passed the validation.
So, my question is - do i need such number of plugins in tns_modules ?
Or better question - is there any way to determine what is not needed ?
Or, am i doing something wrong when building an app ? As seems massive number of directories here and i'm wondering if maybe there is some kind of cleanup or something ?
For now, the only way to store an app is to validate first, check what is blocking validation, delete this, check if app works (:() and try again.
Thank you.
Below, attached, folder that is blocking validation and amount of dirs inside of tns_modules.
pacakge.json:
NativeScript CLI will prepare (i.e. copy) all packages declared in the dependencies section of your package.json (and their dependencies) in tns_modules. All devDependencies and their dependencies will not be copied to the native Xcode/Android Studio project.
So, all packages that are required only for building the application, should be installed as devDependencies. For example, such packages are nativescript-dev-webpack, nativescript-dev-typescript, etc.
Also, it looks like you have installed NativeScript CLI as a dependency of your project. By default, it should be installed globally, i.e. npm i -g nativescript. In case you omit the -g flag, npm will install it as dependency of your project.
You can try:
rm -rf platforms
npm un --save nativescript
Check package.json for other packages with -dev in their names and ensure they are in the devDependencies section.
After that run tns build ios --forDevice.

Build React Native project after pulling from GitHub

My friend initialized a GitHub repo after initializing React Native in a certain directory. After I pull his files into a directory and initialize a local repository on my computer and run the XCode project, there seem to be a lot of missing files and the build fails. There's probably something I need to do which is taken care of when setting up react native in the "react-native init AwesomeProject" step, but I'm not trying to set up a new project. Instead, I want to keep the files he's already developed, but set up the React Native "environment"..how would I go about doing this?
You need to install the dependencies through npm. Just enter the following command in the root directory of your project:
npm i

How do I build utilities with my Go web app on Heroku?

I've developed a web app using Go, which I've deployed to Heroku. I'm using mattes/migrate to manage migrations. It works great locally, but the migrate command-line binary isn't available when I deploy to Heroku.
The only binaries that are included are my own. Is there a way to have Godeps compile and install binaries provided by a dependency?
Just create a file where you include the executable path.
See this issue for Goose (mattes/migrate competitor)
I'd expect the equivalent for mattes/migrate would be:
package main
import _ "github.com/mattes/migrate"
Heroku's current recommended solution is to simply clone the command into your own repo (see github.com/tools/godep/issues/306).
I copied the mattes/migrate/main.go into the cmd/migrate directory in my own project. This builds the command just like my own server command.
It's not ideal, but it works.

Resources