npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gatsby-plugin-stamped

v1.0.5

Published

Unofficial plugin source from Stamped.io

Downloads

384

Readme

Installation

npm install gatsby-plugin-stamped

or

yarn add gatsby-plugin-stamped

Configuration

For the basic configuration of the plug-in, you need publicKey, secretKey and storeHash, which you can find in your Stamped panel. You can learn more information on where to find both keys here.

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: 'gatsby-plugin-stamped',
      options: {
        publicKey: process.env.STAMPED_PUB,
        secretKey: process.env.STAMPED_SECRET,
        storeHash: process.env.STAMPED_HASH
      }
    }
  ]
};

Options

| Key | Type | Description | |--|--|--| | publicKey | String (required) | The public API key with which you authenticate to the Stamped system from an external source. This can be found here. | | secretKey | String (required) | The secret API key with which you authenticate to the Stamped system from an external source. This can be found here. | | storeHash | String (required) | The hash number, which is the shop number and is used to complete the endpoint you are trying to connect to. This can be found here. | | summaryReview | Boolean (Default: true) | An option to disable the downloading of the overall total of all Stamped assessments. | | downloadAssets | Boolean (Default: false) | Download and cache all product images used in the reviews to the app memory. | | assetsDir | String (Default: .stamped) | Set to the name of the local cache directory. |

Features

Usage Stamped Review

All reviews and the resources from which the reviews consist are available in the StampedReview node.

{
  allStampedReview {
    nodes {
      review {
        id
      }
    }
  }
}

Usage Stamped rating summary

All your reviews are aggregated and the resources associated with them you can always use using the allStampedRatingSummary node.

{
  allStampedRatingSummary {
    nodes {
      id
    }
  }
}

If you don't need to use just add summaryReview to the plugin settings.

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: 'gatsby-plugin-stamped',
      options: {
        publicKey: process.env.STAMPED_PUB,
        secretKey: process.env.STAMPED_SECRET,
        storeHash: process.env.STAMPED_HASH,
        summaryReview: false
      }
    }
  ]
};

Downloading local image assets

If you prefer, the source plugin also provides the option to download and cache Stamped assets in your Gatsby project.

To enable this, add downloadAssets: true to your plugin configuration. This downloads all assets.

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: 'gatsby-plugin-stamped',
      options: {
        publicKey: process.env.STAMPED_PUB,
        secretKey: process.env.STAMPED_SECRET,
        storeHash: process.env.STAMPED_HASH,
        downloadAssets: true
      }
    }
  ]
};

This adds a localFile field to the StampedAsset type which resolves to the file node generated at build by gatsby-source-filesystem.

{
  allStampedAsset {
    nodes {
      localFile {
        childImageSharp {
          gatsbyImageData(placeholder: BLURRED)
        }
      }
    }
  }
}

Usage with gatsby-plugin-image

Requires gatsby-plugin-image as a project dependency.

Use the gatsbyImageData resolver on your StampedAsset nodes.

{
  allStampedAsset {
    nodes {
      gatsbyImageData(placeholder: DOMINANT_COLOR)
    }
  }
}

gatsbyImageData resolver arguments

| Key | Type | Description | |--|--|--| | aspectRatio | Float | Force a specific ratio between the image’s width and height. | | backgroundColor | String | Background color applied to the wrapper. | | breakpoints | [Int] | Output widths to generate for full width images. Default is to generate widths for common device resolutions. It will never generate an image larger than the source image. The browser will automatically choose the most appropriate. | | height | Int | Change the size of the image. | | layout | GatsbyImageLayout (CONSTRAINED/FIXED/FULL_WIDTH) | Determines the size of the image and its resizing behavior. | | outputPixelDensities | [Float] | A list of image pixel densities to generate. It will never generate images larger than the source, and will always include a 1x image. The value is multiplied by the image width, to give the generated sizes. For example, a 400 px wide constrained image would generate 100, 200, 400 and 800 px wide images by default. Ignored for full width layout images, which use breakpoints instead. | | quality | Int | The default image quality generated. This is overridden by any format-specific options. | | sizes | String | The <img> sizes attribute, passed to the img tag. This describes the display size of the image, and does not affect generated images. You are only likely to need to change this if your are using full width images that do not span the full width of the screen. | | width | Int | Change the size of the image. |

For more information on using gatsby-plugin-image, please see the documentation.

Authors