Skip to content

Commit

Permalink
Merge pull request #1 from timlrx/update
Browse files Browse the repository at this point in the history
Update packages, dependencies and name
  • Loading branch information
timlrx authored Mar 31, 2024
2 parents 2f491c5 + 005c453 commit a9011b8
Show file tree
Hide file tree
Showing 132 changed files with 4,609 additions and 3,290 deletions.
5 changes: 5 additions & 0 deletions .changeset/blue-pandas-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'next-contentlayer': minor
---

Support next 14
16 changes: 13 additions & 3 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@
"$schema": "https://unpkg.com/@changesets/config@1.6.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [["@contentlayer/*", "contentlayer", "next-contentlayer"]],
"fixed": [
[
"@contentlayer/*",
"contentlayer",
"next-contentlayer"
]
],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["examples-*"],
"ignore": [
"*-example",
"next-rsc-dynamic",
"next-images"
],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"useCalculatedVersionForSnapshots": true
}
}
}
5 changes: 5 additions & 0 deletions .changeset/fresh-buckets-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@contentlayer/core': minor
---

Update unified ecosystem dependencies
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
build-example-next-contentlayer-example:
strategy:
matrix:
node-version: [17, 18, 19, 20] # `app` dir requires 17+
node-version: [18, 19, 20]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -43,7 +43,7 @@ jobs:
build-example-next-rsc-dynamic-example:
strategy:
matrix:
node-version: [17, 18, 19, 20] # `app` dir requires 17+
node-version: [18, 19, 20]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -55,7 +55,7 @@ jobs:
build-example-next-images-example:
strategy:
matrix:
node-version: [17, 18, 19, 20] # `app` dir requires 17+
node-version: [18, 19, 20]
# TODO re-enable windows
# os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ out
!tap-snapshots/dist/*

.contentlayer
.DS_Store
17 changes: 8 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@
"examples/gatsby-docs/gatsby": true
},
"files.exclude": {
"**/.direnv": true,
"**/.DS_Store": true,
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/.svn": true,
"**/.yarn": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"**/dist": true,
"**/vercel.json": true,
"**/.yarn": true,
"**/.direnv": true
"**/vercel.json": true
},
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": false,
"source.fixAll": true,
"source.addMissingImports": true
"source.organizeImports": "never",
"source.fixAll": "explicit",
"source.addMissingImports": "explicit"
},
"typescript.enablePromptUseWorkspaceTsdk": true,
"prettier.singleQuote": true,
Expand Down
25 changes: 10 additions & 15 deletions examples/next-images/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,30 @@
import Link from "next/link";
import { compareDesc, format, parseISO } from "date-fns";
import { allPosts, Post } from "contentlayer/generated";
import { getMDXComponent } from "next-contentlayer/hooks";
import Link from 'next/link'
import { compareDesc, format, parseISO } from 'date-fns'
import { allPosts, Post } from 'contentlayer/generated'
import { getMDXComponent } from 'next-contentlayer2/hooks'

function PostCard(post: Post) {
const Content = getMDXComponent(post.body.code);
const Content = getMDXComponent(post.body.code)

return (
<div className="mb-8">
<h2 className="text-xl">
<Link
href={post.url}
className="text-blue-700 hover:text-blue-900"
legacyBehavior>
<Link href={post.url} className="text-blue-700 hover:text-blue-900" legacyBehavior>
{post.title}
</Link>
</h2>
<time dateTime={post.date} className="block mb-2 text-xs text-gray-600">
{format(parseISO(post.date), "LLLL d, yyyy")}
{format(parseISO(post.date), 'LLLL d, yyyy')}
</time>
<div className="text-sm">
<Content />
</div>
</div>
);
)
}

export default function Home() {
const posts = allPosts.sort((a, b) =>
compareDesc(new Date(a.date), new Date(b.date))
);
const posts = allPosts.sort((a, b) => compareDesc(new Date(a.date), new Date(b.date)))

return (
<div className="max-w-xl py-8 mx-auto">
Expand All @@ -39,5 +34,5 @@ export default function Home() {
<PostCard key={idx} {...post} />
))}
</div>
);
)
}
2 changes: 1 addition & 1 deletion examples/next-images/app/posts/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { format, parseISO } from 'date-fns'
import { allPosts } from 'contentlayer/generated'
import { getMDXComponent } from 'next-contentlayer/hooks'
import { getMDXComponent } from 'next-contentlayer2/hooks'
import Image from 'next/image'

export const generateStaticParams = async () => allPosts.map((post) => ({ slug: post._raw.flattenedPath }))
Expand Down
2 changes: 1 addition & 1 deletion examples/next-images/contentlayer.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineDocumentType, makeSource } from 'contentlayer/source-files'
import { defineDocumentType, makeSource } from 'contentlayer2/source-files'

const Post = defineDocumentType(() => ({
name: 'Post',
Expand Down
8 changes: 2 additions & 6 deletions examples/next-images/next.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
const { withContentlayer } = require("next-contentlayer");
const { withContentlayer } = require("next-contentlayer2");

/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
};
const nextConfig = {}

module.exports = withContentlayer(nextConfig);
6 changes: 3 additions & 3 deletions examples/next-images/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"start": "next start"
},
"dependencies": {
"contentlayer": "latest",
"contentlayer2": "latest",
"date-fns": "2.30.0",
"next": "13.4.7",
"next-contentlayer": "latest",
"next": "14.1.0",
"next-contentlayer2": "latest",
"react": "18.2.0",
"react-dom": "18.2.0"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/next-rsc-dynamic/contentlayer.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineDocumentType } from 'contentlayer/source-files'
import { defineDocumentType } from 'contentlayer2/source-files'
import { spawn } from 'node:child_process'
import { makeSource } from 'contentlayer/source-remote-files'
import { makeSource } from 'contentlayer2/source-remote-files'

const Post = defineDocumentType(() => ({
name: 'Post',
Expand Down
6 changes: 2 additions & 4 deletions examples/next-rsc-dynamic/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const { withContentlayer } = require('next-contentlayer')
const { withContentlayer } = require('next-contentlayer2')

module.exports = withContentlayer({
experimental: { appDir: true, },
})
module.exports = withContentlayer({})
6 changes: 3 additions & 3 deletions examples/next-rsc-dynamic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"start": "next start"
},
"dependencies": {
"contentlayer": "latest",
"contentlayer2": "latest",
"date-fns": "2.30.0",
"next": "13.4.7",
"next-contentlayer": "latest",
"next": "14.1.0",
"next-contentlayer2": "latest",
"react": "18.2.0",
"react-dom": "18.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/node-script-mdx/contentlayer.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineDocumentType, makeSource } from 'contentlayer/source-files'
import { defineDocumentType, makeSource } from 'contentlayer2/source-files'
import { bundleMDX } from 'mdx-bundler'
import * as ReactDOMServer from 'react-dom/server'
import { getMDXComponent } from 'mdx-bundler/client/index.js'
Expand Down
4 changes: 2 additions & 2 deletions examples/node-script-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "node-script-mdx-example",
"private": true,
"scripts": {
"start": "contentlayer build && node --experimental-json-modules my-script.mjs"
"start": "contentlayer2 build && node --experimental-json-modules my-script.mjs"
},
"dependencies": {
"contentlayer": "latest"
"contentlayer2": "latest"
}
}
4 changes: 2 additions & 2 deletions examples/node-script-remote-content/contentlayer.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineDocumentType } from 'contentlayer/source-files'
import { defineDocumentType } from 'contentlayer2/source-files'
import { spawn } from 'node:child_process'
import { makeSource } from 'contentlayer/source-remote-files'
import { makeSource } from 'contentlayer2/source-remote-files'

const Post = defineDocumentType(() => ({
name: 'Post',
Expand Down
4 changes: 2 additions & 2 deletions examples/node-script-remote-content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "node-script-remote-content-example",
"private": true,
"scripts": {
"start": "contentlayer build && node --experimental-json-modules my-script.mjs"
"start": "contentlayer2 build && node --experimental-json-modules my-script.mjs"
},
"dependencies": {
"contentlayer": "latest"
"contentlayer2": "latest"
}
}
2 changes: 1 addition & 1 deletion examples/node-script/contentlayer.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineDocumentType, makeSource } from 'contentlayer/source-files'
import { defineDocumentType, makeSource } from 'contentlayer2/source-files'

const Post = defineDocumentType(() => ({
name: 'Post',
Expand Down
4 changes: 2 additions & 2 deletions examples/node-script/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "node-script-example",
"private": true,
"scripts": {
"start": "contentlayer build && node --experimental-json-modules my-script.mjs"
"start": "contentlayer2 build && node --experimental-json-modules my-script.mjs"
},
"dependencies": {
"contentlayer": "latest"
"contentlayer2": "latest"
}
}
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "contentlayer-monorepo",
"name": "contentlayer2-monorepo",
"private": true,
"workspaces": [
"./packages/@contentlayer/*",
Expand All @@ -10,11 +10,11 @@
"postinstall": "ts-patch install",
"prepare": "ts-patch install -s",
"test": "CI=true VITEST_SEGFAULT_RETRY=3 yarn workspaces foreach --parallel run test",
"build": "run build:clean && run build:ts && yarn workspace next-contentlayer run prepack",
"build": "run build:clean && run build:ts && yarn workspace next-contentlayer2 run prepack",
"build:ts": "tsc --build tsconfig.all.json",
"dev:ts": "run build:ts --watch",
"build:clean": "bash -c 'rm -rf packages/*/dist packages/@contentlayer/*/dist'",
"examples:postinstall": "yarn workspaces foreach --verbose --include \"examples-*\" exec yarn contentlayer postinstall",
"examples:postinstall": "yarn workspaces foreach --verbose --include \"examples-*\" exec yarn contentlayer2 postinstall",
"release:prerelease": "yarn build && yarn workspaces foreach --verbose --topological-dev --parallel --no-private npm publish --tolerate-republish --tag=dev",
"release:patch": "yarn build && yarn workspaces foreach --verbose --topological-dev --parallel --no-private npm publish --tolerate-republish",
"release:minor": "yarn build && yarn workspaces foreach --verbose --topological-dev --parallel --no-private npm publish --tolerate-republish",
Expand Down Expand Up @@ -42,11 +42,11 @@
},
"resolutions": {
"esbuild": "0.18.0",
"contentlayer": "workspace:*",
"@contentlayer/*": "workspace:*",
"contentlayer-stackbit-yaml-generator": "workspace:*",
"next-contentlayer": "workspace:*",
"contentlayer2": "workspace:*",
"@contentlayer2/*": "workspace:*",
"contentlayer-stackbit-yaml-generator2": "workspace:*",
"next-contentlayer2": "workspace:*",
"rxjs": "^7.1.0"
},
"packageManager": "yarn@3.2.3"
}
}
8 changes: 4 additions & 4 deletions packages/@contentlayer/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentlayer/cli",
"version": "0.3.4",
"name": "@contentlayer2/cli",
"version": "0.4.1",
"type": "module",
"exports": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -13,8 +13,8 @@
"test": "echo No tests yet"
},
"dependencies": {
"@contentlayer/core": "workspace:*",
"@contentlayer/utils": "workspace:*",
"@contentlayer2/core": "workspace:*",
"@contentlayer2/utils": "workspace:*",
"clipanion": "^3.2.1",
"typanion": "^3.12.1"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/@contentlayer/cli/src/commands/BuildCommand.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as core from '@contentlayer/core'
import { OT, pipe, T } from '@contentlayer/utils/effect'
import * as core from '@contentlayer2/core'
import { OT, pipe, T } from '@contentlayer2/utils/effect'
import type { Usage } from 'clipanion'

import { BaseCommand } from './_BaseCommand.js'
Expand All @@ -25,6 +25,6 @@ export class BuildCommand extends BaseCommand {
T.tap((config) => (config.source.options.disableImportAliasWarning ? T.unit : T.fork(core.validateTsconfig))),
T.chain((config) => core.generateDotpkg({ config, verbose: this.verbose })),
T.tap(core.logGenerateInfo),
OT.withSpan('@contentlayer/cli/commands/BuildCommand:executeSafe'),
OT.withSpan('@contentlayer2/cli/commands/BuildCommand:executeSafe'),
)
}
4 changes: 2 additions & 2 deletions packages/@contentlayer/cli/src/commands/DefaultCommand.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OT, pipe, T } from '@contentlayer/utils/effect'
import { OT, pipe, T } from '@contentlayer2/utils/effect'
import { Command } from 'clipanion'

import { BaseCommand } from './_BaseCommand.js'
Expand All @@ -9,6 +9,6 @@ export class DefaultCommand extends BaseCommand {
executeSafe = () =>
pipe(
T.succeedWith(() => console.log(this.cli.usage())),
OT.withSpan('@contentlayer/cli/commands/DefaultCommand:executeSafe', { attributes: { cwd: process.cwd() } }),
OT.withSpan('@contentlayer2/cli/commands/DefaultCommand:executeSafe', { attributes: { cwd: process.cwd() } }),
)
}
10 changes: 5 additions & 5 deletions packages/@contentlayer/cli/src/commands/DevCommand.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as core from '@contentlayer/core'
import { errorToString } from '@contentlayer/utils'
import { E, OT, pipe, S, T } from '@contentlayer/utils/effect'
import * as core from '@contentlayer2/core'
import { errorToString } from '@contentlayer2/utils'
import { E, OT, pipe, S, T } from '@contentlayer2/utils/effect'
import type { Usage } from 'clipanion'

import { BaseCommand } from './_BaseCommand.js'
Expand Down Expand Up @@ -31,8 +31,8 @@ export class DevCommand extends BaseCommand {
core.generateDotpkgStream({ config, verbose: this.verbose, isDev: true }),
),
S.tap(E.fold((error) => T.log(errorToString(error)), core.logGenerateInfo)),
OT.withStreamSpan('@contentlayer/cli/commands/DevCommand:stream'),
OT.withStreamSpan('@contentlayer2/cli/commands/DevCommand:stream'),
S.runDrain,
OT.withSpan('@contentlayer/cli/commands/DevCommand:executeSafe'),
OT.withSpan('@contentlayer2/cli/commands/DevCommand:executeSafe'),
)
}
Loading

0 comments on commit a9011b8

Please sign in to comment.