univar
v0.2.1
Published
Cross-platform environment variable substitution for shell commands.
Maintainers
Readme
univar
Overview
univar lets you use one script syntax for environment variables that works on macOS/Linux (bash) and Windows (cmd). It replaces $VAR and %VAR% placeholders in your commands before execution.
Without univar, these scripts behave differently:
{
"scripts": {
"bash-only": "echo Hello $USER",
"win-only": "echo Hello %USERNAME%"
}
}With univar, they can be unified:
{
"scripts": {
"greet": "univar echo Hello $USER %USERNAME%"
}
}On any platform:
npm run greet
# → Hello JaneDoe JaneDoeInstall
npm install univar --save-devUsage
{
"scripts": {
"prebuild": "univar rimraf public/$npm_package_version",
"build": "univar echo Building v$npm_package_version for %USERNAME%"
}
}Dev
npm test