xod-yaml-tools
A collection of YAML tools for XOD project.
Installation
yarn add --dev xod-yaml-tools
Usage
xod-yaml-tools:normalize
This tool normalizes .yaml
file:
- sorts objects' keys lexicographically;
- encloses string literals in quotes, if needed;
- strips quotes from string literals, if needed;
- replaces long string literals with multi-line, if needed;
- replaces multi-line with short string literals, if needed.
.yaml
file:
Normalize a single ./node_modules/.bin/xod-yaml-tools:normalize api/swagger/swagger.yaml
.yaml
files in a directory:
Normalize all find . -name *.yaml -exec ./node_modules/.bin/xod-yaml-tools:normalize {} \;
xod-yaml-tools:synchronize
This tool synchronizes package.json
leader file
with swagger.yaml
follower file:
package.json |
swagger.yaml |
---|---|
/author |
/info/contact |
/description |
/info/description |
/name |
/info/title |
/version |
/info/version |
Synchronize:
./node_modules/.bin/xod-yaml-tools:synchronize package.json \
api/swagger/swagger.yaml