@jonshort/cenv
v1.0.1
Published
Completely unnecessary port of cenv internals to node via. wasm
Downloads
3
Readme
cenv-wasm
Using a comment pattern in your .env files, easily swap between envs in local development.
Installation
Install globally via. npm
npm install -g @jonshort/cenv
Usage
- Add the "cenv" pattern to your .env file
VARIABLE_1=something
# ++ local ++
# API_ADDRESS=http://localhost:5000
# REQUIRE_LOGIN=false
# ++ live ++
# API_ADDRESS=https://myliveapi.com
# REQUIRE_LOGIN=true
- Run cenv, choosing an env keyword to use
cenv live
- Check your .env, the keyworded env vars will now be uncommented
VARIABLE_1=something
# ++ local ++
# API_ADDRESS=http://localhost:5000
# REQUIRE_LOGIN=false
# ++ live ++
API_ADDRESS=https://myliveapi.com
REQUIRE_LOGIN=true
Use via. npx
You can also run this cli via. npx
which avoids having to install it globally, e.g:
npx @jonshort/cenv keyword
Uninstalling
- Check globally installed packages
npm ls -g
- Uninstall the package
npm uninstall -g @jonshort/cenv
Development
How to build the internals
- Install
wasm-pack
cargo install wasm-pack
- Build with the target of nodejs
wasm-pack build --target nodejs
- Check the
pkg/
folder - this is the compiled wasm - Once built run
node index.js
and check everything is working as expected
How to publish the package
- Build the internals as above
- Remove the
.gitignore
file within thepkg/
folder
rm pkg/.gitignore
[!IMPORTANT] The above is extremely important - JS snippets won't be included otherwise 3. Do a dry-run publish and check the files are as expected
npm publish --dry-run
- Publish as normal
npm publish