Skip to content

Commit

Permalink
Merge pull request #43 from Kentico/extractheader
Browse files Browse the repository at this point in the history
Extract tracking header definition
  • Loading branch information
Simply007 authored Jan 9, 2019
2 parents a0c451e + 07c0c15 commit edfaadb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Project dependencies
node_modules

# Output files
/gatsby-node.js
/normalize.js
# Project dependencies
node_modules

# Output files
/gatsby-node.js
/normalize.js
/config.js
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Recursively allow files under subtree¨
!gatsby-node.js
!normalize.js
!config.js
!package.json
!.npmignore
!README.md
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-source-kentico-cloud",
"version": "2.2.0",
"version": "2.2.1",
"description": "Gatsby source plugin for Kentico Cloud",
"main": "./gatsby-node.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/__tests__/gatsby-node.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { TestHttpService } = require('kentico-cloud-core');

const { customTrackingHeader, sourceNodes } = require('../gatsby-node');
const { sourceNodes } = require('../gatsby-node');
const { customTrackingHeader } = require('../config');
const { name, version } = require('../../package.json');

describe('customTrackingHeader', () => {
Expand Down
6 changes: 6 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const customTrackingHeader = {
header: 'X-KC-SOURCE',
value: 'gatsby-source-kentico-cloud;2.2.1',
};

exports.customTrackingHeader = customTrackingHeader;
7 changes: 2 additions & 5 deletions src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ const _ = require(`lodash`);
const { DeliveryClient } = require(`kentico-cloud-delivery`);
const normalize = require(`./normalize`);
const { parse, stringify } = require(`flatted/cjs`);
const { customTrackingHeader } = require('./config')

const defaultLanguageLiteral = `default`;

const customTrackingHeader = {
header: 'X-KC-SOURCE',
value: 'gatsby-source-kentico-cloud;2.2.0',
};
exports.customTrackingHeader = customTrackingHeader;

exports.sourceNodes =
async ({ actions: { createNode }, createNodeId },
Expand Down

0 comments on commit edfaadb

Please sign in to comment.