From cb316cae7c1bdb550b2c046fd697b06f9290dc0a Mon Sep 17 00:00:00 2001 From: James Stack Date: Mon, 29 Jan 2018 21:28:26 -0800 Subject: [PATCH] Remove commented out code --- .../src/gatsby-node.js | 11 ++- www/src/templates/template-docs-packages.js | 2 - www/src/templates/template-remote-packages.js | 99 ------------------- 3 files changed, 6 insertions(+), 106 deletions(-) delete mode 100644 www/src/templates/template-remote-packages.js diff --git a/packages/gatsby-source-npm-package-search/src/gatsby-node.js b/packages/gatsby-source-npm-package-search/src/gatsby-node.js index 68d6c2b859433..dc5c4e5573ee6 100644 --- a/packages/gatsby-source-npm-package-search/src/gatsby-node.js +++ b/packages/gatsby-source-npm-package-search/src/gatsby-node.js @@ -27,6 +27,10 @@ exports.sourceNodes = async ({ boundActionCreators }, {keywords}) => { hitsPerPage: 1000, }) + // Currently the gatsby-transformer-remark plugin + // has a hard time with markdown that includes + // images -> for now this filters out those packages + data.hits.forEach(hit => { if (hit.readme.includes("![")){ return @@ -51,14 +55,11 @@ exports.sourceNodes = async ({ boundActionCreators }, {keywords}) => { delete hit._highlightResult delete hit.versions - const modified = new Date(hit.modified) - const created = new Date(hit.created) - hit.modified = modified - hit.created = created - const node = { ...hit, deprecated: `${hit.deprecated}`, + created: new Date(hit.created), + modified: new Date(hit.modified), id: parentId, parent: null, children: [], diff --git a/www/src/templates/template-docs-packages.js b/www/src/templates/template-docs-packages.js index 330b5f81de730..b7aa444981523 100644 --- a/www/src/templates/template-docs-packages.js +++ b/www/src/templates/template-docs-packages.js @@ -2,7 +2,6 @@ import React from "react" import Helmet from "react-helmet" import distanceInWords from 'date-fns/distance_in_words' -import MarkdownPageFooter from "../components/markdown-page-footer" import { rhythm, scale } from "../utils/typography" import presets from "../utils/presets" import Container from "../components/container" @@ -84,7 +83,6 @@ class DocsPackagesTemplate extends React.Component { __html: html, }} /> - {/* */} ) } diff --git a/www/src/templates/template-remote-packages.js b/www/src/templates/template-remote-packages.js deleted file mode 100644 index 5d8b5b9586695..0000000000000 --- a/www/src/templates/template-remote-packages.js +++ /dev/null @@ -1,99 +0,0 @@ -import React from "react" -import Helmet from "react-helmet" -import distanceInWords from 'date-fns/distance_in_words' -import typography, { rhythm } from "../utils/typography" - -import MarkdownPageFooter from "../components/markdown-page-footer" - -import Container from "../components/container" - -class RemotePackagesTemplate extends React.Component { - render(){ - const deprecated = this.props.data.npmPackage.deprecated === "false" ? false : true - const page = this.props.data.npmPackage.readme.childMarkdownRemark - const info = this.props.data.npmPackage - const lastUpdated = `${distanceInWords(new Date(info.modified), new Date())} ago`; - return( - - - - -
-

{info.name}

-

{info.deprecated}

-
- -
- Browse source code for this package on Github - -
- {info.keywords.join(", ")} -
- -
- - {info.lastPublisher.name} - {lastUpdated} -
- - -
- -
- {/* */} - - ) - } -} - -export default RemotePackagesTemplate; - -export const npmQuery = graphql` - query TemplateRemoteMarkdown($id: String!) { - npmPackage(id: {eq: $id}){ - name - description - deprecated - keywords - lastPublisher{ - name - avatar - } - modified - repository{ - url - project - user - } - humanDownloadsLast30Days - readme{ - childMarkdownRemark{ - html - } - } - } - } -`