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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@by-association-only/graphql-app-config

v1.5.0

Published

BAO's Shopify App helpers

Readme

@by-association-only/graphql-app-config

GraphQL codegen configuration for Shopify apps. One getConfig() call in graphql.config.js wires up schema introspection, base types, and typed operations for the Admin and Storefront APIs.

Install

bun add -D @by-association-only/graphql-app-config @graphql-codegen/cli graphql

Single API (Admin)

// graphql.config.js
import { getConfig } from '@by-association-only/graphql-app-config'

export default getConfig({
	apiVersion: '2026-07',
	documents: ['./src/**/*.{ts,tsx}'],
	outputDir: './src/types',
})

Running graphql-codegen produces, in outputDir:

| File | Purpose | |------|---------| | admin-{version}.schema.json | Cached introspected schema (generated once) | | admin.types.ts | Base schema types | | admin.generated.ts | Typed operations for your documents |

Admin consumers bind the generated operations to the client by wrapping the interface extension themselves via preset.extendInterfaceExtension — see test/fixtures/cli-app/graphql.config.js for a complete working example (it is exercised by the test suite with the real graphql-codegen CLI).

Admin and Storefront side by side

Pass an array — each entry keeps its own documents glob, API version, and output files, generated in one graphql-codegen run with no cross-contamination:

import { ApiType, getConfig } from '@by-association-only/graphql-app-config'

export default getConfig([
	{
		apiVersion: '2026-07',
		documents: ['./src/**/*.{ts,tsx}'],
		outputDir: './src/types',
	},
	{
		apiType: ApiType.Storefront,
		apiVersion: '2026-01',
		documents: ['./src/storefront/**/*.{ts,tsx}'],
		outputDir: './src/types',
	},
])

This adds storefront-{version}.schema.json, storefront.types.ts, and storefront.generated.ts alongside the admin files.

Unlike Admin, the storefront output augments @by-association-only/shopify-graphql-client out of the box — no extendInterfaceExtension needed. Import the generated file once and storefront calls are typed, @inContext included:

import { createStorefrontClient } from '@by-association-only/shopify-graphql-client'
import './types/storefront.generated'

const client = createStorefrontClient({
	apiVersion: '2026-01',
	privateAccessToken: env.STOREFRONT_PRIVATE_TOKEN,
	shop: 'example.myshopify.com',
})

const response = await client.request(ProductsQuery, {
	variables: { country: CountryCode.Gb, language: LanguageCode.En },
})

How multi-API mode composes

The codegen CLI only reads the default graphql-config project, and merges any project-level documents/schema into every generates target. So in array mode:

  • all generates targets live on the default project, each carrying its own documents and schema;
  • the default project itself carries neither;
  • per-API projects (admin, storefront) expose documents + schema for IDE tooling only.

Single-object calls keep the exact shape previous versions produced.

Scalars

Shopify's DateTime and URL scalars map to string by default, so fields like Metaobject.createdAt, Metaobject.updatedAt and Image.url infer as string rather than unknown. The defaults apply to every generated API (Admin, Storefront, Customer); scalars absent from a schema are ignored.

Pass scalars to add or override mappings. Explicit entries win over the defaults, and other Shopify scalars keep their existing behaviour:

export default getConfig({
	apiVersion: '2026-07',
	documents: ['./src/**/*.{ts,tsx}'],
	outputDir: './src/types',
	scalars: {
		// override a default
		DateTime: 'Date',
		// add your own
		Decimal: 'number',
	},
})

A string maps both the input and output positions; pass { input, output } to target them independently.

Extensions

Directories under ./extensions/ containing a schema.graphql are added as their own graphql-config projects automatically.