Closed sogaoh closed 2 years ago
YAMLパーサーはJSONもパースできるので、コンフィグのパースをJSON.parseからYAMLのライブラリに置き換えるだけでこれは実現できます
いいですね! JSONCもパースしてくれるかは確認したいところです。
もしくは変換はユーザーに任せ、URL経由でJSONを読み取るという手も…
JSONCのパースはYAMLのライブラリでは無理そうです。
#
か-
で始まったらYAML、/
か[
で始まったらJSONCとしてパースすればいいんじゃないでしょうか?
const configListIsYaml = (configList: string) => /^\s*[#-]/.test(configList)
const configListIsJsonc = (configList: string) => /^\s*[\/\[]/.test(configList)
configListIsYaml(configList) ? YAML.parse(configList) :
configListIsJsonc(configList) ? JSONC.parse(configList) :
JSON.parse(configList)
Now YAML supported!!!
(Account ID is dummy)
Description
v1.3 時点ではオプションでの Configuration は json (+アルファ?) 形式での設定が想定されているように感じます。 設定を yaml で行えるようになっていると、コメントが書きやすい・フォーマット(lint)を気にする機会が減る、 と思うので可能であれば yaml 対応いただきたいです。
Use Case
Proposed Solution
yaml 形式での Configuration 画面が追加であると良さそう
現状の Configuration を json か yaml か選択させるようにしてそれに従ってパースする、でも良いかもしれません
Other information
No response
Acknowledge