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

@bitovi/stateful-mocks

v0.5.4

Published

Stateful Mock Server upgrades GraphQL's built-in mocks to be truly useful. With XState under the hood, you can simulate custom logic. State machines combined with in-memory data storage make your mocks feel more like real services.

Downloads

3

Readme

stateful-mocks

Stateful Mock Server upgrades GraphQL's built-in mocks to be truly useful. With XState under the hood, you can simulate custom logic. State machines combined with in-memory data storage make your mocks feel more like real services.

  • Produce higher-fidelity, frontend prototypes.
  • Begin writing integration tests before the backend is complete.

Once you've reached consensus on your GraphQL schema, plug it into Stateful Mock Server.

This library is designed to simulate a GraphQL (and Restful in the future) server and generate stateful mocks for your resolvers based in your schema.graphql. Through a custom file called config.json you can describe exactly what state mutations should happen when you make a request and what data those states represent.

Quick Start

Use the generator to add Stateful Mock Server to your existing node project. Whether you have your own schema, or you want to get started with an example schema and config, the process to get started is similar.

npx @bitovi/stateful-mocks init

The generator will ask you a few questions:

  • Config file path
  • GraphQL schema file path
  • Starting config, which can be one of the following options
    • Empty, a minimal config and schema
    • User Admin

The folders and files needed to generate the schema and config will be automatically created for you.

Start With Your Own Schema

Use the Quick Start steps above and choose the "Empty" starting config. Once you've run the generator, paste your GraphQL schema into the generated schema.graphql.

Start With an Example Schema and Config

Use the Quick Start steps above and choose an example starting config.

Run Stateful Mock Server

If you ran the generator, you will have an npm script in your package.json called sms. Run the server with the following command:

npm run sms

If you didn't run the generator, you can run Stateful Mock Server with the following command:

npm run sms -c path/to/config.json -s path/to/schema.graphql [-p PORT]

The server will start after validating your schema and config file.

Releasing a new version

  1. Make sure you are on the main branch and have the latest code

    git checkout main
    git pull
  2. Run the release script for the version you would like to create.

    npm run release:patch

That's it, the CI/CD workflow will do the rest.