Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/m-abs/nativescript-app-environment


https://github.com/m-abs/nativescript-app-environment

environment-variables nativescript nativescript-hook

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

# nativescript-app-environment

### Add environment variables into your app from the nativescript-cli

Creates `app/environment.json` from the nativescript-cli command via argv `--env.app`

### Install
```bash
tns plugin add nativescript-app-environment
```

### Usage

* Set production mode in tns run:
```bash
tns run android --env.app.prod
```

This will create `environment.json` with this content:
```typescript
{ prod: true }
```

* in app
```typescript
const { environment } = require('./environment.json');

console.log(environment);
```

* Inspired by [nativescript-hook-debug-production](https://github.com/markosko/nativescript-hook-debug-production)