contentful-hugo
Advanced tools
Comparing version 1.16.5 to 1.17.0
@@ -23,3 +23,3 @@ "use strict"; | ||
var isValidFileExtension = function (extension) { | ||
return ['md', 'yaml', 'yml'].some(function (ext) { | ||
return ['md', 'yaml', 'yml', 'json'].some(function (ext) { | ||
return strings_1.endsWith(extension || 'md', ext); | ||
@@ -26,0 +26,0 @@ }); |
@@ -203,2 +203,24 @@ "use strict"; | ||
exports.determineDynamicLocation = determineDynamicLocation; | ||
var setFileContent = function (frontMatter, fileExtension, mainContent) { | ||
if (frontMatter === void 0) { frontMatter = {}; } | ||
var fileContent = ''; | ||
switch (fileExtension) { | ||
case 'yaml': | ||
case 'yml': | ||
fileContent += YAML.stringify(frontMatter); | ||
break; | ||
case 'json': | ||
fileContent += JSON.stringify(frontMatter); | ||
break; | ||
default: | ||
fileContent += "---\n"; | ||
fileContent += YAML.stringify(frontMatter); | ||
fileContent += "---\n"; | ||
if (mainContent) { | ||
fileContent += mainContent; | ||
} | ||
break; | ||
} | ||
return fileContent; | ||
}; | ||
/** | ||
@@ -214,7 +236,6 @@ * | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var fileContent, fileExtension, isHeadless, isTaxonomy, isSingle, hasDynamicFilename, filePath; | ||
var fileExtension, isHeadless, isTaxonomy, isSingle, fileContent, hasDynamicFilename, filePath; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
fileContent = ''; | ||
fileExtension = contentSettings.fileExtension, isHeadless = contentSettings.isHeadless, isTaxonomy = contentSettings.isTaxonomy, isSingle = contentSettings.isSingle; | ||
@@ -224,16 +245,3 @@ if (isHeadless && isTaxonomy) { | ||
} | ||
if (fileExtension === null || | ||
fileExtension === undefined || | ||
strings_1.endsWith(fileExtension, 'md')) { | ||
fileContent += "---\n"; | ||
} | ||
// add current item to filecontent | ||
fileContent += YAML.stringify(frontMatter); | ||
if (!strings_1.endsWith(fileExtension, 'yaml') && !strings_1.endsWith(fileExtension, 'yml')) { | ||
fileContent += "---\n"; | ||
} | ||
// if set add the main content below the front matter | ||
if (mainContent) { | ||
fileContent += mainContent; | ||
} | ||
fileContent = setFileContent(frontMatter, fileExtension || null, mainContent); | ||
hasDynamicFilename = typeof contentSettings.fileName === 'string' && !isSingle; | ||
@@ -240,0 +248,0 @@ if (!hasDynamicFilename) return [3 /*break*/, 2]; |
{ | ||
"name": "contentful-hugo", | ||
"version": "1.16.5", | ||
"version": "1.17.0", | ||
"description": "Node module that pulls data from Contentful and turns it into markdown files for Hugo. Can be used with other Static Site Generators, but has some Hugo specific features.", | ||
@@ -46,3 +46,3 @@ "main": "./dist/main/index.js", | ||
"chokidar": "^3.5.1", | ||
"contentful": "^8.3.5", | ||
"contentful": "^8.3.7", | ||
"dotenv": "^8.6.0", | ||
@@ -63,25 +63,25 @@ "express": "^4.17.1", | ||
"devDependencies": { | ||
"@babel/cli": "^7.13.16", | ||
"@types/express": "^4.17.9", | ||
"@babel/cli": "^7.14.3", | ||
"@types/express": "^4.17.12", | ||
"@types/fs-extra": "^9.0.11", | ||
"@types/jest": "^26.0.23", | ||
"@types/js-yaml": "^4.0.1", | ||
"@typescript-eslint/eslint-plugin": "^4.23.0", | ||
"@typescript-eslint/parser": "^4.23.0", | ||
"@typescript-eslint/eslint-plugin": "^4.26.1", | ||
"@typescript-eslint/parser": "^4.26.1", | ||
"babel-plugin-module-resolver": "^4.1.0", | ||
"eslint": "^7.26.0", | ||
"eslint": "^7.28.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-config-standard": "^16.0.2", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-config-standard": "^16.0.3", | ||
"eslint-plugin-import": "^2.23.4", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^5.1.0", | ||
"eslint-plugin-standard": "^5.0.0", | ||
"jest": "^26.6.3", | ||
"prettier": "^2.3.0", | ||
"jest": "^27.0.4", | ||
"prettier": "^2.3.1", | ||
"prettier-plugin-go-template": "0.0.10", | ||
"ts-jest": "^26.5.6", | ||
"ts-loader": "^9.1.2", | ||
"ts-jest": "^27.0.3", | ||
"ts-loader": "^9.2.3", | ||
"tscpaths": "0.0.9", | ||
"typescript": "^4.2.4" | ||
"typescript": "^4.3.2" | ||
} | ||
} |
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
204262
3301
Updatedcontentful@^8.3.7