env2js

Crates.ioenv2js
lib.rsenv2js
version1.0.1
sourcesrc
created_at2020-02-22 21:40:29.435724
updated_at2020-02-22 21:40:29.435724
descriptionA tool for creating js/json files with env vatiables
homepagehttps://github.com/SkeLLLa/env2js
repositoryhttps://github.com/SkeLLLa/env2js
max_upload_size
id211575
size13,966
Alexander Kureniov (SkeLLLa)

documentation

README

env2js

Converts current env to js/json. Supports reading from .env files.

Usage

All commands are available via env2js --help

>$ env2js --help

Converts your env to js or json file

USAGE:
    env-to-json [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -c, --config <FILE>          Sets a custom env file [default: .env]
    -g, --global <GLOBAL_VAR>    Sets a custom global variable for javascript [default: __env]
    -p, --prefix <PREFIX>        Env variables prefix filter
    -t, --type <TYPE>            Set output type [default: js]  [possible values: js, json]

You can use it for making env variables available in runtime of your react app.

>$ REACT_APP_FOO=bar env2js -g env -p REACT_APP_ -t js > env.js

Will result in following file:

window.env = {"FOO":"bar"}

Versions

Linux

  • env2js - simple build, without size optimizations
  • env2js.min - build with stripped symbols
  • env2js.nano - packed build with upx (seems upx on ubuntu is kinda broken, so this binary may be broken too)

Windows

  • env2js.exe - windows build

License

MIT

Commit count: 33

cargo fmt