From 8af7c99743a3d1757855326157d8216cbcf7b632 Mon Sep 17 00:00:00 2001 From: James Martindale <11380394+jkmartindale@users.noreply.github.com> Date: Tue, 24 May 2022 14:30:57 -0500 Subject: [PATCH] Rename package to gql-sdl mfw didn't check npm to see if gqlschema was a valid package name (it would be, except there's a package that hasn't been updated in 4 years called `gql-schema`). JavaScript ecosystem moment. --- README.md | 24 ++++++++++++------------ package-lock.json | 8 ++++---- package.json | 12 ++++++------ 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index f4e24d0..aa09d17 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# gqlschema +# GraphQL Schema Downloader (gql-sdl) -CLI tool to pull the GraphQL schema (as GraphQL SDL or JSON) from a given endpoint with introspection enabled. +CLI tool to download the GraphQL schema (as GraphQL SDL or JSON) from a given API with introspection enabled. -This shouldn't have to be a standalone tool, but the state of GraphQL tooling is very unstable and I found myself unable to find a tool I could run just to get a remote GraphQL schema in SDL form. Every recommendation I found either: +This shouldn't have to be a standalone tool, but the state of GraphQL tooling is very unstable and I found myself unable to find a tool I could run just to get a remote GraphQL schema in the native schema definition language (SDL). Every recommendation I found either: - Only returns JSON - No longer works or isn't maintained - Removed the schema download feature at some point @@ -12,15 +12,15 @@ None of that makes sense, so I made this stupid script that does one thing and d ## Installation ```shell -npm install -g gqlschema +npm install -g gql-sdl ``` -gqlschema is also compatible with `npx` if you prefer not to add it to your `PATH`. +gql-sdl is also compatible with `npx` if you prefer not to add it to your `PATH`. ## Usage -By default, gqlschema outputs the SDL to stdout: +By default, gql-sdl outputs the SDL to stdout: ```shell -$ gqlschema https://swapi-graphql.netlify.app/.netlify/functions/index +$ gql-sdl https://swapi-graphql.netlify.app/.netlify/functions/index schema { query: Root } @@ -39,10 +39,10 @@ Output can also be saved to a file with the `-o FILE` option. If you specify bot Use the `-H HEADER` option to send headers (cookies, authorization, user agent, etc.) with the introspection query. For example, the GitHub GraphQL API requires a personal access token: ```shell -$ gqlschema https://api.github.com/graphql +$ gql-sdl https://api.github.com/graphql Failed to connect to API endpoint. HTTPError: Response code 401 (Unauthorized) -$ gqlschema https://api.github.com/graphql -H "Authorization: Bearer ghp_[redacted]" +$ gql-sdl https://api.github.com/graphql -H "Authorization: Bearer ghp_[redacted]" directive @requiredCapabilities(requiredCapabilities: [String!]) on OBJECT | SCALAR | ARGUMENT_DEFINITION | INTERFACE | INPUT_OBJECT | FIELD_DEFINITION | ENUM | ENUM_VALUE | UNION | INPUT_FIELD_DEFINITION """Autogenerated input type of AbortQueuedMigrations""" @@ -56,13 +56,13 @@ input AbortQueuedMigrationsInput { ... ``` -gqlschema supports introspection options provided by [GraphQL.js](https://github.com/graphql/graphql-js). These flags may not be compatible with all GraphQL servers (especially `--specified-by-url` and `--input-value-deprecation`) and could cause the introspection to fail. +gql-sdl supports introspection options provided by [GraphQL.js](https://github.com/graphql/graphql-js). These flags may not be compatible with all GraphQL servers (especially `--specified-by-url` and `--input-value-deprecation`) and may cause the introspection query to fail. ### Full Usage ``` -$ gqlschema --help -usage: index.js [-h] [-s] [-j] [-H HEADER] [-o FILE] [-N] [-D] [-R] [-S] [-I] endpoint +$ gql-sdl --help +usage: gql-sdl [-h] [-s] [-j] [-H HEADER] [-o FILE] [-N] [-D] [-R] [-S] [-I] endpoint positional arguments: endpoint GraphQL endpoint with introspection enabled diff --git a/package-lock.json b/package-lock.json index 8c1cc96..56dbe3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "gqlschema", - "version": "0.1.0", + "name": "gql-sdl", + "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "gqlschema", - "version": "0.1.0", + "name": "gql-sdl", + "version": "1.0.0", "license": "MIT", "dependencies": { "argparse": "^2.0.1", diff --git a/package.json b/package.json index 829427b..48cb304 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { - "name": "gqlschema", + "name": "gql-sdl", "version": "1.0.0", - "description": "CLI tool to pull the GraphQL schema (as GraphQL SDL or JSON) from a given endpoint with introspection enabled", + "description": "CLI tool to download the GraphQL schema (as GraphQL SDL or JSON) from a given API with introspection enabled", "keywords": [ "cli", "graphql" ], - "homepage": "https://github.com/jkmartindale/gqlschema#readme", - "bugs": "https://github.com/jkmartindale/gqlschema/issues", + "homepage": "https://github.com/jkmartindale/gql-sdl#readme", + "bugs": "https://github.com/jkmartindale/gql-sdl/issues", "license": "MIT", "author": "James Martindale (https://twitter.com/jkmartindale)", "files": [ @@ -16,9 +16,9 @@ ], "main": "dist/index.js", "bin": { - "gqlschema": "dist/index.js" + "gql-sdl": "dist/index.js" }, - "repository": "github:jkmartindale/gqlschema", + "repository": "github:jkmartindale/gql-sdl", "scripts": { "build": "npx tsc", "prepare": "npm run build",