0.1.0 • Published 8 years ago
xod-yaml-tools v0.1.0
xod-yaml-tools
A collection of YAML tools for XOD project.
Installation
yarn add --dev xod-yaml-toolsUsage
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.
Normalize a single .yaml file:
./node_modules/.bin/xod-yaml-tools:normalize api/swagger/swagger.yamlNormalize all .yaml files in a directory:
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