contentful-hugo
Advanced tools
Comparing version 3.0.0 to 3.1.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.replaceBackslashesWithForwardSlashes = exports.endsWith = exports.trailingSpaces = exports.leadingSpaces = exports.removeLeadingAndTrailingSlashes = exports.specialEntities = exports.replaceSpecialEntities = exports.isMultilineString = exports.characterIsWhiteSpace = void 0; | ||
var removeLeadingAndTrailingSlashes = function (string) { return string.replace(/^\/+|\/+$/g, ''); }; | ||
var removeLeadingAndTrailingSlashes = function (string) { | ||
return string.replace(/^\/+|\/+$/g, ''); | ||
}; | ||
exports.removeLeadingAndTrailingSlashes = removeLeadingAndTrailingSlashes; | ||
@@ -81,6 +83,10 @@ var isMultilineString = function (string) { | ||
*/ | ||
var endsWith = function (str, ext) { return new RegExp("".concat(ext, "$")).test(str || ''); }; | ||
var endsWith = function (str, ext) { | ||
return new RegExp("".concat(ext, "$")).test(str || ''); | ||
}; | ||
exports.endsWith = endsWith; | ||
var replaceBackslashesWithForwardSlashes = function (input) { return input.replace(/\\/g, '/'); }; | ||
var replaceBackslashesWithForwardSlashes = function (input) { | ||
return input.replace(/\\/g, '/'); | ||
}; | ||
exports.replaceBackslashesWithForwardSlashes = replaceBackslashesWithForwardSlashes; | ||
//# sourceMappingURL=strings.js.map |
@@ -25,5 +25,5 @@ import { Entry } from 'contentful'; | ||
} | ||
export interface CustomFieldsConfig { | ||
[fieldName: string]: unknown | ((entry: Entry) => unknown); | ||
} | ||
export type CustomFieldsFunction = (entry: Entry) => unknown; | ||
export type CustomFieldsInput = CustomFieldsFunction | unknown; | ||
export type CustomFieldsConfig = Record<string, CustomFieldsInput>; | ||
type fileExtensionBase = 'md' | 'yaml' | 'yml'; | ||
@@ -30,0 +30,0 @@ export type fileExtension = fileExtensionBase | string; |
@@ -22,5 +22,7 @@ "use strict"; | ||
exports.determineFileType = determineFileType; | ||
var isValidFileExtension = function (extension) { return ['md', 'yaml', 'yml', 'json'].some(function (ext) { | ||
return (0, strings_1.endsWith)(extension || 'md', ext); | ||
}); }; | ||
var isValidFileExtension = function (extension) { | ||
return ['md', 'yaml', 'yml', 'json'].some(function (ext) { | ||
return (0, strings_1.endsWith)(extension || 'md', ext); | ||
}); | ||
}; | ||
exports.isValidFileExtension = isValidFileExtension; | ||
@@ -27,0 +29,0 @@ var isTypeConfig = function (input) { |
@@ -19,3 +19,5 @@ "use strict"; | ||
var noExtension = name_1.replace('.html', ''); | ||
var camelCaseName = noExtension.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); }); | ||
var camelCaseName = noExtension.replace(/-([a-z])/g, function (g) { | ||
return g[1].toUpperCase(); | ||
}); | ||
shortcodes[camelCaseName] = { | ||
@@ -22,0 +24,0 @@ filename: name_1, |
#!/usr/bin/env node | ||
/// <reference types="node/http" /> | ||
import { IncomingHttpHeaders } from 'http'; | ||
@@ -3,0 +4,0 @@ import { Entry, Asset, ContentType } from 'contentful'; |
{ | ||
"name": "contentful-hugo", | ||
"version": "3.0.0", | ||
"version": "3.1.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.", | ||
@@ -41,11 +41,11 @@ "main": "./dist/main/index.js", | ||
"dependencies": { | ||
"@contentful/rich-text-html-renderer": "^16.1.0", | ||
"@contentful/rich-text-plain-text-renderer": "^16.0.5", | ||
"@contentful/rich-text-types": "^16.2.0", | ||
"@contentful/rich-text-html-renderer": "^16.3.4", | ||
"@contentful/rich-text-plain-text-renderer": "^16.0.11", | ||
"@contentful/rich-text-types": "^16.3.4", | ||
"async-limiter": "^2.0.0", | ||
"chokidar": "^3.5.3", | ||
"contentful": "^10.3.1", | ||
"dotenv": "^16.3.1", | ||
"fastify": "^4.19.2", | ||
"fs-extra": "^11.1.1", | ||
"contentful": "^10.6.21", | ||
"dotenv": "^16.4.1", | ||
"fastify": "^4.26.0", | ||
"fs-extra": "^11.2.0", | ||
"js-yaml": "^4.1.0", | ||
@@ -64,22 +64,21 @@ "json-to-pretty-yaml": "^1.2.2", | ||
"@modii/tscpaths": "^0.2.3", | ||
"@types/fs-extra": "^11.0.1", | ||
"@types/js-yaml": "^4.0.5", | ||
"@types/node": "^20.4.1", | ||
"@types/yargs": "^17.0.24", | ||
"@typescript-eslint/eslint-plugin": "^5.61.0", | ||
"@typescript-eslint/parser": "^5.61.0", | ||
"@vitest/coverage-c8": "^0.33.0", | ||
"@vitest/coverage-v8": "^0.33.0", | ||
"eslint": "^8.44.0", | ||
"@types/fs-extra": "^11.0.4", | ||
"@types/js-yaml": "^4.0.9", | ||
"@types/node": "^20.11.16", | ||
"@types/yargs": "^17.0.32", | ||
"@typescript-eslint/eslint-plugin": "^6.21.0", | ||
"@typescript-eslint/parser": "^6.21.0", | ||
"@vitest/coverage-v8": "^1.2.2", | ||
"eslint": "^8.56.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^6.1.1", | ||
"prettier": "^2.8.8", | ||
"typescript": "^5.1.6", | ||
"vite": "^4.4.2", | ||
"vite-tsconfig-paths": "^4.2.0", | ||
"vitest": "^0.33.0" | ||
"prettier": "^3.2.5", | ||
"typescript": "^5.3.3", | ||
"vite": "^5.0.12", | ||
"vite-tsconfig-paths": "^4.3.1", | ||
"vitest": "^1.2.2" | ||
} | ||
} |
@@ -192,4 +192,5 @@ # Contentful Hugo | ||
// contentful-hugo.config.js | ||
const { defineConfig } = require('contentful-hugo'); | ||
module.exports = { | ||
module.exports = defineConfig({ | ||
// fetches from default locale if left blank | ||
@@ -264,3 +265,3 @@ locales: ['en-US', 'fr-FR'], | ||
], | ||
}; | ||
}); | ||
``` | ||
@@ -381,10 +382,11 @@ | ||
```js | ||
const { defineConfig } = require('contentful-hugo'); | ||
// produce en-us.md and fr-fr.md files | ||
module.exports = { | ||
module.exports = defineConfig({ | ||
locales: ['en-US', 'fr-FR']; | ||
// rest of config | ||
} | ||
}) | ||
// produce en.md and fr.md files | ||
module.exports = { | ||
module.exports = defineConfig({ | ||
locales: [ | ||
@@ -401,6 +403,6 @@ { | ||
// rest of config | ||
} | ||
}) | ||
// produce en-us.md files and fr.md files | ||
module.exports = { | ||
module.exports = defineConfig({ | ||
locales: [ | ||
@@ -414,3 +416,3 @@ 'en-US', | ||
// rest of config | ||
} | ||
}) | ||
``` | ||
@@ -437,3 +439,5 @@ | ||
```js | ||
module.exports = { | ||
const { defineConfig } = require('contentful-hugo'); | ||
module.exports = defineConfig({ | ||
locales: ['en', 'fr'] | ||
@@ -464,3 +468,3 @@ singleTypes: [ | ||
], | ||
}; | ||
}); | ||
``` | ||
@@ -477,3 +481,5 @@ | ||
```js | ||
module.exports = { | ||
const { defineConfig } = require('contentful-hugo'); | ||
module.exports = defineConfig({ | ||
// rest of config | ||
@@ -492,3 +498,3 @@ staticContent: [ | ||
], | ||
}; | ||
}); | ||
``` | ||
@@ -506,3 +512,3 @@ | ||
// contentful-hugo.config.js | ||
const { defineConfig } = require('contentful-hugo'); | ||
require('dotenv').config(); // assuming you have "dotenv" in your dependencies | ||
@@ -518,3 +524,3 @@ | ||
module.exports = { | ||
module.exports = defineConfig({ | ||
contentful: { | ||
@@ -527,3 +533,3 @@ space: 'my-space-id', | ||
// rest of config | ||
}; | ||
}); | ||
``` | ||
@@ -534,5 +540,6 @@ | ||
```js | ||
const { defineConfig } = require('contentful-hugo'); | ||
// contentful-hugo.config.js | ||
module.exports = { | ||
module.exports = defineConfig({ | ||
repeatableTypes: [ | ||
@@ -562,6 +569,6 @@ { | ||
] | ||
} | ||
}) | ||
// ALTERNATIVE SYNTAX | ||
module.exports = { | ||
module.exports = defineConfig({ | ||
repeatableTypes: [ | ||
@@ -595,3 +602,3 @@ { | ||
] | ||
} | ||
}) | ||
``` | ||
@@ -601,5 +608,13 @@ | ||
For JS config files you can import a `ContentfulHugoConfig` type which will enable autocomplete in text editors that support Typescript typings. (Tested in Visual Studio Code.) | ||
For JS config files you can use the `defineConfig` helper or you can import the `ContentfulHugoConfig` type. | ||
```js | ||
//////////// OPTION 1 //////////// | ||
const { defineConfig } = require('contentful-hugo'); | ||
module.exports = defineConfig({ | ||
// config goes here | ||
}); | ||
//////////// OPTION 2 //////////// | ||
/** | ||
@@ -840,3 +855,3 @@ * @type {import('contentful-hugo').ContentfulHugoConfig} | ||
// from the config file | ||
module.exports = { | ||
module.exports = defineConfig({ | ||
repeatableTypes: [ | ||
@@ -856,4 +871,3 @@ id: 'posts', | ||
] | ||
} | ||
}) | ||
``` | ||
@@ -992,3 +1006,3 @@ | ||
```js | ||
module.exports = { | ||
module.exports = defineConfig({ | ||
singleTypes: [ | ||
@@ -1024,4 +1038,3 @@ // get a homepage with a specific entryId | ||
]; | ||
} | ||
}) | ||
``` | ||
@@ -1044,3 +1057,3 @@ | ||
```js | ||
module.exports = { | ||
module.exports = defineConfig({ | ||
// rest of config | ||
@@ -1062,3 +1075,3 @@ repeatableTypes: [ | ||
], | ||
}; | ||
}); | ||
``` | ||
@@ -1065,0 +1078,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
307527
19
3741
1106
Updatedcontentful@^10.6.21
Updateddotenv@^16.4.1
Updatedfastify@^4.26.0
Updatedfs-extra@^11.2.0