Error when parsing strings as environment variables
Steps to reproduce :
- add a var in your config file without default value :
vars:
SOME_VERSION:
platform:
android:
versionName: $SOME_VERSION
- run
SOME_VERSION="1.2.3" npx trapeze
You should get this error :
Unable to parse environment variable SOME_VERSION SyntaxError: Unexpected token . in JSON at position 3
This is because we automatically try to parse the variable value as JSON here : https://github.com/ionic-team/trapeze/blob/cfaeaf892e1565ebb0462d1049ecf9005e0cfe0a/packages/configure/src/ctx.ts#L106
this won't work if the string you provide is not numeric or JSON formatted
as a workaround :
running SOME_VERSION='"1.2.3"' npx trapeze works
@mlynch @leo-jnesis I don't understand why we get these errors if it's a simple string value?
maybe log this is set flag DEBUG=true?
https://github.com/ionic-team/trapeze/blob/c1c7c81a566fec0f327e63b55d811a1b1e5a32b0/packages/configure/src/ctx.ts#L110
@reslear yea good point. I tweaked the logging a bit in 5.0.6, freshly released