cloudcannon-hugo
Advanced tools
Comparing version 1.0.9 to 1.0.10
{ | ||
"name": "cloudcannon-hugo", | ||
"type": "module", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "Generates the files necessary for a hugo site to integrate with CloudCannon CMS", | ||
@@ -6,0 +6,0 @@ "main": "src/index.js", |
import { mergeDeep, runProcess } from '../helpers/helpers.js'; | ||
import { markdownMeta } from '../helpers/metadata.js'; | ||
export function getGeneratorMetadata(hugoConfig) { | ||
export function getGeneratorMetadata(hugoConfig, config) { | ||
const markup = hugoConfig.markup ?? {}; | ||
const markdownHandler = markup.defaultMarkdownHandler ?? 'goldmark'; | ||
const defaultMeta = markdownMeta[markdownHandler] ?? {}; | ||
const markdownHandler = config.generator?.metadata?.markdown || markup.defaultMarkdownHandler || 'goldmark'; | ||
const defaultMeta = markdownMeta[markdownHandler] || {}; | ||
const ccMarkdownSettings = config.generator?.metadata?.[markdownHandler] || {}; | ||
const markdownSettings = mergeDeep({}, defaultMeta, markup[markdownHandler], ccMarkdownSettings); | ||
markdownSettings.renderer ||= {}; | ||
markdownSettings.renderer.hardWraps = !!(markdownSettings.hardWraps ?? markdownSettings.renderer.hardWraps ?? false); | ||
return { | ||
markdown: markdownHandler, | ||
[markdownHandler]: mergeDeep(defaultMeta, markup[markdownHandler]) | ||
[markdownHandler]: markdownSettings | ||
}; | ||
} | ||
export async function getGenerator(hugoConfig) { | ||
export async function getGenerator(hugoConfig, config) { | ||
const hugoVersion = await runProcess('hugo', ['version']); | ||
@@ -21,4 +27,4 @@ | ||
version: hugoVersion.match(/[0-9]+\.[0-9]+\.[0-9]+/g)?.[0] ?? '0.0.0', | ||
metadata: getGeneratorMetadata(hugoConfig) | ||
metadata: getGeneratorMetadata(hugoConfig, config) | ||
}; | ||
} |
@@ -53,3 +53,3 @@ import Papa from 'papaparse'; | ||
const data = await getData(config); | ||
const generator = await getGenerator(hugoConfig); | ||
const generator = await getGenerator(hugoConfig, config); | ||
@@ -56,0 +56,0 @@ // multlingual not needed in info.json |
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
42709
1089