Swiftpack.co - Package - Quartz/content

Quartz Content Queries

This repo contains shared GraphQL queries for Quartz content at content.qz.com/graphql.

Queries are used to automatically generate TypeScript types and React hooks for React projects, and Swift types for iOS projects, using Apollo. This repo hosts both an NPM package and a Swift package for client use.

Adding queries

Shared queries can be found in /Queries. Fragments that might be shared in multiple queries are grouped in /Queries/Fragments. Queries related to a single page or function are grouped into folders, for instance, /Queries/Home.

What about __typename?

There’s no need to include __typename in your queries! Types will be introspected automatically.

Generating type definitions

Type definitions are generated automatically when merging to the main branch. (See .github/workflows/generation.yml). However, it’s a good idea to run type generation locally before opening a PR; it can help catch errors like missing fragments or name collisions. If you’d like to test your PR in a consuming repo like qz-react, open the PR, wait for the bot to commit the type definitions, then install the resulting commit in your repo, e.g.:

npm i --save Quartz/content#mysha1

Releases

We’re using GitHub Releases (tags) for versioning. Click on “Releases”, then “Draft a new release”, and tag and title your release using semantic versioning. To update the package in a client project, use: npm i --save Quartz/content#0.0.8.

semver

Client usage

In React projects

npm i --save Quartz/content#0.0.8 # we’re using GitHub Releases (tags) for versioning

Hooks are automatically generated for each operation (query or mutation).

import { useLatestGuidesQuery } from '@quartz/content';

export default function MyComponent() {
	const { data, loading, error } = useLatestGuidesQuery( { variables: { perPage: 3 } } );

In iOS projects

// Package.swift
dependencies: [
    .package(url: "https://github.com/Quartz/content", from: "0.0.8"),
],

Github

link
Stars: 1

Dependencies

Used By

Total: 0

Releases

0.0.10 - 2020-10-26 21:02:02

0.0.9 - 2020-10-24 14:56:07

0.0.8 - 2020-10-24 14:09:59

0.0.7 - 2020-10-23 14:05:40

0.0.6 - 2020-10-20 18:50:28

  • Taxonomy queries
  • Video hub & Member Home (app-only now)
  • Search
  • Apollo Client factory as part of the Swift package

0.0.5 - 2020-10-16 17:39:57

0.0.4 - 2020-10-16 16:47:00

0.0.3 - 2020-10-14 20:45:50

- 2020-10-14 12:28:31

- 2020-10-12 21:22:28