@graphql-markdown/utils
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"license": "MIT", | ||
@@ -29,4 +29,10 @@ "main": "src/index.js", | ||
"peerDependencies": { | ||
"graphql": "^14.0 || ^15.0 || ^16.0" | ||
"graphql": "^14.0 || ^15.0 || ^16.0", | ||
"prettier": "^2.8 || ^3.0" | ||
}, | ||
"peerDependenciesMeta": { | ||
"prettier": { | ||
"optional": true | ||
} | ||
}, | ||
"directories": { | ||
@@ -33,0 +39,0 @@ "test": "tests" |
@@ -22,3 +22,6 @@ const { promises: fs } = require("fs"); | ||
async function saveFile(filePath, data) { | ||
async function saveFile(filePath, data, prettify = undefined) { | ||
if (typeof prettify === "function") { | ||
data = await prettify(data); | ||
} | ||
await ensureDir(dirname(filePath)); | ||
@@ -25,0 +28,0 @@ await fs.writeFile(filePath, data, "utf8"); |
@@ -5,6 +5,6 @@ /* istanbul ignore file */ | ||
function prettify(content, parser) { | ||
async function prettify(content, parser) { | ||
try { | ||
const { format } = require("prettier"); | ||
return format(content, { parser }); | ||
return await format(content, { parser }); | ||
} catch (error) { | ||
@@ -15,10 +15,10 @@ logger.warn("Prettier is not found"); | ||
function prettifyMarkdown(content) { | ||
return prettify(content, "markdown"); | ||
async function prettifyMarkdown(content) { | ||
return await prettify(content, "markdown"); | ||
} | ||
function prettifyJavascript(content) { | ||
return prettify(content, "babel"); | ||
async function prettifyJavascript(content) { | ||
return await prettify(content, "babel"); | ||
} | ||
module.exports = { prettifyMarkdown, prettifyJavascript }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23278
727
3