Skip to content

Commit

Permalink
Pick values off plugin's package.json to avoid weird metadata from NPM (
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews authored Jun 2, 2017
1 parent ca6572a commit a0293b3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const crypto = require(`crypto`)
const moment = require(`moment`)
const chokidar = require(`chokidar`)
const systemPath = require(`path`)
const _ = require(`lodash`)

const { emitter } = require(`../../redux`)
const { boundActionCreators } = require(`../../redux/actions`)
Expand Down Expand Up @@ -35,7 +36,17 @@ exports.sourceNodes = ({ boundActionCreators, store }) => {
createNode({
...plugin,
packageJson: {
...require(`${plugin.resolve}/package.json`),
..._.pick(require(`${plugin.resolve}/package.json`), [
`name`,
`description`,
`version`,
`main`,
`keywords`,
`author`,
`license`,
`dependencies`,
`devDependencies`,
]),
},
id: `Plugin ${plugin.name}`,
parent: `SOURCE`,
Expand Down
4 changes: 3 additions & 1 deletion packages/gatsby/src/redux/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ actions.createNode = (node, plugin, traceId) => {
stripIndent`
The plugin "${plugin.name}" created a node of a type owned by another plugin.
The node type "${node.internal.type}" is owned by "${typeOwners[node.internal.type]}".
The node type "${node.internal.type}" is owned by "${typeOwners[
node.internal.type
]}".
If you copy and pasted code from elsewhere, you'll need to pick a new type name
for your new node(s).
Expand Down

0 comments on commit a0293b3

Please sign in to comment.