Skip to content

Commit

Permalink
Replace jaml formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
andieelmes committed Jun 29, 2023
1 parent be9a66d commit 41dd7fe
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 29 deletions.
94 changes: 68 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"commander": "10.0.1",
"commonmark": "0.30.0",
"fast-deep-equal": "2.0.1",
"yamljs": "0.3.0"
"js-yaml": "4.1.0"
},
"jest": {
"testEnvironment": "node",
Expand Down
4 changes: 2 additions & 2 deletions parseApibFile.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const yaml = require('yamljs');
const yaml = require('js-yaml');
const Crafter = require('./Crafter');

module.exports = async function parseApibFile(fileName, outputFormat, sourceMapsEnabled, debugMode, languageServerMode, contextOptions = {}) {
const result = (await Crafter.parseFile(fileName, { sourceMapsEnabled, debugMode, languageServerMode, ...contextOptions }))[0];
if (outputFormat === 'json') {
return JSON.stringify(result.toRefract(sourceMapsEnabled), null, 2);
}
return yaml.stringify(result.toRefract(sourceMapsEnabled), Infinity, 2);
return yaml.dump(result.toRefract(sourceMapsEnabled), { indent: 2 });
};

0 comments on commit 41dd7fe

Please sign in to comment.