Skip to content

Gatsby source plugin to source contents of npm package.json

License

Notifications You must be signed in to change notification settings

kolossal-io/gatsby-source-package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gatsby-source-package

This plugin allows you to source the contents of package.json.

Install

npm install --save gatsby-source-package

or

yarn add gatsby-source-package

How to use

Add the plugin to gatsby-config.js..

module.exports = {
  plugins: [...`gatsby-source-package`],
};

You may only source some of the keys in package.json:

module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-package`,
      options: {
        only: ['name', 'version', 'description'],
      },
    },
  ],
};

Query package.json

The GraphQL query will match your package.json:

query {
  package {
    name
    version
    description
  }
}

Result:

{
  "data": {
    "package": {
      "name": "gatsby-starter-hello-world",
      "version": "0.1.0",
      "description": "A simplified bare-bones starter for Gatsby"
    }
  },
  "extensions": {}
}

About

Gatsby source plugin to source contents of npm package.json

Resources

License

Stars

Watchers

Forks

Packages

No packages published