Skip to content
This repository has been archived by the owner on Mar 4, 2023. It is now read-only.

Commit

Permalink
Kentico Cloud -> Kentico Kontent rename
Browse files Browse the repository at this point in the history
  • Loading branch information
CMeeg committed Sep 22, 2019
1 parent 04b9add commit d74bd38
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 95 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ All notable changes to this project will be documented in this file.

### Bug Fixes

* Prevent duplicate asset nodes ([9452267](https://github.com/CMeeg/gridsome-source-kentico-cloud/commit/9452267)), closes [#3](https://github.com/CMeeg/gridsome-source-kentico-cloud/issues/3)
* Prevent error being thrown when content with no URL slug field ([e857f11](https://github.com/CMeeg/gridsome-source-kentico-cloud/commit/e857f11)), closes [#4](https://github.com/CMeeg/gridsome-source-kentico-cloud/issues/4)
* Prevent duplicate asset nodes ([9452267](https://github.com/CMeeg/gridsome-source-kentico-kontent/commit/9452267)), closes [#3](https://github.com/CMeeg/gridsome-source-kentico-kontent/issues/3)
* Prevent error being thrown when content with no URL slug field ([e857f11](https://github.com/CMeeg/gridsome-source-kentico-kontent/commit/e857f11)), closes [#4](https://github.com/CMeeg/gridsome-source-kentico-kontent/issues/4)
144 changes: 72 additions & 72 deletions README.md

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"name": "@meeg/gridsome-source-kentico-cloud",
"name": "@meeg/gridsome-source-kentico-kontent",
"version": "0.1.1",
"description": "Kentico Cloud data source plugin for Gridsome.",
"description": "Kentico Kontent data source plugin for Gridsome.",
"author": "Chris Meagher",
"license": "MIT",
"homepage": "https://github.com/CMeeg/gridsome-source-kentico-cloud#readme",
"repository": "https://github.com/CMeeg/gridsome-source-kentico-cloud.git",
"homepage": "https://github.com/CMeeg/gridsome-source-kentico-kontent#readme",
"repository": "https://github.com/CMeeg/gridsome-source-kentico-kontent.git",
"main": "src/index.js",
"keywords": [
"gridsome",
"gridsome-plugin",
"gridsome-source",
"kentico-cloud"
"kentico-kontent",
"kontent"
],
"files": [
"src/*.js"
Expand Down
5 changes: 2 additions & 3 deletions src/GridsomeContentItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class GridsomeContentItem extends ContentItem {

if (richTextHtmlTransformer.canTransformLinks()) {
defaultData.urlSlugResolver = (link, context) => {
// TODO: Ask Kentico Cloud why this seems to be being ignored
// TODO: Does this now work?
// TODO: This doesn't always appear to get called - raise issue with Kentico Kontent when have repro steps
// Removing this results in warnings from the DeliveryClient when advanced logging is turned on
return this.resolveLink(link, context);
};
Expand Down Expand Up @@ -120,7 +119,7 @@ class GridsomeContentItem extends ContentItem {
if (element.type === 'asset') {
field.value = field.value.map(asset => {
// We will use the asset url as the id as it is unique, and the id is not provided
// TODO: Ask Kentico Cloud if it can be provided
// TODO: Raise issue with Kentico Kontent to ask if asset ids can be provided

asset.id = asset.url;

Expand Down
6 changes: 3 additions & 3 deletions src/GridsomeRichTextHtmlTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ class GridsomeRichTextHtmlTransformer {

const $ = cheerio.load(html, { decodeEntities: false });

// Kentico Cloud can return an empty paragraph element if there is no content, which is of no use
// Kentico Kontent can return an empty paragraph element if there is no content, which is of no use
// If the rich text element has no text content, just return an empty string

if ($(`.${wrapperCssClass}`).text().trim() === '') {
return '';
}

// Transform item links
// N.B. This shouldn't be necessary, but the `urlSlugResolver` feature of the Kentico Cloud SDK doesn't appear to work
// TODO: Does the feature now work, and this can be removed?
// N.B. This shouldn't be necessary, but the `urlSlugResolver` feature of the Kentico Kontent SDK doesn't appear to work all of the time
// TODO: If this does work consistently in future, this can be removed

this.transformItemLinks($);

Expand Down
4 changes: 2 additions & 2 deletions src/KenticoCloudSource.js → src/KenticoKontentSource.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { ImageUrlBuilder, ImageCompressionEnum, ImageFormatEnum } = require('@kentico/kontent-delivery');

class KenticoCloudSource {
class KenticoKontentSource {
constructor(deliveryClient, contentItemFactory, taxonomyItemFactory, logger) {
this.deliveryClient = deliveryClient;
this.contentItemFactory = contentItemFactory;
Expand Down Expand Up @@ -399,4 +399,4 @@ class KenticoCloudSource {
}
}

module.exports = KenticoCloudSource;
module.exports = KenticoKontentSource;
16 changes: 8 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const DeliveryClient = require('./GridsomeDeliveryClient');
const KenticoCloudSource = require('./KenticoCloudSource');
const KenticoKontentSource = require('./KenticoKontentSource');
const GridsomeContentItemFactory = require('./GridsomeContentItemFactory');
const GridsomeContentItem = require('./GridsomeContentItem');
const GridsomeTaxonomyItemFactory = require('./GridsomeTaxonomyItemFactory');
const Logger = require('./Logger');

class KenticoCloudSourcePlugin {
class KenticoKontentSourcePlugin {
static defaultOptions() {
return {
deliveryClientConfig: {
Expand Down Expand Up @@ -36,28 +36,28 @@ class KenticoCloudSourcePlugin {
};

constructor(api, options) {
const logger = new Logger('gridsome-source-kentico-cloud');
const logger = new Logger('gridsome-source-kentico-kontent');

api.loadSource(async store => {
const deliveryClient = new DeliveryClient(options.deliveryClientConfig);
const contentItemFactory = new GridsomeContentItemFactory(options.contentItemConfig);
const taxonomyItemFactory = new GridsomeTaxonomyItemFactory(options.taxonomyConfig);

const kenticoCloudSource = new KenticoCloudSource(
const kenticoKontentSource = new KenticoKontentSource(
deliveryClient,
contentItemFactory,
taxonomyItemFactory,
logger
);

logger.log('Started loading content from Kentico Cloud');
logger.log('Started loading content from Kentico Kontent');

await kenticoCloudSource.load(store);
await kenticoKontentSource.load(store);

logger.log('Finished loading content from Kentico Cloud');
logger.log('Finished loading content from Kentico Kontent');
});
}
}

module.exports = KenticoCloudSourcePlugin;
module.exports = KenticoKontentSourcePlugin;
module.exports.GridsomeContentItem = GridsomeContentItem;

0 comments on commit d74bd38

Please sign in to comment.