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

grutil's People

Contributors

arroyo avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

bbackerep

grutil's Issues

GraphCMS server error: 400 Bad Request

Hi @arroyo - I am testing your program again. Unfortunately, it stops with an error and I cannot debug it.

> cmsutil-graphcms download content
Download content
2021/06/08 11:28:55 Get Article nodes
[…]
2021/06/08 11:29:05 Get PushNotification nodes
2021/06/08 11:29:06 GraphCMS server error: 400 Bad Request

How do I debug the tool? Any help is highly appreciated.

Best regards,
Max

Name conflicts with bin from Mozilla’s Network Security Services

Dear @arroyo - thank you very much for the great and easy tool. It’s working fine for me. I started writing a PKGBUILD file for Archlinux. Unfortunately, it will not install cmsutil because of a file conflict with cmsutil from Mozilla’s Network Security Services, Archlinux package here. I had to rename your binary to e.g. cmsutil-graphcms, but I guess that’s a bit clumsy.
Do you have an idea of a better name than cmsutil? Anyway, thanks a lot for your work!
Cheers,
Max

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.