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

@sbircatalog/sbir-catalog-api-plugin-vendors

v0.0.3

Published

Proprietary Reaction Commerce Plugin for SBIR Catalog that adds Vendor functionality to the RC API

Downloads

1

Readme

Vendors API Plugin

This plugin adds a Vendor collection to the Reaction MongoDB database and exposes GraphQL API methods for interacting with that collection. The Vendor collection stores SBIR Vendor data. Details on the Vendor entity can be found in src/simpleSchema.js.

This plugin adds the following GraqhQL queries:

  • vendor: Query for a single Vendor
  • vendorProducts: Returns Products associated with the Vendor ID
  • vendors: Query for a list of Vendors

This plugin adds the following GraqhQL mutations:

  • createVendor: Create a new Vendor
  • deleteVendor: Delete an existing Vendor
  • updateVendor: Update an existing Vendor

Getting started

Understanding Reaction Plugins

To be able to work with this plugin, you need to understand what Reaction Plugins are and how they work. Some good resources for doing so:

Local Development Strategy

Perhaps the biggest challenge in working with RC plugins is figuring out how to configure a local dev environment where you can test your changes as you code.

The suggested development strategy, which is far from perfect, is to use a submodule strategy within the reaction repo and to develop the plugin from inside the submodule of that repo. Detailed instructions:

  • Clone sellry/reaction Note: I strongly recommend you do this in some kind of 'playground' directory. Git submodules are a bit odd, and I've found best practice is to nuke this repository when you are done with it. Keep this 'playground' separate from any 'active development' repo you have for sellry/reaction
  • Within the cloned repo, add this repository as a plugin $ git submodule add [this repo via SSH or HTTPS]
  • In src/index.js of the reaction repo, import the submodule as vendorPlugin and add it to the plugins that are registered as part of the ReactionAPICore (plugins.vendors = vendorPlugin;)
  • Follow the instructions in docker-compose.dev.yml to enter development mode within reaction
  • Follow the instructions in the README to 'Start App in Docker Container'
  • Reaction should now be running via Docker with this plugin installed!

To develop in this environment:

  • cd into the sbir-catalog-api-plugin-vendors module
  • make changes as needed. To see changes live, you need to docker-compose up/down (not ideal, sorry - a docker expert could probably mount the submodule as a volume and do HMR)
  • you can commit/push/pull/branch as normal from inside the submodule inside the reaction repo.

The main benefit of this strategy is the ability to test your changes against the rest of the RC platform, finding bugs quickly without having to publish new versions of the NPM package.


Publishing new versions

  1. Update the version number in package.json
  2. Run $ npm publish

Dependencies

Babel

Babel config is pulled from @reactioncommerce/api-utils and can be found here

Reaction Plugins


Improvements List

  • Unit Testing
  • Linting
  • Local dev strategy that doesn't require full Reaction (import necessary pieces into this repo, but make sure they don't get bundled in the package, try to follow the guide here, specifically the part around @reactioncommerce/api-core)
  • Authorization (anyone can make create/update/delete)
  • admin-plugin-vendors may be desired to add a 'Vendors' tab to the RC admin tools where operators can browse various Vendors
  • fork of api-plugins with the goal of removing Vendor data from Product metadata and instead to serve that data via an additional Mongo query when Vendor data is requested on a Product