react-native-boilerplate icon indicating copy to clipboard operation
react-native-boilerplate copied to clipboard

Script in package.json to change environment

Open DiogoAbu opened this issue 8 years ago β€’ 4 comments

Pros and cons of changing the environment like this?

"scripts": {
    "env-dev": "cp App/Config/index.dev.js App/Config/index.js",
    "env-prod": "cp App/Config/index.production.js App/Config/index.js",
    "env-staging": "cp App/Config/index.staging.js App/Config/index.js"
}

DiogoAbu avatar Sep 27 '18 18:09 DiogoAbu

Those could even be named init-*, that way you run yarn run init-dev to get started. But at the same time I'm not sure it's worth writing a helper for such a small need, I'll let @AurelGit rule on that ^^

It's worth noting too that configuring for staging/production usually requires modifying the config file to set private keys/passwords, so the yarn run command alone would not be enough. It may be misleading to have a command for that if it doesn't do the whole job.

mnapoli avatar Sep 27 '18 19:09 mnapoli

Thanks @DiogoAbu for the feedback !

Pros : running a script initializing the app is a very good idea Cons : only copy the file may not be sufficient in the future (running other tasks than copy a file)

But it could be very useful to add an init script running all necessary tasks.

@mnapoli, when you saids

It's worth noting too that configuring for staging/production usually requires modifying the config file to set private keys/passwords

On second thoughts, all your configuration variables in a mobile application should not be private (because builds in the phone) and so should be push in the repo. So copy seems to be enought.

AurelGit avatar Sep 28 '18 08:09 AurelGit

all your configuration variables in a mobile application should not be private

right!

mnapoli avatar Sep 28 '18 08:09 mnapoli

I’m closing this issue because it has been inactive for a few months. This probably means that it is not reproducible or it has been fixed in a newer version. If it’s an enhancement and hasn’t been taken on for so long, then it seems no one has the time to implement this.

Please reopen if you still encounter this issue or need to implement this feature.

Thank you!

AurelGit avatar Sep 17 '19 19:09 AurelGit