-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Edit variables found in AndroidManifest.xml
and Info.plist
from a single file.
#9520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Trying to do something similar I ended using hooks. I feel the use of hooks should be easier and could achieve this issue as well. Since we all are developers, a programmatic hook to make any changes on the project is flexible and powerful (not so clean, though). But I feel these issues:
Should this be a separate issue? |
@xiromoreira i created a new issue in the CLI repo. |
Nativescript mentioned "workspaces" in their latest blog post which may help answer my question / anyone else with the question. (I've not actually tested this out yet). https://blog.nativescript.org/nativescript-8-1-announcement/index.html#cli-updates
|
This would be a very interesting feature! Actually I need it in one of my project to be able to define variables from env. It would be very useful, especially for variables you don't want to commit in the repo (like tokens, secrets…) Sometimes, I also have default values for those variables but they can be overridden (eg for dev environment). I think workspaces can be a solution for that but I used to add custom hooks in my past projects. I found them not reliable (especially when NS7 has came out) so I don't use them any more. I don't know how but it seems that there is something already supported because there are already injected variables in Info.plist (executable name, version…). |
I actually made a plugin to do this very thing. https://github.com/ontrackms/nativescript-dotenv To make it work automatically, my import { NativeScriptConfig } from '@nativescript/core';
import { readFileSync } from 'fs';
const { name } = JSON.parse(readFileSync('./package.json', 'utf-8'));
export default {
name,
id: name,
appResourcesPath: 'App_Resources',
android: {
v8Flags: '--expose_gc',
markingMode: 'none'
},
useLegacyWorkflow: true,
} as NativeScriptConfig; |
Is your feature request related to a problem? Please describe.
My client wants to be able to have multiple versions of the same app. One for production, a beta version for testFlight and an Ad Hoc version. I do not see an easy way to do this. It appears to currently involve manually editing multiple files which is error prone and messy.
Describe the solution you'd like
I'd like to be able to edit the variables found in
AndroidManifest.xml
andInfo.plist
from a single file likenativescript.config.ts
orpackage.json
.Things like:
CFBundleName, CFBundleDisplayName, CFBundleShortVersionString
andCFBundleVersion
orversionCode, versionName, package
.If I could edit these values in
nativescript.config.ts
I could very easily write some code to change these values by adding something likeNODE_ENV=testflight
to the beginning of of a NS build command. This would then set the required variables depending on the environments I've setup.Describe alternatives you've considered
After asking around on slack I've found out that it's possible to add variables to
app.gradle
andbuild.xcconfig
and use those in the files in question. However, I would like to be able to edit a single file.If this feature does not exist I think it would help make nativescript more accessible for new users that want to do simple things like change the app name or version number. It would also help with more advanced things like I've mentioned above - swapping out the package name to build multiple versions of the same app.
If this feature already exist could you kindly explain how it can be achieved.
Many thanks
The text was updated successfully, but these errors were encountered: