Giter VIP home page Giter VIP logo

claycli's Introduction

Clay

Clay is an open-source CMS created by New York Media powering New York Magazine, Vulture, The Cut, Grub Street and Slate.

Clay is comprised of modules available on npm, but the core system is comprised of Kiln, the editing interface, and Amphora, the REST API. For more information on the two modules please see documentation on each. The documentation in this space is meant to explain core concepts of Clay, but for a deeper technical dive you can explore the documentation for each of the modules themselves.

claycli's People

Contributors

amelvisfranco avatar amirandalibi avatar amycheng avatar byronhulcher avatar cperryk avatar felkerch avatar james-owen avatar jonwinton avatar jpope19 avatar macgyver avatar mattoberle avatar nelsonpecora avatar oscarpolanco avatar phyllisstein avatar rmfarrell avatar salomoneb avatar scottnash avatar victhevenot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

claycli's Issues

Compilation

  • scripts (model.js, client.js, universal services, megabundler, kiln plugins)
  • templates (precompilation)
  • styles (woah boy this is a large discussion)
  • media/assets (fonts? definitely svgs and images, at a minimum)

`clay lint` template

  • check against standard template rules
  • head components need comment with data-uri
  • body components need one root element with data-uri={{ default _ref _self }}
  • layouts need doctype

touch: support stdin

  • echo "domain.com/components/foo" | clay touch
  • only need to support full component uri

page URL option for import

Readme says import takes page URI or URL --page <uri or url> a specific page url, but it is throwing error when using the page URL.

Error: Cannot parse url for site prefix!
    at getUrlPrefix (/Users/mcroney/_dev/claycli/lib/utils/urls.js:37:11)
    at Object.uriToUrl (/Users/mcroney/_dev/claycli/lib/utils/urls.js:49:17)
    at importSingleUrl (/Users/mcroney/_dev/claycli/lib/cmd/import.js:132:22)
    at Object.handler (/Users/mcroney/_dev/claycli/lib/cmd/import.js:235:12)
    at Object.self.runCommand (/Users/mcroney/_dev/claycli/node_modules/yargs/lib/command.js:233:22)
    at Object.Yargs.self._parseArgs (/Users/mcroney/_dev/claycli/node_modules/yargs/yargs.js:990:30)
    at Object.get [as argv] (/Users/mcroney/_dev/claycli/node_modules/yargs/yargs.js:927:19)
    at Object.<anonymous> (/Users/mcroney/_dev/claycli/index.js:40:3)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:393:7)
    at startup (bootstrap_node.js:150:9)```

Script Compilation

  • move megabundler to claycli
  • allow megabundler to work with client.js
  • determine script compilation api (watch, minify, etc)

Since this is the first compilation aspect that we're bringing into claycli:

  • determine how compilation should be scaffolded (streams? gulp? etc)
  • write helper functions to deal with incremental compilation, file watching, etc

rewrite clay config

  • remove file handling
  • keep keys / site aliases
  • expand site aliases to allow any urls (rename to urls?)
  • change env variables to use CLAYCLI_ prefix

rewrite clay export

  • export components, pages, users, lists, etc
  • export to dispatches / yaml bootstraps
  • layouts flag
  • limit / offset
  • export newline-delineated uris from stdin

BUG: Ref replacement is modifying non-ref data

Consider the following clay-paragraph instance:

{
  "_ref": "nymag.com/scienceofus/components/clay-paragraph/instances/ciwxnzevi000oj2y9h3ptv73o@published",
  "text": "The Big Five model is a very big deal to psychologists, and has been for decades. At the moment, it is the most respected, widely studied method for accomplishing the tricky task of summing up someone’s personality. It consists of five dimensions, and as the University of Oregon social psychologist Sanjay Srivastava <a href=\"http://pages.uoregon.edu/sanjay/bigfive.html#whatisit\" target=\"_blank\">explains on his website</a>, each is perhaps best understood as containing a bundle of traits:"
}

Notice the text that contains the string /pages, which is part of an <a> element and has nothing to do with a Clay resource. When importing the page containing this paragraph, its text field gets mangled into:

{
  "_ref": "localhost.thecut.com/components/clay-paragraph/instances/ciwxnzevi000oj2y9h3ptv73o",
  "text": "localhost.thecut.com/pages.uoregon.edu/sanjay/bigfive.html#whatisit” target=”_blank”>explains on his website</a>, each is perhaps best understood as containing a bundle of traits:"
}

Relates to this line

BUG: clay cli does not append the correct host to the `url` property

when importing the following:

pages:
  style:
    layout: /components/cut-layout/instances/section
    url: /style/
    head:
      - /components/clay-meta-title/instances/style
      - /components/clay-meta-description/instances/style
      - /components/meta-image/instances/wwwthecut-index
      - /components/meta-icons/instances/wwwthecut
      - /components/clay-meta-site/instances/section
      - /components/clay-meta-url/instances/style
      - /components/clay-meta-keywords/instances/style
    top:
      - /components/ad-takeover-homepage/instances/style
      - /components/global-nav/instances/social-off
    main:
      - /components/cut-section-feed/instances/style

clay-cli does not append the host to the url path. When you try to publish the page via Kiln, Amphora throws an error saying the url is not valid.

rewrite clay import

  • import from stdin (newline-delineated dispatch, yaml bootstraps)
  • publish flag

support pausing / restarting

  • support --limit and --offset in every command that has queueable updates
  • write update uris (and data?) to a temp file so it can be resumed

claycli discovery

  • investigate and document current workflows using ad-hoc / scratch-cli scripts
  • establish use cases that are currently not being met by claycli

ability to bulk import & publish only PUBLISHED pages

I know the bulk import functionality is coming soon, but a big problem I've encountered using the scratch cli with the --publish flag is that it still tries to publish pages that are unpublished on the source clay instance. It would be nice if on clay-cli, one could:

  1. publish a page on import (using a --publish flag or something)
  2. only import articles that are published on the source instance when using the --publish flag (on a bulk page import)

CLI - Page URL

People have URL prop in page data, will convert to custom URL.

add tests

  • rest → type
  • urls → urlToUri
  • chunk → validate
  • clay → recursiveGet

Feature Request: Debug url

I would like the ability to pass a url (for instance: http://nymag.com/selectall/2017/04/the-secrets-of-the-times-square-olive-garden-revealed.html) to clay-cli and discover possible reasons why the url might be returning a 404 or 500. Ideally this would:

  1. Check that there is an existing uri for the published page
  2. If so, check that the page has a published version
  3. lint the layout of the page
  4. lint all non-layout components on the page

and if any of these failed, it would display an error message explaining the problem. This would greatly assist in debugging imported pages, as QA and Product usually pass a broken page to dev by its url and checking all of these things can be a manual process.

rewrite api calls

rewrite api calls to use dispatches, use cascading PUTs as much as possible

Page URL (Import Bug)

Importing With Scratch

screen shot 2017-05-31 at 8 46 54 pm

Importing with Clay CLI

screen shot 2017-05-31 at 8 47 10 pm

Test YAML

pages:
  index:
    layout: /components/two-column-layout/instances/index
    url: /
    main:
      - /components/newsfeed/instances/index

Style Compilation

  • postcss
  • sass-like?
  • component style conventions
  • npm-component style conventions
  • compilation rules
  • linting rules

rewrite clay lint

  • always be recursive
  • allow linting against stdin
  • allow limit/offset queries against pages index (linting against multiple pages)
  • allow linting against components, pages, public urls, uris, users (?), files (?)

`clay import`

Importers:

  • stdin → Clay
  • Clay Site → Clay
  • Clay Page → Clay
  • Clay Component → Clay
  • Files(s) → Clay

README Links

All links in the README point to github.com/nymag/claycli.

agnostic chunk format

figure out the intermediary format for importers and exporters

  • how does it work with streams?
  • how does it work with stdin?
  • how do we parse yaml/json into it?
  • how do we iterate over it without running out of memory?
  • how do we lint it?

idea: programmatic api

  • we should allow all of the claycli methods to be used programmatically
  • individual commands should be importable, lodash-style (e.g. require('claycli/import'))
  • full api should be importable, lodash-style (e.g. require('claycli').import)
  • programmatic claycli should still use streams (and use all of the logic in io/) under the hood, but maybe should expose a promise-based api?

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.