Skip to content

nickyhaze/univar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

univar

npm version NPM License

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 JaneDoe

Install

npm install univar --save-dev

Usage

{
  "scripts": {
    "prebuild": "univar rimraf public/$npm_package_version",
    "build": "univar echo Building v$npm_package_version for %USERNAME%"
  }
}

Dev

npm test

About

Cross-platform environment variable substitution for shell commands.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published