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

graphtots

v1.1.0

Published

Convert your schema to TypeScript types which you can use to make fully type-safe queries to your server. You will know what the server expects and what you will get from the server, without re-generating (unless you change the schema).

Downloads

1

Readme

GraphToTS

Convert your schema to TypeScript types which you can use to make fully type-safe queries to your server. You will know what the server expects and what you will get from the server, without re-generating (unless you change the schema).

[!NOTE] I do not recommend using this for other than exploring, this is not fully tested yet!

Not supported

  • Mutatate
  • Subscribe
  • Alias
  • Local schemas

Feature ideas (beyond the list above)

  • Cached queries
  • Config with more options:
    • Local schema with a remote server
    • Types only (and as CLI flag) Do not hesitate to create an issue with feature ideas!

Usage

Install the package

npm install graphtots

Configure your schema in graphtots.json at the root of your project

{
  "schema": "example.com"
}

Run generator

npx graphtots

Query your server

import { query } from "./graphtots"

// data is fully type-safe based on your schema
const data = await query({
  // Without arguments
  someData: {
    someField: true
  },
  // With arguments
  someOtherData: {
    arguments: {
      arg1: "someValue
    },
    fields: {
      otherField: true,
      nestedField: {
        someNestedField: true
      }
    }
  }
});

query() will fetch your server with a generated query.

Contribution

You are more than welcome to create issues, feature requests or make contributions! I think this package has potential if it has more features and is fully tested. While learning GraphQL I found it very annoying without typesafety. Code generators made it easier, but needing to create a query string manually (without type safety) and then generate again was very time-consuming.

Run locally

Before starting, install PNPM as the package manager.

  1. Clone this repo (or fork)
  2. Run pnpm install
  3. Make changes in the new branch
  4. Test out in /examples/countries or create a new example
  5. Create a pull request