Skip to content

Update dependency contentlayer to v0.2.8#15

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/contentlayer-0.x
Open

Update dependency contentlayer to v0.2.8#15
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/contentlayer-0.x

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate Bot commented Aug 12, 2022

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
contentlayer 0.2.6 -> 0.2.8 age adoption passing confidence

Release Notes

contentlayerdev/contentlayer

v0.2.8

Compare Source

ℹ️ [TLDR] 0.2.8 improves list fields, field validations and error handling, type safety, and monorepo support.

✨ Improved Monorepo Support

When accessing documents outside the directory that contains contentlayer.config.ts, you can define contentDirPath using relative values. For example, consider a repo with the following directory structure:

.
├── docs [NextJS docs site]
└── components/
    ├── component-1/
    │   └──  README.md
    ├── component-2/
    │   └──  README.md
    └── component-3/
        └──  README.md

You can define define contentDirPath in docs/contentlayer.config.ts as .., allowing access to markdown files in the components directory.

export default makeSource({ 
  // ...
  contentDirPath: ".."
})

You can then run contentlayer build directly from the project subdirectory (docs in this example). See #​295 for more details.

Avoiding INIT_CWD

This release also brings better support for various monorepo tooling — Lerna, Turborepo, NPM workspaces, etc. See #​104 for details.

More list Field Types

#​87 identified an issue with validating list field values. These validations have been improved, along with additional types within list fields. For example, previously, numbers were not supported, but are now available.

Type Safety for date Values

Being that there is no concept of a date type in JSON, Contentlayer stores date values as strings. Previously, these values were assigned a string type by Contentlayer's automatically-exported type definitions. Now the type is called IsoDateTimeString. It is an alias to string, but will make it easier to introduce type-safety for date fields in your projects.

export type Page = {
  // ...
  date: IsoDateTimeString
}
CleanShot 2022-09-09 at 18 38 17@​2x

Other Improvements

  • When encountering issues with singleton documents, Contentlayer will fail gracefully, with improved error messaging.
  • Upgraded dependencies.

v0.2.7

Compare Source

ℹ️ [TLDR] 0.2.7 brings experimental support for an image field when using files source.

✨ (Experimental) Support for image Field with Files Source

When using source-files as the content source, you can now use an image field. This will process images that are colocated with your content files, resolving the image path to a rich object containing properties for the image file. This will also move the image into a path that will ensure the image is publicly available on your site.

image Field Example (Files Source)

Given a document type definition that specifies a coverImage field of type image:

const Post = defineDocumentType(() => ({
  name: 'Post',
  filePathPattern: 'posts/*.md',
  fields: {
    coverImage: { type: 'image' },
  },
}))

And a content file that references a colocated image file:

---
coverImage: ./image-a.png
---

### Hello world

Contentlayer will produce the following for the coverImage property within the document:

"coverImage": {
  "filePath": "posts/image-a.png",
  "relativeFilePath": "image-a.png",
  "format": "png",
  "height": 480,
  "width": 640,
  "blurhashDataUrl": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAMAAADz0U65AAAACVBMVEV8Ou12OOBtM9E8a9LBAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAHElEQVQImWNgwAIYmZhgDEYwzcQEQiABRhDCAgADQQAWowgdtgAAAABJRU5ErkJggg=="
},

Date Improvements

date values that include timezones work more consistently (see #​9 for details, and thanks to @​pard68 & @​mshick for their contributions).

This change removes the date-fns library in favor of the new Temporal API (via a polyfill).

Other Improvements

  • There is now a resolveCwd when using the files content source to explicitly tell Contentlayer how to resolve the current working directory. This also changes the default resolution behavior. See #​270 for the change, which closes #​266. And thanks to @​mshick for their contribution here.
  • Upgraded dependencies.
  • Strengthen codebase with more tests.

🐞 Bug Fixes

  • Fix and better error logging when fields are missing from defineDocument. See #​268 for details.

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate Bot force-pushed the renovate/contentlayer-0.x branch from 06ad1d1 to 36f7704 Compare August 17, 2022 16:34
@renovate renovate Bot force-pushed the renovate/contentlayer-0.x branch from 36f7704 to 4bf1b3a Compare August 29, 2022 06:08
@vercel
Copy link
Copy Markdown

vercel Bot commented Aug 29, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
blog ❌ Failed (Inspect) Sep 9, 2022 at 5:38PM (UTC)

@renovate renovate Bot force-pushed the renovate/contentlayer-0.x branch from 0e49131 to a1c2607 Compare September 9, 2022 17:36
@renovate renovate Bot changed the title Update dependency contentlayer to v0.2.7 Update dependency contentlayer to v0.2.8 Sep 9, 2022
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.

0 participants