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

graphql-mocker

v1.3.5

Published

Tool for GraphQL schema managing and split it. USe GraphQl-Faker

Downloads

5

Readme

GraphQL Mocker - GraphQL schema managing tool

Mocker integrates several functionalities that can be used in order to get some help during GraphQL schema development/maintenance, specially for team development.

Quick start

Requirements

  • Yarn (https://yarnpkg.com/lang/en/docs/install/)
  • NodeJS (https://nodejs.org/es/download/current/)
  • 'graphql-faker' (https://github.com/APIs-guru/graphql-faker):
yarn global add graphql-faker

Usage

cli: Mocker cli that integrates all the functionalities. Can be runned by typing:

yarn run cli

Splitter: Splits a schema into separated files; one for each defined entity. Files are classified by its entity type.

cli:

split <schemaPath> [<splitDir>]

Shell:

yarn run split <schemaPath> [<splitDir>]

Merger: Merges a splitted schema into one. The split must follow the same structure used for the splitter tool.

cli:

merge <splitDir> [<schemaDir>] [<overWrite>]

Shell:

yarn run merge <splitDir> [<schemaDir>] [<overWrite>]

Faker: Runs faker for a given schema.

cli:

fak <schemaDir>

Shell:

yarn run fak <schemaDir>

Mocker: Mocks a given schema; prepares it in Faker.

cli:

mock <directory> [<apiName> [<workingAPIs>]]

Shell:

yarn run mock <directory> [<apiName> [<workingAPIs>]]

Saver: Saves mocked schemas (splits them and removes merge files).

cli:

save <directory>

Shell:

yarn run save <directory>

NOTE: all of the commands have a help function (--h|--help) where more detailed information is granted.

Mock use case example:

Let's suppose that we want to work on Transportation's API. What we would like to do is to merge all the other schemas into one, fak them, then merge the Transportation's schema and raise again faker with the new Transportation's schema but this time extending all the other schemas (the last faker raised). To achieve this, we need to have a folder with the following structure*:

mocker
 |
 |- APIs
     |
     |- API1
     |- API2
     |- TransportationAPI
     ...
     |- APIn

(Folder names are user election, these are for use case recreation)

So with this structure, we only need to run the following command:

mock ./APIs TransportationAPI

This will ignore the folder named "TransportationAPI" for the first merge/fak, and extend it for the second fak based on "TransportationAPI"'s folder.

About "extend". When should it be used?

As you may know, "extend" clause permits to add some particularities to types existing on the extending schema. For maintenance purposes we will only permit extending certain types from Gateway API (list above). If you extend any other type , you will get an error when running the "save" procedure.

List of extendible types