Skip to content
Permalink
Browse files

Remove console.log πŸ™ˆ

  • Loading branch information...
AileenCGN committed Sep 19, 2019
1 parent a4bfa01 commit 306999f416be9e8047f1d0942763bc26e327ca08
Showing with 66 additions and 61 deletions.
  1. +11 βˆ’11 BaseSiteMapGenerator.js
  2. +7 βˆ’7 IndexMapGenerator.js
  3. +5 βˆ’5 SiteMapGenerator.js
  4. +5 βˆ’5 SiteMapManager.js
  5. +2 βˆ’2 defaults.js
  6. +24 βˆ’25 gatsby-node.js
  7. +10 βˆ’3 gatsby-ssr.js
  8. +0 βˆ’1 src/gatsby-node.js
  9. +2 βˆ’2 utils.js
@@ -3,7 +3,7 @@
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports["default"] = void 0;
exports.default = void 0;

var _lodash = _interopRequireDefault(require("lodash"));

@@ -38,7 +38,7 @@ function () {
_proto.generateXmlFromNodes = function generateXmlFromNodes(options) {
var self = this; // Get a mapping of node to timestamp

var timedNodes = _lodash["default"].map(this.nodeLookup, function (node, id) {
var timedNodes = _lodash.default.map(this.nodeLookup, function (node, id) {
return {
id: id,
// Using negative here to sort newest to oldest
@@ -48,17 +48,17 @@ function () {
}, []); // Sort nodes by timestamp


var sortedNodes = _lodash["default"].sortBy(timedNodes, "ts"); // Grab just the nodes
var sortedNodes = _lodash.default.sortBy(timedNodes, "ts"); // Grab just the nodes


var urlElements = _lodash["default"].map(sortedNodes, "node");
var urlElements = _lodash.default.map(sortedNodes, "node");

var data = {
// Concat the elements to the _attr declaration
urlset: [XMLNS_DECLS].concat(urlElements)
}; // Return the xml

return _utils["default"].getDeclarations(options) + (0, _xml["default"])(data);
return _utils.default.getDeclarations(options) + (0, _xml.default)(data);
};

_proto.addUrl = function addUrl(url, datum) {
@@ -76,15 +76,15 @@ function () {
this.removeFromLookups(datum); // force regeneration of xml

this.siteMapContent = null;
this.lastModified = (0, _moment["default"])(new Date());
this.lastModified = (0, _moment.default)(new Date());
};

_proto.getLastModifiedForDatum = function getLastModifiedForDatum(datum) {
if (datum.updated_at || datum.published_at || datum.created_at) {
var modifiedDate = datum.updated_at || datum.published_at || datum.created_at;
return (0, _moment["default"])(new Date(modifiedDate));
return (0, _moment.default)(new Date(modifiedDate));
} else {
return (0, _moment["default"])(new Date());
return (0, _moment.default)(new Date());
}
};

@@ -102,7 +102,7 @@ function () {
url: [{
loc: url
}, {
lastmod: (0, _moment["default"])(this.getLastModifiedForDatum(datum), _moment["default"].ISO_8601).toISOString()
lastmod: (0, _moment.default)(this.getLastModifiedForDatum(datum), _moment.default.ISO_8601).toISOString()
}]
};
imgNode = this.createImageNodeFromDatum(datum);
@@ -127,7 +127,7 @@ function () {
imageEl = [{
'image:loc': image
}, {
'image:caption': _path["default"].basename(image)
'image:caption': _path.default.basename(image)
}]; // Return the node to be added to the url xml node

return {
@@ -175,4 +175,4 @@ function () {
return BaseSiteMapGenerator;
}();

exports["default"] = BaseSiteMapGenerator;
exports.default = BaseSiteMapGenerator;
@@ -3,7 +3,7 @@
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports["default"] = void 0;
exports.default = void 0;

var _lodash = _interopRequireDefault(require("lodash"));

@@ -40,7 +40,7 @@ function () {
sitemapindex: [XMLNS_DECLS].concat(urlElements)
}; // Return the xml

return _utils["default"].getDeclarations(options) + (0, _xml["default"])(data);
return _utils.default.getDeclarations(options) + (0, _xml.default)(data);
};

_proto.generateSiteMapUrlElements = function generateSiteMapUrlElements(_ref) {
@@ -50,17 +50,17 @@ function () {
siteUrl = _ref.siteUrl,
pathPrefix = _ref.pathPrefix,
resourcesOutput = _ref.resourcesOutput;
return _lodash["default"].map(sources, function (source) {
return _lodash.default.map(sources, function (source) {
var filePath = resourcesOutput.replace(/:resource/, source.name).replace(/^\//, "");

var siteMapUrl = _url["default"].resolve(siteUrl, _path["default"].join(pathPrefix, filePath));
var siteMapUrl = _url.default.resolve(siteUrl, _path.default.join(pathPrefix, filePath));

var lastModified = _this.types[source.sitemap].lastModified || (0, _moment["default"])(new Date(), _moment["default"].ISO_8601).toISOString();
var lastModified = _this.types[source.sitemap].lastModified || (0, _moment.default)(new Date(), _moment.default.ISO_8601).toISOString();
return {
sitemap: [{
loc: siteMapUrl
}, {
lastmod: (0, _moment["default"])(lastModified).toISOString()
lastmod: (0, _moment.default)(lastModified).toISOString()
}]
};
});
@@ -69,4 +69,4 @@ function () {
return SiteMapIndexGenerator;
}();

exports["default"] = SiteMapIndexGenerator;
exports.default = SiteMapIndexGenerator;
@@ -3,7 +3,7 @@
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports["default"] = void 0;
exports.default = void 0;

var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));

@@ -16,20 +16,20 @@ var _BaseSiteMapGenerator2 = _interopRequireDefault(require("./BaseSiteMapGenera
var SiteMapGenerator =
/*#__PURE__*/
function (_BaseSiteMapGenerator) {
(0, _inheritsLoose2["default"])(SiteMapGenerator, _BaseSiteMapGenerator);
(0, _inheritsLoose2.default)(SiteMapGenerator, _BaseSiteMapGenerator);

function SiteMapGenerator(opts, type) {
var _this;

_this = _BaseSiteMapGenerator.call(this) || this;
_this.name = type || "pages";

_lodash["default"].extend((0, _assertThisInitialized2["default"])(_this), opts);
_lodash.default.extend((0, _assertThisInitialized2.default)(_this), opts);

return _this;
}

return SiteMapGenerator;
}(_BaseSiteMapGenerator2["default"]);
}(_BaseSiteMapGenerator2.default);

exports["default"] = SiteMapGenerator;
exports.default = SiteMapGenerator;
@@ -3,7 +3,7 @@
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports["default"] = void 0;
exports.default = void 0;

var _IndexMapGenerator = _interopRequireDefault(require("./IndexMapGenerator"));

@@ -27,7 +27,7 @@ function () {
} // ensure, we have a cleaned up array


sitemapTypes = _lodash["default"].uniq(sitemapTypes); // create sitemaps for each type
sitemapTypes = _lodash.default.uniq(sitemapTypes); // create sitemaps for each type

sitemapTypes.forEach(function (type) {
_this[type] = options[type] || _this.createSiteMapGenerator(options, type);
@@ -46,13 +46,13 @@ function () {
sitemapTypes.forEach(function (type) {
return types[type] = _this2[type];
});
return new _IndexMapGenerator["default"]({
return new _IndexMapGenerator.default({
types: types
});
};

_proto.createSiteMapGenerator = function createSiteMapGenerator(options, type) {
return new _SiteMapGenerator["default"](options, type);
return new _SiteMapGenerator.default(options, type);
};

_proto.getIndexXml = function getIndexXml(options) {
@@ -74,4 +74,4 @@ function () {
return SiteMapManager;
}();

exports["default"] = SiteMapManager;
exports.default = SiteMapManager;
@@ -1,7 +1,7 @@
"use strict";

exports.__esModule = true;
exports["default"] = void 0;
exports.default = void 0;
// These are the default options which can be overwritten
// in gatsby-config.js
var defaultOptions = {
@@ -15,4 +15,4 @@ var defaultOptions = {
createLinkInHead: true
};
var _default = defaultOptions;
exports["default"] = _default;
exports.default = _default;

0 comments on commit 306999f

Please sign in to comment.
You can’t perform that action at this time.