Skip to content

Instantly share code, notes, and snippets.

@kylemac
Created February 8, 2020 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylemac/7e3840b6d0e6163f95d535bddece911b to your computer and use it in GitHub Desktop.
Save kylemac/7e3840b6d0e6163f95d535bddece911b to your computer and use it in GitHub Desktop.

learn.hashicorp.com - potential sanity workflow

  • an author creates a new guide
  • an author spins up the local sanity studio
  • as a pre-step to sanity start we parse the tree and look for new files, check our sanity dataset to see if that file exists
    • if it doesn't exist in the dataset, we create a new entry in our sanity data studio
    • if it does exist in the dataset, we do nothing

requirements

  • ensure the CLI cmd is run in the right pwd - fileExists checks on a few "touchstone" files or directories. throw if all not found.
  • parse local project to find new guides
    • store a file-tree map object in sanity dataset?
    • store a file-tree map object local to the repo?

cmds

find all local mdx files. diff that with a string representation that we save either locally or in sanity dataset

assumes cache.txt is the string we get back from sanity GROQ cmd

$ find pages -name '*.mdx' | diff --unchanged-group-format="" cache.txt -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment