Skip to content

Commit

Permalink
Merge pull request #119 from contentlayerdev/contentlayer-next
Browse files Browse the repository at this point in the history
[WIP] Contentlayer 0.1.0
  • Loading branch information
schickling authored Feb 11, 2022
2 parents 54b225c + da27747 commit a927be7
Show file tree
Hide file tree
Showing 161 changed files with 2,042 additions and 1,448 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"**/.next": true,
"**/*.tsbuildinfo": true,
"**/dist": true,
"**/.pnp.*": true
"**/.pnp.*": true,
"examples/gatsby-docs/gatsby": true
},
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
Expand Down
337 changes: 260 additions & 77 deletions .yarn/plugins/@yarnpkg/plugin-version.cjs

Large diffs are not rendered by default.

631 changes: 0 additions & 631 deletions .yarn/releases/yarn-3.0.2.cjs

This file was deleted.

768 changes: 768 additions & 0 deletions .yarn/releases/yarn-3.1.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: '@yarnpkg/plugin-version'

yarnPath: .yarn/releases/yarn-3.0.2.cjs
yarnPath: .yarn/releases/yarn-3.1.1.cjs

changesetBaseRefs:
- main
Expand Down
1 change: 0 additions & 1 deletion examples/gatsby-docs/content

This file was deleted.

2 changes: 1 addition & 1 deletion examples/gatsby-docs/contentlayer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default makeSource(async () => {
return {
contentDirPath: 'gatsby/docs',
documentTypes: [Reference, HowTo, Conceptual, Tutorial],
onUnknownDocuments: 'skip-ignore',
onUnknownDocuments: 'skip-warn',
markdown: {
rehypePlugins: [[rehypeShiki, { highlighter }]],
},
Expand Down
1 change: 0 additions & 1 deletion examples/gatsby-docs/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
4 changes: 2 additions & 2 deletions examples/gatsby-docs/pages/[...id].tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Head from 'next/head'
import type { FC } from 'react'

import { allDocuments } from '.contentlayer/data'
import type { DocumentTypes } from '.contentlayer/types'
import { allDocuments } from 'contentlayer/generated'
import type { DocumentTypes } from 'contentlayer/generated'

export const getStaticPaths = () => {
const paths = allDocuments.map((_) => `/${_._raw.flattenedPath}`)
Expand Down
2 changes: 1 addition & 1 deletion examples/gatsby-docs/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { InferGetStaticPropsType } from 'next'
import type { FC } from 'react'

import { allDocuments } from '.contentlayer/data'
import { allDocuments } from 'contentlayer/generated'

export const getStaticProps = () => {
const docs = allDocuments.map((_) => ({ path: _._raw.flattenedPath, title: _.title }))
Expand Down
8 changes: 6 additions & 2 deletions examples/gatsby-docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@
"strict": false,
"module": "esnext",
"moduleResolution": "node",
"isolatedModules": true
"isolatedModules": true,
"baseUrl": ".",
"paths": {
"contentlayer/generated": ["./.contentlayer/generated"]
}
},
"include": ["next-env.d.ts", "**/*.tsx", "**/*.ts", "./node_modules/.contentlayer/*", "./node_modules/@types"],
"include": ["next-env.d.ts", "**/*.tsx", "**/*.ts", ".contentlayer/generated"],
"exclude": ["node_modules", "gatsby"]
}
2 changes: 1 addition & 1 deletion examples/mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react'

import { classNames, Link, withPrefix } from '../utils'
import { Icon } from './Icon'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const Action: FC<{ action: types.Action }> = ({ action }) => (
<Link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { FC } from 'react'
import React from 'react'

import { Link, withPrefix } from '../utils'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const ActionLink: FC<{ action: types.Action }> = ({ action }) => (
<Link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import type { FC } from 'react'
import React, { useMemo } from 'react'

import { allPeople } from '.contentlayer/data'
import type * as types from '.contentlayer/types'
import { allPeople } from 'contentlayer/generated'
import type * as types from 'contentlayer/generated'

export const BlogPostFooter: FC<{ post: types.Post; dateType: 'long' | 'short' }> = ({ post, dateType }) => {
const author = useMemo(() => allPeople.find((_) => post.author === _._id), [post])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { FC } from 'react'
import React from 'react'

import { classNames } from '../utils'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const FormField: FC<{ section: types.FooterForm | types.SectionContact; field: types.FormField }> = ({
field,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import React from 'react'

import { classNames, Link, withPrefix } from '../utils'
import { Action } from './Action'
import type * as types from '.contentlayer/types'
import { isType } from '.contentlayer/types'
import type * as types from 'contentlayer/generated'
import { isType } from 'contentlayer/generated'

export const Header: FC<{
config: types.Config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Helmet } from 'react-helmet'
import { withPrefix } from '../utils'
import { Footer } from './footer/Footer'
import { Header } from './Header'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const Layout: FC<{
doc: types.Blog | types.Page | types.Landing | types.Post
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ActionLink } from '../ActionLink'
import { FooterForm } from './FooterForm'
import { FooterNav } from './FooterNav'
import { FooterText } from './FooterText'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const Footer: FC<{ config: types.Config }> = ({ config }) => (
<footer id="colophon" className="site-footer">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react'

import { markdownify } from '../../utils'
import { FormField } from '../FormField'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const FooterForm: FC<{ section: types.FooterForm }> = ({ section }) => (
<section className="cell widget widget-form">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { FC } from 'react'
import React from 'react'

import { Action } from '../Action'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const FooterNav: FC<{ section: types.FooterNav }> = ({ section }) => (
<section className="cell widget widget-nav">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { FC } from 'react'
import React from 'react'

import { Link, markdownify, withPrefix } from '../../utils'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const FooterText: FC<{ section: types.FooterText }> = ({ section }) => (
<section className="cell widget widget-text">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { FC } from 'react'
import React from 'react'

import { Action } from '../Action'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const CtaButtons: FC<{ actions: types.Action[] }> = ({ actions }) => (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React from 'react'
import { htmlToReact, markdownify } from '../../utils'
import { FormField, FormFieldModel } from '../FormField'
import { sectionBaseFields } from './model'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const SectionContact: FC<{ section: types.SectionContact }> = ({ section }) => (
<section id={section.section_id} className={'block contact-block bg-' + section.background + ' outer'}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { markdownify, withPrefix } from '../../utils'
import { ActionModel } from '../Action'
import { CtaButtons } from './CtaButtons'
import { sectionBaseFields } from './model'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const SectionContent: FC<{ section: types.SectionContent }> = ({ section }) => (
<section id={section.section_id} className={'block text-block bg-' + section.background + ' outer'}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { htmlToReact } from '../../utils'
import { ActionModel } from '../Action'
import { CtaButtons } from './CtaButtons'
import { sectionBaseFields } from './model'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const SectionCta: FC<{ section: types.SectionCta }> = ({ section }) => (
<section id={section.section_id} className="block cta-block bg-accent outer">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react'

import { htmlToReact, markdownify } from '../../utils'
import { sectionBaseFields } from './model'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const SectionFaq: FC<{ section: types.SectionFaq }> = ({ section }) => (
<section id={section.section_id} className={'block faq-block bg-' + section.background + ' outer'}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { htmlToReact, markdownify, withPrefix } from '../../utils'
import { ActionModel } from '../Action'
import { CtaButtons } from './CtaButtons'
import { sectionBaseFields } from './model'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const SectionFeatures: FC<{ section: types.SectionFeatures }> = ({ section, ...props }) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { markdownify, withPrefix } from '../../utils'
import { ActionModel } from '../Action'
import { CtaButtons } from './CtaButtons'
import { sectionBaseFields } from './model'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const SectionHero: FC<{ section: types.SectionHero }> = ({ section }) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from 'react'
import { htmlToReact, Link, withPrefix } from '../../utils'
import { BlogPostFooter } from '../BlogPostFooter'
import { sectionBaseFields } from './model'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const SectionPosts: FC<{ section: types.SectionPosts; posts: types.Post[] }> = ({ section, posts }) => {
const recentPosts = posts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { classNames, htmlToReact, markdownify } from '../../utils'
import { ActionModel } from '../Action'
import { CtaButtons } from './CtaButtons'
import { sectionBaseFields } from './model'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const SectionPricing: FC<{ section: types.SectionPricing }> = ({ section }) => (
<section id={section.section_id} className={'block pricing-block bg-' + section.background + ' outer'}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react'

import { htmlToReact, withPrefix } from '../../utils'
import { sectionBaseFields } from './model'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const SectionReviews: FC<{ section: types.SectionReviews }> = ({ section }) => (
<section id={section.section_id} className={'block reviews-block bg-' + section.background + ' outer'}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Layout } from '../components/Layout'
import { SEOModel } from '../contentlayer/objects/SEO'
import { Link, withPrefix } from '../utils'
import { urlFromFilePath } from '../utils/contentlayer'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const BlogLayout: FC<{ blog: types.Blog; config: types.Config; posts: types.Post[] }> = ({
blog,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { SectionReviews, SectionReviewsModel } from '../components/landing-secti
import { Layout } from '../components/Layout'
import { SEOModel } from '../contentlayer/objects/SEO'
import { urlFromFilePath } from '../utils/contentlayer'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const LandingLayout: FC<{
landing: types.Landing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Layout } from '../components/Layout'
import { SEOModel } from '../contentlayer/objects/SEO'
import { htmlToReact, markdownify, withPrefix } from '../utils'
import { urlFromFilePath } from '../utils/contentlayer'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const PageLayout: FC<{
page: types.Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Person } from '../contentlayer/documents/Person'
import { SEOModel } from '../contentlayer/objects/SEO'
import { htmlToReact, withPrefix } from '../utils'
import { urlFromFilePath } from '../utils/contentlayer'
import type * as types from '.contentlayer/types'
import type * as types from 'contentlayer/generated'

export const PostLayout: FC<{
post: types.Post
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { LandingLayout } from '../layouts/LandingLayout'
import { PageLayout } from '../layouts/PageLayout'
import { PostLayout } from '../layouts/PostLayout'
import { defineStaticProps, toParams } from '../utils/next'
import { allDocuments, allPosts, config } from '.contentlayer/data'
import { isType } from '.contentlayer/types'
import { allDocuments, allPosts, config } from 'contentlayer/generated'
import { isType } from 'contentlayer/generated'

export const getStaticPaths = async () => {
const paths = allDocuments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react'

import { classNames, Link, withPrefix } from '../utils'
import { Icon } from './Icon'
import type { Action as Action_ } from '.contentlayer/types'
import type { Action as Action_ } from 'contentlayer/generated'

export const Action: FC<{ action: Action_ }> = ({ action }) => (
<Link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { FC } from 'react'
import React from 'react'

import { Link, withPrefix } from '../utils'
import type { Action } from '.contentlayer/types'
import type { Action } from 'contentlayer/generated'

export const ActionLink: FC<{ action: Action }> = ({ action }) => (
<Link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import type { FC } from 'react'
import React, { useMemo } from 'react'

import { allPeople } from '.contentlayer/data'
import type { Post } from '.contentlayer/types'
import { allPeople } from 'contentlayer/generated'
import type { Post } from 'contentlayer/generated'

export const BlogPostFooter: FC<{ post: Post; dateType: 'long' | 'short' }> = ({ post, dateType }) => {
const author = useMemo(() => allPeople.find((_) => post.author === _._id), [post])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { FC } from 'react'
import React from 'react'

import { classNames } from '../utils'
import type { Footer_form, Form_field, Section_contact } from '.contentlayer/types'
import type { Footer_form, Form_field, Section_contact } from 'contentlayer/generated'

export const FormField: FC<{ section: Footer_form | Section_contact; field: Form_field }> = ({ field, section }) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import React from 'react'

import { classNames, Link, withPrefix } from '../utils'
import { Action } from './Action'
import type { Blog, Config, Landing, Page, Post } from '.contentlayer/types'
import { isType } from '.contentlayer/types'
import type { Blog, Config, Landing, Page, Post } from 'contentlayer/generated'
import { isType } from 'contentlayer/generated'

export const Header: FC<{
config: Config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Helmet } from 'react-helmet'
import { withPrefix } from '../utils'
import { Footer } from './footer/Footer'
import { Header } from './Header'
import type { Blog, Config, Landing, Page, Post } from '.contentlayer/types'
import type { Blog, Config, Landing, Page, Post } from 'contentlayer/generated'

export const Layout: FC<{
doc: Blog | Page | Landing | Post
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ActionLink } from '../ActionLink'
import { FooterForm } from './FooterForm'
import { FooterNav } from './FooterNav'
import { FooterText } from './FooterText'
import type { Config } from '.contentlayer/types'
import type { Config } from 'contentlayer/generated'

export const Footer: FC<{ config: Config }> = ({ config }) => (
<footer id="colophon" className="site-footer">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react'

import { markdownify } from '../../utils'
import { FormField } from '../FormField'
import type { Footer_form } from '.contentlayer/types'
import type { Footer_form } from 'contentlayer/generated'

export const FooterForm: FC<{ section: Footer_form }> = ({ section }) => (
<section className="cell widget widget-form">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { FC } from 'react'
import React from 'react'

import { Action } from '../Action'
import type { Footer_nav } from '.contentlayer/types'
import type { Footer_nav } from 'contentlayer/generated'

export const FooterNav: FC<{ section: Footer_nav }> = ({ section }) => (
<section className="cell widget widget-nav">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { FC } from 'react'
import React from 'react'

import { Link, markdownify, withPrefix } from '../../utils'
import type { Footer_text } from '.contentlayer/types'
import type { Footer_text } from 'contentlayer/generated'

export const FooterText: FC<{ section: Footer_text }> = ({ section }) => (
<section className="cell widget widget-text">
Expand Down
Loading

0 comments on commit a927be7

Please sign in to comment.