guybedford / chomp

'JS Make' - parallel task runner for the frontend ecosystem with a JS extension system.
https://chompbuild.com
Apache License 2.0
138 stars 7 forks source link

feat: static environment variable replacements #65

Closed guybedford closed 2 years ago

guybedford commented 2 years ago

Runtime environment variable usage via $VAR works well in most cases, but has limitations when it comes to for example executing a command at a path, where $VAR/bin/app isn't supported in Powershell so there's no cross-platform way to do this.

This adds ${{VAR}} static replacements, and uses these for environment variable replacements in environment variables themselves as well as for the run script of Shell tasks only.

A new option env-replacements = false can be used to disable this per-task in the rare case of conflict.

Any ${{..}} which cannot be resolved will be replaced with the empty string, so in theory we could extend the syntax to basic execution syntax in future, but for now it's just direct variable replacements only. The use of $VAR replacements in environment variables is fully deprecated and replaced with this new static syntax.