Skip to content

Own option #2548

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

Closed
vincentpalita opened this issue Feb 16, 2017 · 7 comments
Closed

Own option #2548

vincentpalita opened this issue Feb 16, 2017 · 7 comments
Labels

Comments

@vincentpalita
Copy link

Hello,

I searched issues but didn't find anything about it.
I would like to be able to pass options that are not included in the nativescript-cli list.
Is it possible?

For example:
tns run ios --emulator --watch --environment=integration

As of now I get the following error:
The option 'environment' is not supported. To see command's options, use '$ tns help run'. To see all commands use '$ tns help'.

Thank you for your help,
Vincent

@rosen-vladimirov
Copy link
Contributor

Hey @vincentpalita ,
Thanks for your idea. At the moment it is not possible to pass such options as CLI validates all data passed. It's a kind of a strict validation 😺
We'll consider your idea, but can you share some more details regarding your requirements. What's the purpose of the environment argument? Do you have different environments, like test, pre-live, live or you need something like project configurations (debug, release)?

@vincentpalita
Copy link
Author

Hey @rosen-vladimirov ,
Thanks for getting back to me!
Well we have in our case multiple environments like development, test, demo, live.
Each environment has its own settings for API or tier products keys (Google, etc...).
As of now we are manually switching the configuration ourselves. But this is subject to errors and of course harder to include the project in a CI platform.
Hope I gave you the details you needed.

@dtopuzov
Copy link
Contributor

Hi @vincentpalita we have similar situation and here is hot we solve it:

We use hooks, inside those hooks we read values from environment variables and replace placeholder some file which act the role of configuration.

I don't believe passing options to CLI commands is good way to modify your app.

@vincentpalita
Copy link
Author

vincentpalita commented May 10, 2017

Hi @dtopuzov thanks for your message. Well I don't really agree with you about the fact that it's not a good way to "modify your app" while passing options to CLI commands.

It is currently a method used by numerous systems such as angular-cli with the argument --environment.

We are not looking to "modify the app" but to change the configuration at startup and build.
We will look into hooks method since there are no ways to configure that part of with the current nativescript cli.

Thanks

@Guatom
Copy link

Guatom commented Oct 23, 2017

This would be a very nice feature.

@rosen-vladimirov
Copy link
Contributor

At the moment you can use --env to pass any kind of variables and respect them in webpack.config.js for example.

tns build android --env.myVariable valueOfMyVariable

I'm closing this thread, feel free to reopen it in case you think the suggested solution is not applicable for your use case.

@jitendraashutec
Copy link

jitendraashutec commented Jun 16, 2020

@rosen-vladimirov @NathanWalker

Can I pass custom variable in tns test command?
I want to do like: tns test ios --emulator --env.project=my_project and use project variable into webpack and in my custom hook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants