Skip to content
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

API refactors #21

Merged
merged 7 commits into from
Mar 21, 2017
Merged

API refactors #21

merged 7 commits into from
Mar 21, 2017

Conversation

giladgray
Copy link
Contributor

  • IPageData extends IBlock, compiler methods also speak IBlock
    • this reduces the naming surface area because contents always refers to rendered StringOrTag[] and contentsRaw is always a string.
  • new interface INavigable for route & level used in IHeadingTag & IHeadingNode
  • IPageNode extends IHeadingNode for maximal reuse (also rename depth → level)
  • type guards take any arg & check existence first

Gilad Gray added 7 commits March 21, 2017 12:56
move IBlock to client.ts so it lives with IPageData.
this reduces the naming surface area because `contents` always refers
to rendered `StringOrTag[]` and `contentsRaw` is always a string.
…ngNode

IPageNode extends IHeadingNode for maximal reuse (depth => level)
@blueprint-bot
Copy link

fix compiler tests

Preview: docs


/** Parsed nodes of source file. An array of rendered HTML strings or `@tag` objects. */
contents: StringOrTag[];
contentsRaw: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thoughts on content vs contents?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmmmm i think i prefer to use plurals for arrays but singular for non arrays

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i definitely prefer consistency. either content or contents. i see no need to use them both in the same interface.

Copy link
Contributor

@themadcreator themadcreator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want more split files i think

@@ -5,10 +5,32 @@
* repository.
*/

/** Slugify a string: "Really Cool Heading!" => "really-cool-heading-" */
export function slugify(str: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay, client only!

* The basic components of a navigable resource: a "route" at which it can be accessed and
* its depth in the layout hierarchy. Heading tags and hierarchy nodes both extend this interface.
*/
export interface INavigable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌


/** Parsed nodes of source file. An array of rendered HTML strings or `@tag` objects. */
contents: StringOrTag[];
contentsRaw: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmmmm i think i prefer to use plurals for arrays but singular for non arrays

depth: number;
route: string;
/*
LAYOUT HIERARCHY NODES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these gigantic capitalized headers indicate to me that these should be a in a separate named "layoutHierarchy.ts" or something

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in a client subdir with an index.ts so you can import everthing you need

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm these are all pretty intertwined and it's nice having all the symbols in one file.


export type PartialPageData = Pick<IPageData, "absolutePath" | "contentRaw" | "contents" | "metadata">;
export type PartialPageData = Pick<IPageData, "absolutePath" | keyof IBlock>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

language features!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah! tho this type is gonna go away in my next PR

Copy link
Contributor

@themadcreator themadcreator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, skip the split

@giladgray giladgray merged commit dc32f46 into master Mar 21, 2017
@giladgray giladgray deleted the gg/api-refactor branch March 21, 2017 21:05
@giladgray giladgray mentioned this pull request Mar 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants