Add Prettier Formatting (#258)

* Add Prettier formatting to source files and example files, and check that Prettier formatting is maintained on PRs

* Remove trailing-comma as we are using Node 6 on Circle

* Use latest Node 6 LTS version in Circle

* Remove unused test
This commit is contained in:
Héctor Ramos 2017-12-04 19:21:02 -08:00 committed by Joel Marcey
parent 0cead4b6f9
commit 65421db62e
50 changed files with 1376 additions and 1350 deletions

View file

@ -5,18 +5,18 @@
* LICENSE file in the root directory of this source tree.
*/
const fs = require("fs-extra");
const path = require("path");
const os = require("os");
const Feed = require("feed");
const fs = require('fs-extra');
const path = require('path');
const os = require('os');
const Feed = require('feed');
const chalk = require("chalk");
const chalk = require('chalk');
const CWD = process.cwd();
const siteConfig = require(CWD + "/siteConfig.js");
const siteConfig = require(CWD + '/siteConfig.js');
const blogFolder = path.resolve("../blog/");
const blogRootURL = siteConfig.url + "/blog";
const blogFolder = path.resolve('../blog/');
const blogRootURL = siteConfig.url + '/blog';
const jestImage = siteConfig.url + siteConfig.headerIcon;
/****************************************************************************/
@ -24,40 +24,40 @@ const jestImage = siteConfig.url + siteConfig.headerIcon;
let readMetadata;
let Metadata;
readMetadata = require("./readMetadata.js");
readMetadata = require('./readMetadata.js');
readMetadata.generateMetadataDocs();
Metadata = require("../core/metadata.js");
Metadata = require('../core/metadata.js');
/****************************************************************************/
module.exports = function(type) {
console.log("feed.js triggered...");
console.log('feed.js triggered...');
type = type || "rss";
type = type || 'rss';
readMetadata.generateMetadataBlog();
const MetadataBlog = require("../core/MetadataBlog.js");
const MetadataBlog = require('../core/MetadataBlog.js');
const feed = new Feed({
title: siteConfig.title + " Blog",
title: siteConfig.title + ' Blog',
description:
"The best place to stay up-to-date with the latest " +
'The best place to stay up-to-date with the latest ' +
siteConfig.title +
" news and events.",
' news and events.',
id: blogRootURL,
link: blogRootURL,
image: jestImage,
copyright: siteConfig.copyright,
updated: new Date(MetadataBlog[0].date)
updated: new Date(MetadataBlog[0].date),
});
MetadataBlog.forEach(post => {
const url = blogRootURL + "/" + post.path;
let content = "";
if (post.content.indexOf("<!--truncate-->") == -1) {
const url = blogRootURL + '/' + post.path;
let content = '';
if (post.content.indexOf('<!--truncate-->') == -1) {
content = post.content.trim().substring(0, 250);
} else {
let contentArr = post.content.split("<!--truncate-->");
let contentArr = post.content.split('<!--truncate-->');
if (contentArr.length > 0) {
content = contentArr[0];
}
@ -69,13 +69,13 @@ module.exports = function(type) {
author: [
{
name: post.author,
link: post.authorURL
}
link: post.authorURL,
},
],
date: new Date(post.date),
description: content
description: content,
});
});
return type === "rss" ? feed.rss2() : feed.atom1();
return type === 'rss' ? feed.rss2() : feed.atom1();
};