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

@bounteous/gridsome-source-moltin

v1.1.0

Published

Elastic Path Commerce Cloud source plugin for Gridsome

Downloads

10

Readme

Elastic Path Commerce Cloud Gridsome Source

Elastic Path's Commerce Cloud API (f.k.a Moltin) source plugin for Gridsome. Pulls your store's catalogue data into a Gridsome project.

Check out the Gridsome Elastic Path Commerce Cloud Starter for a demo utilizing this plugin.

Installation

npm install --save-dev @bounteous/gridsome-source-moltin

Usage

gridsome.config.js

const { join } = require('path');

module.exports = {
  plugins: [
    {
      use: '@bounteous/gridsome-source-moltin',
      options: {
        // Your Elastic Path Commerce Cloud Store Client ID
        // (🔗 https://dashboard.elasticpath.com/app)
        // It's a good idea to store this in an .env file
        clientId: process.env.GRIDSOME_MOLTIN_CLIENT_ID, 
        
        // Optional, Recommended. A directory to cache your store's files.
        // Enables the `image` field in MoltinFile types
        downloadPath: join(__dirname, '../content/moltin/files'),

        // Optional. Needed if you host on your own infrastructure.
        // (🔗 https://github.com/moltin/js-sdk#custom-host)
        host: 'api.mydomain.com',
      },
    },
  ],
};

Schema

This source plugin currently imports a subset of the data available in the following types:

  • MoltinProduct
  • MoltinFile
  • MoltinBrand
  • MoltinCategory
  • MoltinCollection

Routes & Templates

You can create template pages for your project like so:

gridsome.config.js

module.exports = {
  // …
  templates: {
    MoltinBrand: '/brand/:slug',
    MoltinCategory: '/category/:slug',
    MoltinCollection: '/collection/:slug',
    MoltinProduct: '/product/:slug',
  },
  // …
};

templates/MoltinProduct.vue

<template>
  <Layout>
    <h2>{{ $page.product.name }}</h2>

    <p>{{ $page.product.description }}</p>

    <g-image :src="$page.product.main_image.image_desktop" />

    </div>
  </Layout>
</template>

<page-query>
  query($id: ID!) {
    product: moltinProduct(id: $id) {
      id
      sku
      slug
      name
      status
      description
      manage_stock
      commodity_type
      created_at
      updated_at
      price {
        amount
      }
      main_image {
        id
        type
        file_name
        mime_type
        created_at
        # You can use named queries to fetch the same image in multiple sizes
        # Note: you can only use the `image` field if you've turned on file caching. 
        #   See Usage, above.
        image_mobile: image(width: 390, quality: 90)
        image_desktop: image(width: 590, quality: 90)
      }
      categories: belongsTo(filter: { typeName: { eq: MoltinCategory } }) {
        edges {
          node {
            ... on MoltinCategory {
              id
              name
              path
            }
          }
        }
      }
      brands: belongsTo(filter: { typeName: { eq: MoltinBrand } }) {
        edges {
          node {
            ... on MoltinBrand {
              id
              name
              path
            }
          }
        }
      }
      collections: belongsTo(filter: { typeName: { eq: MoltinCollection } }) {
        edges {
          node {
            ... on MoltinCollection {
              id
              name
              path
            }
          }
        }
      }
    }
  }
</page-query>

License

This project is licensed under the MIT License. See LICENSE for details.

Who we are

Bounteous creates big-picture digital solutions that help leading companies deliver transformational brand experiences.

Founded in 2003 in Chicago, Bounteous creates big-picture digital solutions that help leading companies deliver transformational brand experiences. Our expertise includes Strategy, Experience Design, Technology, Analytics and Insight, and Marketing. Bounteous forms problem-solving partnerships with our clients to envision, design, and build their digital futures.

We're hiring! And we are the commerce and front end experts you've been looking for. Meet us.