From e45c41ab0f4ae3232fbfb382ceb2489d95cd0fbb Mon Sep 17 00:00:00 2001 From: axe312ger Date: Wed, 16 Feb 2022 13:56:04 +0100 Subject: [PATCH] fix(contentful): avoid confusion of Gatsby node and Contentful node count in logs --- .../src/__tests__/gatsby-node.js | 16 ++++++++-------- .../gatsby-source-contentful/src/source-nodes.js | 8 ++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/gatsby-source-contentful/src/__tests__/gatsby-node.js b/packages/gatsby-source-contentful/src/__tests__/gatsby-node.js index 02789dc29e4b6..9a5dcb9094dc3 100644 --- a/packages/gatsby-source-contentful/src/__tests__/gatsby-node.js +++ b/packages/gatsby-source-contentful/src/__tests__/gatsby-node.js @@ -461,7 +461,7 @@ describe(`gatsby-node`, () => { "Contentful: 0 deleted entries", ], Array [ - "Contentful: 22 cached entries", + "Contentful: 11 cached entries", ], Array [ "Contentful: 1 new assets", @@ -470,7 +470,7 @@ describe(`gatsby-node`, () => { "Contentful: 0 updated assets", ], Array [ - "Contentful: 8 cached assets", + "Contentful: 4 cached assets", ], Array [ "Contentful: 0 deleted assets", @@ -551,7 +551,7 @@ describe(`gatsby-node`, () => { "Contentful: 0 deleted entries", ], Array [ - "Contentful: 28 cached entries", + "Contentful: 14 cached entries", ], Array [ "Contentful: 0 new assets", @@ -560,7 +560,7 @@ describe(`gatsby-node`, () => { "Contentful: 0 updated assets", ], Array [ - "Contentful: 10 cached assets", + "Contentful: 5 cached assets", ], Array [ "Contentful: 0 deleted assets", @@ -653,7 +653,7 @@ describe(`gatsby-node`, () => { "Contentful: 1 deleted entries", ], Array [ - "Contentful: 28 cached entries", + "Contentful: 14 cached entries", ], Array [ "Contentful: 0 new assets", @@ -662,7 +662,7 @@ describe(`gatsby-node`, () => { "Contentful: 0 updated assets", ], Array [ - "Contentful: 10 cached assets", + "Contentful: 5 cached assets", ], Array [ "Contentful: 0 deleted assets", @@ -739,7 +739,7 @@ describe(`gatsby-node`, () => { "Contentful: 0 deleted entries", ], Array [ - "Contentful: 28 cached entries", + "Contentful: 14 cached entries", ], Array [ "Contentful: 0 new assets", @@ -748,7 +748,7 @@ describe(`gatsby-node`, () => { "Contentful: 0 updated assets", ], Array [ - "Contentful: 10 cached assets", + "Contentful: 5 cached assets", ], Array [ "Contentful: 1 deleted assets", diff --git a/packages/gatsby-source-contentful/src/source-nodes.js b/packages/gatsby-source-contentful/src/source-nodes.js index c2885ac61358b..935ae07241ffe 100644 --- a/packages/gatsby-source-contentful/src/source-nodes.js +++ b/packages/gatsby-source-contentful/src/source-nodes.js @@ -211,10 +211,14 @@ export async function sourceNodes( reporter.info(`Contentful: ${nodeCounts.newEntry} new entries`) reporter.info(`Contentful: ${nodeCounts.updatedEntry} updated entries`) reporter.info(`Contentful: ${nodeCounts.deletedEntry} deleted entries`) - reporter.info(`Contentful: ${nodeCounts.existingEntry} cached entries`) + reporter.info( + `Contentful: ${nodeCounts.existingEntry / locales.length} cached entries` + ) reporter.info(`Contentful: ${nodeCounts.newAsset} new assets`) reporter.info(`Contentful: ${nodeCounts.updatedAsset} updated assets`) - reporter.info(`Contentful: ${nodeCounts.existingAsset} cached assets`) + reporter.info( + `Contentful: ${nodeCounts.existingAsset / locales.length} cached assets` + ) reporter.info(`Contentful: ${nodeCounts.deletedAsset} deleted assets`) reporter.verbose(`Building Contentful reference map`)