env-cmd
                                
                                 env-cmd copied to clipboard
                                
                                    env-cmd copied to clipboard
                            
                            
                            
                        YAML Support 🙌
It would be great if YAML support could be added for .env.yaml and .env-cmdrc.yaml, would this be possible?
This is a cool idea. Interested in opening a PR?
I just took a look at the loader and it would be very easy to implement.
i'd also suggest you don't use require to get the file, but use a native dynamic import to load .js/.cjs and use a parser wrapped inside a helper-function otherwhise.
This would have a couple of benefits:
- the loader itself would be vanilla JS/ES
- the code would be more straigth-forward
- any kind of object-notation can be supported by simply adding a case for it's extension that points to its parser
the change should not amount to more than 30 lines and performance and stability can only increase
i'll have a look at it
btw i love that you include esm-loading, and what are your thoughts on JSON5 support?
This would be great, especially when working with other libraries that force use of yaml (e.g. gcloud functions).
I used this ugly sed-workaround to operate both:
  "scripts": {
    "generate-env": "cat .env.yaml | sed \"s#: #=#g\" > build/.env",
    "start": "yarn generate-env && env-cmd -f build/.env YOUR_CODE_HERE",
    "deploy": "gcloud functions deploy --env-vars-file .env.yaml ..."
  }
our workaround.
yq -o=json eval .env.yaml > .env.json https://github.com/mikefarah/yq