1.0.13 • Published 6 months ago

rn-env-starter v1.0.13

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

rn-env-starter

A simple CLI tool to seamlessly start your React Native app with different environment configurations. It will handle your environment settings and decide whether to run the app on iOS or Android based on your operating system or the platform argument provided.

Installation

You can install the package globally for easier access:

npm install -g rn-env-starter

However, with the use of npx, it's not strictly necessary to install the package globally. You can run it directly using npx:

npx rn-env-starter [environmentName] [platform]

Requirements

This tool assumes you're using react-native-config in your React Native project. If not, install it first:

npm install @react-native-community/cli

Ensure you have followed the setup guide of react-native-config for iOS and Android.

Setting Up Environment Configuration

To use different environments, you should structure your configuration files in the following naming convention:

.env.{environmentName}

For example:

__.env.local__
__.env.staging__
__.env.production__

Inside each file, define your environment-specific variables:

API_URL=https://api.local.example.com
ANOTHER_CONFIG=SomeValue

Usage

Navigate to your React Native project directory and run:

rn-start [environmentName] [platform]

For example:

To start the local environment for the default platform based on OS:
rn-start local

To specify both an environment and a platform:

rn-start local android

The command above will utilize the .env.local file for environment configurations and then launch the appropriate version of the app on the specified platform (iOS or Android).

Note

The tool will, by default, use the .env.local configuration if no environment name is provided. Ensure that you have, at the very least, a .env.local file in your project.

Issues & Contributions

If you encounter any issues or would like to contribute to this tool, please open an issue or a pull request.

1.0.13

6 months ago

1.0.12

6 months ago

1.0.11

6 months ago

1.0.10

6 months ago

1.0.9

6 months ago

1.0.8

6 months ago

1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago