gramps-graphql / recipes

Recipes for common GrAMPS data source patterns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recipes

ecwyne opened this issue · comments

@jlengstorf wanted to get your take on this. I figured it would be useful to have a place to point people to where there are examples of use cases and best practices. What's especially cool is that with @gramps/cli they are trivially easy to spin up and run

Yeah, this is a great idea. It'll be helpful as the community grows, too, because we'll be able to point to specifics instead of having to write out comments and docs in the abstract.

Should we maybe use the base data source instead of defining a base recipe? We could even add a quick "how to add a recipe" that used the npx degit gramps-graphql/data-source-base my-recipe workflow. Or maybe that's too much. I don't know.

Another approach that I like is an examples directory on the parent repo. @kylemathews did this with Gatsby, and I dig it because it avoids losing example repos in the depths of a repo list. (He also set up Gatsby as a monorepo, which is also probably worth looking into, given how quickly the number of GrAMPS packages has grown.)

You're probably right about doing examples within @gramps/gramps.

I initially was thinking of using the data-source-base but so much of it is configuration files and tests. If you take those away, you're pretty much left with what I've got here. It is essentially the src folder of the data-source-base and then all the other configuration can be all in one place

I wonder if it's possible to degit user/repo/folder

I don't think degit supports that, but the GraphQL CLI does:

npx graphql-cli create -b https://github.com/gramps-graphql/recipes/tree/master/recipes/dataloader data-source-mydata && cd $_

I just tested this working, so if we were to move the recipes into a gramps-graphql/gramps/boilerplates directory, we could definitely do it will full URLs.

I put in this PR yesterday to support shorthand in the CLI, but it would need to be extended to support subfolders. I think it would be possible with relatively low effort, though; I'll play with that idea.

I was wrong; getting deeper into a repo isn't supported in shorthand: https://github.com/jonschlinkert/parse-github-url

But knowing we can do it with full URLs is probably enough of a reason to make the more to a subfolder. We can always look at extending the shorthand functionality in the future.