From 15f4d9459d746871e646eda858efeb778f111f39 Mon Sep 17 00:00:00 2001 From: Paul Loyd Date: Sat, 16 Dec 2017 17:03:22 +0300 Subject: [PATCH] Output json-schema in CLI --- src/cli.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cli.js b/src/cli.js index 1a08195..1b69c6d 100644 --- a/src/cli.js +++ b/src/cli.js @@ -1,5 +1,6 @@ import * as yaml from 'yaml-js'; import * as optimist from 'optimist'; +import stringifyJson from 'json-stringify-pretty-compact'; import collect from '.'; @@ -15,14 +16,16 @@ function run(path: string) { } try { - const {types} = collect(path); + const {types, schema} = collect(path); const output = yaml.dump(types, null, null, { indent: 4, - width: 100, + width: 80, }); console.log(output.trimRight()); + console.log('--------'); + console.log(stringifyJson(schema, {maxLength: 80})); } catch (ex) { console.error(ex.message); console.error(ex.stack);