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

@sdl-codegen/node

v2.0.1

Published

GraphQL .d.ts file generation for SDL-first projects

Downloads

45,007

Readme

This project is for creating the .d.ts files for codebases where you have SDL like:

export const schema = gql`
    type Game {
        id: ID!
        homeTeamID: Int!
        awayTeamID: Int!
        homeTeamScore: Int!
        awayTeamScore: Int!
    }

    type Query {
        games: [Game!]! @skipAuth
        upcomingGames: [Game!]! @skipAuth
        game(id: ID!): Game @requireAuth
    }
`

Then separately, you write functions like:

export const games = () => db.game.findMany({ orderBy: { startDateTime: "asc" } })

export const upcomingGames = () => db.game.findMany({ isCompleted: false, startDateTime: { gt: new Date() } })

export const game = ({ id }) => db.game.findUnique({ where: { id } })

This repo will create .d.ts files which very accurately, and very concisely represent the runtime for these functions. It's goal is to take all of the possible logic which might happen in the TypeScript type system, and pre-bake that into the output of the .d.ts files.

You could think of it as a smaller, more singular focused version of the mature and well-featured graphql-codgen.

Vision

This repo provides the APIs for building a codegen for framework authors, and the goal is not to provide a CLI for a generalized use-case.

It is currently available inside RedwoodJS as an option for experimental SDL code generation.

Pipeline

This app is architected as a pipeline of sorts. Here's the rough stages:

  • Get inputs: GraphQL schema, the source files to represent, Prisma dmmf and dts output config
  • Parse inputs: Parse the GraphQL schema, parse source files into facts about the code, parse the Prisma dmmf
  • Centralize data: Keep a central store of all of these things, and have specific updaters so that a watcher can be built.
  • Generate outputs: Generate .d.ts files for the files we want to generate them for

It's still a bit of a work in progress to have these discrete steps, but it's getting there.

Development

See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md.

Thanks!

Deployment

Make a commit like: git commit --allow-empty -m "feat: Prepare for release"