-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
claycli discovery #46
Comments
Per @amycheng:
|
After reviewing various custom scripts, the old
The Way Forward
|
Arguments
Commands
|
What are the use cases of the With |
that’s for, say, importing or exporting multiple pages e.g. e.g. |
setting the sites alias in an external config is great idea. It was a hassle to maintain that list in |
yuuup. The config is one of my better ideas 🙃 |
This may be outside the scope of this discovery, but I think we can use this opportunity to also rejigger
Examples:
|
maybe This has the added benefits of devs sharing opts files and creating different opts files for different tasks.
|
A dispatch is a collection of components, pages, users, and other data that can be represented in an object. It uses prefix-free uris and is formatted as YAML (the written-out YAML files are known as bootstrap files). Dispatches can be exported from Clay installs, and imported to them. 3rd party exporters should create a dispatch that's sent to stdout, so it can be piped into claycli.
the passed through object looks like: pages:
index:
customUrl: /
main:
- /_components/feed/instances/index
post1:
customUrl: /2017/first-post
main:
- /_components/article/instances/post1
components:
feed:
instances:
index:
query:
match_all: {}
article:
instances:
post1:
title: First Post
content:
- _ref: /_components/paragraph/instances/1
- _ref: /_components/paragraph/instances/2
paragraph:
instances:
1:
text: Lorem ipsum dolor sit amet
2:
text: consectetur adipisicing elit config
Set aliases for api keys and site prefixes touch
Run GET requests against all instances of a specified component (parsed from the url provided) importimport accepts a dispatch from stdin and sends it to a site. the dispatch may come from a file, importer, or another script
exportexport prints a dispatch to stdout. it may be used to pipe to a file, importer, or another script
site prefix means search pages index (determine underscoring of routes afterwards)
|
@nelsonpecora Wouldn't you have to collect all the data first to write the dispatch? That'll be too memory intensive. |
Hmm, yes, that's the balancing act (between memory and number of required api calls). |
@nelsonpecora I don't see how this approach reduces the number of API calls unless we add some kind of "dispatch import" endpoint to Amphora. Is that what you're suggesting? My thought was to have each line of
And you could pipe this directly into the (This example above assumes cascading page PUTs don't work... I tried after you told me about them but could not get them to work — show me?) If your concern is duplicate PUTs (e.g. a layout appearing a thousand times in a stream b/c a bunch of pages use it), we can use highland's |
The problem with that format is that it's really brittle and not human readable, and cannot be used to interact with bootstrap files. The problem with bootstrap files is that they aren't composable (hence, memory hogs). The problem with smaller chunks is that they require too many API calls. We need something better. |
🤔
|
@cperryk we currently allow both importing and exporting via files, and there are very strong use cases for both types of action. option 1: we abandon piping to/from files and go back to using option 2: we figure out a compromise format that can be used by both machines (to stream |
Using If we do need it, here's how it could work:
|
We could also come up with some kind of compromise format and make export's streaming to stdout and import's reading from stdin more intelligent. e.g. for import there would be logic like "read lines until condition x is met when I know I have a complete asset, parse, import, continue to next line" |
I think we've figured out the compromise solution:
|
Hmm, this is as simple as I can make the api. @cperryk do you think there's a way to simplify the Arguments
Commands
Exports ExamplesExporting single items
Exporting multiple items
|
Yes, this looks great! Some thoughts:
|
per our discussions:
|
Note: All |
The text was updated successfully, but these errors were encountered: