I just read your post on Medium. Great post!
I tried to use your solution. But a problem / question showed up: how you import the environment constant in your files? I search your repository and you use this:
import { environment } from '../../../environments/environment';
But in the post you said to change environment.ts to enviroment.dev.ts. The script set-env.ts configure this creating a copy of current environment.__NAME__.ts?
Thanks in advance!