Coder Social home page Coder Social logo

grutil's Introduction

Grutil

A helpful GraphQL utility

Please log any issues to Github issues.

The current version works with GraphCMS and downloads schemas, content, backs up your project to disk (including asset files) and allows simple rendering.

Functions

  • Download
  • Backup
  • Render

@note this project was originally called cmsutil. It was later changed to avoid namespace collisions in some linux environments as there is a cryptography packaged called cmsutil. If you are currently running the old cmsutil please delete and reintsall grutil in its place.

Install

Once you have Go installed on your target environment, simply run the following to install

go get github.com/arroyo/grutil

Config

In your home directory create a folder called ".grutil" and put a text file called "config.yaml" in it.

There is an example config file in the repo.

It has been tested with YAML, but it is possible to use JSON or TOML (use the extensions .json and .toml respectively).

CMS_API_URL must start with https:// or http://

Envars

You can override the settings in your yaml config with the following environment variables

CMS_API_URL

CMS_API_KEY

Usage

Get a copy of your schema or content with the download command. Backup your entire project with the backup command. Render a GraphQL query against a template.

You can add optional --verbose and --debug flags to any command. Verbose will add more details of what is happening as the program runs. Debug is useful if you are having issues and want to see what API calls are happening behind the scenes. Debug will show the GraphQL query being made and the API response body.

Download schema models and enumerations

grutil download schemas --verbose

Download node content and assets

grutil download content

Backup your site

download both schemas and content into a timestamped folder

grutil backup

Render content

Query content with GraphQL and render it against a go template.

grutil render --template json.txt --query "query MyQuery { faq(where: {id: \"cknmrjsvw7yd\"}) { id title publishedAt updatedAt } }"

Get help

Get general help or specific help with a command using.

grutil help
grutil download -h
grutil backup -h

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.