@tryghost/mg-tinynews 0.0.24 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {mapContent} from './lib/mapper.js';
2
2
 
3
- export default async (args, logger) => {
4
- let result = await mapContent(args, logger);
3
+ export default async (args) => {
4
+ let result = await mapContent(args);
5
5
 
6
6
  return result;
7
7
  };
@@ -214,7 +214,7 @@ const EntrySpotifyEmbed = (block) => {
214
214
  return blockHtml;
215
215
  };
216
216
 
217
- const jsonToHtml = (blocks, logger) => {
217
+ const jsonToHtml = (blocks) => {
218
218
  let html = [];
219
219
 
220
220
  if (typeof blocks === 'string') {
@@ -237,8 +237,8 @@ const jsonToHtml = (blocks, logger) => {
237
237
  } else if (itemStyle === 'NORMAL_TEXT') {
238
238
  html.push(EntryText(block));
239
239
  } else {
240
- logger.error({
241
- message: `Unhandled text type: ${itemType} - Unhandled style: ${itemStyle}`,
240
+ // eslint-disable-next-line no-console
241
+ console.error(`Unhandled text type: ${itemType} - Unhandled style: ${itemStyle}`, {
242
242
  context: block
243
243
  });
244
244
  }
@@ -272,14 +272,14 @@ const jsonToHtml = (blocks, logger) => {
272
272
  } else if (block.link.includes('https://docs.google.com')) {
273
273
  html.push(EntryGoogleDocsEmbed(block));
274
274
  } else {
275
- logger.error({
276
- message: `Unhandled embed: ${block.link}`,
275
+ // eslint-disable-next-line no-console
276
+ console.error(`Unhandled embed: ${block.link}`, {
277
277
  context: block
278
278
  });
279
279
  }
280
280
  } else {
281
- logger.error({
282
- message: `Unhandled type: ${itemType} - Unhandled style: ${itemStyle}`,
281
+ // eslint-disable-next-line no-console
282
+ console.error(`Unhandled type: ${itemType} - Unhandled style: ${itemStyle}`, {
283
283
  context: block
284
284
  });
285
285
  }
package/lib/mapper.js CHANGED
@@ -55,7 +55,7 @@ const processAuthor = (author, authorsData) => {
55
55
  return authorObject;
56
56
  };
57
57
 
58
- const mapPostPageConfig = (args, logger) => {
58
+ const mapPostPageConfig = (args) => {
59
59
  const {postData, authorsData, postType} = args;
60
60
 
61
61
  debug(`Mapping data for ${postData.slug}`);
@@ -86,7 +86,7 @@ const mapPostPageConfig = (args, logger) => {
86
86
  };
87
87
 
88
88
  if (postType !== 'newsletter' && postData.translations[0].content) {
89
- mappedData.data.html = jsonToHtml(postData.translations[0].content, logger);
89
+ mappedData.data.html = jsonToHtml(postData.translations[0].content);
90
90
  }
91
91
 
92
92
  if (mappedData.data.html.includes('class="fb-post')) {
@@ -222,7 +222,7 @@ const processNewsletterContent = (html, options) => { // eslint-disable-line no-
222
222
  return `<!--kg-card-begin: html-->${cleanedHTML}<!--kg-card-end: html-->`;
223
223
  };
224
224
 
225
- const mapNewsletterConfig = (args, logger) => { // eslint-disable-line no-unused-vars
225
+ const mapNewsletterConfig = (args) => { // eslint-disable-line no-unused-vars
226
226
  const {postData, options} = args;
227
227
 
228
228
  debug(`Mapping data for ${postData.slug}`);
@@ -276,7 +276,7 @@ const mapNewsletterConfig = (args, logger) => { // eslint-disable-line no-unused
276
276
  return mappedData;
277
277
  };
278
278
 
279
- const mapContent = async (args, logger) => {
279
+ const mapContent = async (args) => {
280
280
  const {options} = args;
281
281
  const {articles, pages, newsletters, authors} = options;
282
282
 
@@ -302,7 +302,7 @@ const mapContent = async (args, logger) => {
302
302
  authorsData: authorDataJSON,
303
303
  postType: 'post',
304
304
  options
305
- }, logger));
305
+ }));
306
306
  });
307
307
  }
308
308
 
@@ -317,7 +317,7 @@ const mapContent = async (args, logger) => {
317
317
  authorsData: authorDataJSON,
318
318
  postType: 'page',
319
319
  options
320
- }, logger));
320
+ }));
321
321
  });
322
322
  }
323
323
 
@@ -330,7 +330,7 @@ const mapContent = async (args, logger) => {
330
330
  output.posts.push(mapNewsletterConfig({
331
331
  postData: data,
332
332
  options
333
- }, logger));
333
+ }));
334
334
  });
335
335
  }
336
336
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/mg-tinynews",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-tinynews",
5
5
  "author": "Ghost Foundation",
6
6
  "license": "MIT",
@@ -21,17 +21,17 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "eslint": "8.57.0",
24
- "jest": "29.7.0",
25
- "jest-extended": "4.0.2"
24
+ "jest": "30.0.3",
25
+ "jest-extended": "6.0.0"
26
26
  },
27
27
  "dependencies": {
28
- "@tryghost/debug": "0.1.33",
29
- "@tryghost/errors": "1.3.6",
30
- "@tryghost/kg-default-cards": "10.1.1",
31
- "@tryghost/string": "0.2.12",
28
+ "@tryghost/debug": "0.1.35",
29
+ "@tryghost/errors": "1.3.8",
30
+ "@tryghost/kg-default-cards": "10.1.5",
31
+ "@tryghost/string": "0.2.17",
32
32
  "cheerio": "1.0.0-rc.12",
33
- "sanitize-html": "2.15.0",
33
+ "sanitize-html": "2.17.0",
34
34
  "simple-dom": "1.4.0"
35
35
  },
36
- "gitHead": "c0d0850c491eb693ffbd33fd68f88ca87bb15f6a"
36
+ "gitHead": "958389c2c9667c0e7e44f983d4fd1aa256caff4d"
37
37
  }