Skip to content

Commit 005c453

Browse files
authored
Merge pull request #2 from timlrx/contentlayer-temp
update package name
2 parents fbcce89 + b39801f commit 005c453

File tree

121 files changed

+1690
-1483
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+1690
-1483
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ out
2626
!tap-snapshots/dist/*
2727

2828
.contentlayer
29+
.DS_Store

.vscode/settings.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,21 @@
88
"examples/gatsby-docs/gatsby": true
99
},
1010
"files.exclude": {
11+
"**/.direnv": true,
12+
"**/.DS_Store": true,
1113
"**/.git": true,
12-
"**/.svn": true,
1314
"**/.hg": true,
15+
"**/.svn": true,
16+
"**/.yarn": true,
1417
"**/CVS": true,
15-
"**/.DS_Store": true,
1618
"**/Thumbs.db": true,
17-
"**/dist": true,
18-
"**/vercel.json": true,
19-
"**/.yarn": true,
20-
"**/.direnv": true
19+
"**/vercel.json": true
2120
},
2221
"editor.formatOnSave": true,
2322
"editor.codeActionsOnSave": {
24-
"source.organizeImports": false,
25-
"source.fixAll": true,
26-
"source.addMissingImports": true
23+
"source.organizeImports": "never",
24+
"source.fixAll": "explicit",
25+
"source.addMissingImports": "explicit"
2726
},
2827
"typescript.enablePromptUseWorkspaceTsdk": true,
2928
"prettier.singleQuote": true,

examples/next-images/app/page.tsx

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,30 @@
1-
import Link from "next/link";
2-
import { compareDesc, format, parseISO } from "date-fns";
3-
import { allPosts, Post } from "contentlayer/generated";
4-
import { getMDXComponent } from "next-contentlayer/hooks";
1+
import Link from 'next/link'
2+
import { compareDesc, format, parseISO } from 'date-fns'
3+
import { allPosts, Post } from 'contentlayer/generated'
4+
import { getMDXComponent } from 'next-contentlayer2/hooks'
55

66
function PostCard(post: Post) {
7-
const Content = getMDXComponent(post.body.code);
7+
const Content = getMDXComponent(post.body.code)
88

99
return (
1010
<div className="mb-8">
1111
<h2 className="text-xl">
12-
<Link
13-
href={post.url}
14-
className="text-blue-700 hover:text-blue-900"
15-
legacyBehavior>
12+
<Link href={post.url} className="text-blue-700 hover:text-blue-900" legacyBehavior>
1613
{post.title}
1714
</Link>
1815
</h2>
1916
<time dateTime={post.date} className="block mb-2 text-xs text-gray-600">
20-
{format(parseISO(post.date), "LLLL d, yyyy")}
17+
{format(parseISO(post.date), 'LLLL d, yyyy')}
2118
</time>
2219
<div className="text-sm">
2320
<Content />
2421
</div>
2522
</div>
26-
);
23+
)
2724
}
2825

2926
export default function Home() {
30-
const posts = allPosts.sort((a, b) =>
31-
compareDesc(new Date(a.date), new Date(b.date))
32-
);
27+
const posts = allPosts.sort((a, b) => compareDesc(new Date(a.date), new Date(b.date)))
3328

3429
return (
3530
<div className="max-w-xl py-8 mx-auto">
@@ -39,5 +34,5 @@ export default function Home() {
3934
<PostCard key={idx} {...post} />
4035
))}
4136
</div>
42-
);
37+
)
4338
}

examples/next-images/app/posts/[slug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { format, parseISO } from 'date-fns'
22
import { allPosts } from 'contentlayer/generated'
3-
import { getMDXComponent } from 'next-contentlayer/hooks'
3+
import { getMDXComponent } from 'next-contentlayer2/hooks'
44
import Image from 'next/image'
55

66
export const generateStaticParams = async () => allPosts.map((post) => ({ slug: post._raw.flattenedPath }))

examples/next-images/contentlayer.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineDocumentType, makeSource } from 'contentlayer/source-files'
1+
import { defineDocumentType, makeSource } from 'contentlayer2/source-files'
22

33
const Post = defineDocumentType(() => ({
44
name: 'Post',

examples/next-images/next.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { withContentlayer } = require("next-contentlayer");
1+
const { withContentlayer } = require("next-contentlayer2");
22

33
/** @type {import('next').NextConfig} */
44
const nextConfig = {}

examples/next-images/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
"start": "next start"
99
},
1010
"dependencies": {
11-
"contentlayer": "latest",
11+
"contentlayer2": "latest",
1212
"date-fns": "2.30.0",
1313
"next": "14.1.0",
14-
"next-contentlayer": "latest",
14+
"next-contentlayer2": "latest",
1515
"react": "18.2.0",
1616
"react-dom": "18.2.0"
1717
},

examples/next-rsc-dynamic/contentlayer.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { defineDocumentType } from 'contentlayer/source-files'
1+
import { defineDocumentType } from 'contentlayer2/source-files'
22
import { spawn } from 'node:child_process'
3-
import { makeSource } from 'contentlayer/source-remote-files'
3+
import { makeSource } from 'contentlayer2/source-remote-files'
44

55
const Post = defineDocumentType(() => ({
66
name: 'Post',
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const { withContentlayer } = require('next-contentlayer')
1+
const { withContentlayer } = require('next-contentlayer2')
22

33
module.exports = withContentlayer({})

examples/next-rsc-dynamic/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
"start": "next start"
99
},
1010
"dependencies": {
11-
"contentlayer": "latest",
11+
"contentlayer2": "latest",
1212
"date-fns": "2.30.0",
1313
"next": "14.1.0",
14-
"next-contentlayer": "latest",
14+
"next-contentlayer2": "latest",
1515
"react": "18.2.0",
1616
"react-dom": "18.2.0"
1717
},

examples/node-script-mdx/contentlayer.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineDocumentType, makeSource } from 'contentlayer/source-files'
1+
import { defineDocumentType, makeSource } from 'contentlayer2/source-files'
22
import { bundleMDX } from 'mdx-bundler'
33
import * as ReactDOMServer from 'react-dom/server'
44
import { getMDXComponent } from 'mdx-bundler/client/index.js'

examples/node-script-mdx/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "node-script-mdx-example",
33
"private": true,
44
"scripts": {
5-
"start": "contentlayer build && node --experimental-json-modules my-script.mjs"
5+
"start": "contentlayer2 build && node --experimental-json-modules my-script.mjs"
66
},
77
"dependencies": {
8-
"contentlayer": "latest"
8+
"contentlayer2": "latest"
99
}
1010
}

examples/node-script-remote-content/contentlayer.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { defineDocumentType } from 'contentlayer/source-files'
1+
import { defineDocumentType } from 'contentlayer2/source-files'
22
import { spawn } from 'node:child_process'
3-
import { makeSource } from 'contentlayer/source-remote-files'
3+
import { makeSource } from 'contentlayer2/source-remote-files'
44

55
const Post = defineDocumentType(() => ({
66
name: 'Post',

examples/node-script-remote-content/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "node-script-remote-content-example",
33
"private": true,
44
"scripts": {
5-
"start": "contentlayer build && node --experimental-json-modules my-script.mjs"
5+
"start": "contentlayer2 build && node --experimental-json-modules my-script.mjs"
66
},
77
"dependencies": {
8-
"contentlayer": "latest"
8+
"contentlayer2": "latest"
99
}
1010
}

examples/node-script/contentlayer.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineDocumentType, makeSource } from 'contentlayer/source-files'
1+
import { defineDocumentType, makeSource } from 'contentlayer2/source-files'
22

33
const Post = defineDocumentType(() => ({
44
name: 'Post',

examples/node-script/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "node-script-example",
33
"private": true,
44
"scripts": {
5-
"start": "contentlayer build && node --experimental-json-modules my-script.mjs"
5+
"start": "contentlayer2 build && node --experimental-json-modules my-script.mjs"
66
},
77
"dependencies": {
8-
"contentlayer": "latest"
8+
"contentlayer2": "latest"
99
}
1010
}

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "contentlayer-monorepo",
2+
"name": "contentlayer2-monorepo",
33
"private": true,
44
"workspaces": [
55
"./packages/@contentlayer/*",
@@ -10,11 +10,11 @@
1010
"postinstall": "ts-patch install",
1111
"prepare": "ts-patch install -s",
1212
"test": "CI=true VITEST_SEGFAULT_RETRY=3 yarn workspaces foreach --parallel run test",
13-
"build": "run build:clean && run build:ts && yarn workspace next-contentlayer run prepack",
13+
"build": "run build:clean && run build:ts && yarn workspace next-contentlayer2 run prepack",
1414
"build:ts": "tsc --build tsconfig.all.json",
1515
"dev:ts": "run build:ts --watch",
1616
"build:clean": "bash -c 'rm -rf packages/*/dist packages/@contentlayer/*/dist'",
17-
"examples:postinstall": "yarn workspaces foreach --verbose --include \"examples-*\" exec yarn contentlayer postinstall",
17+
"examples:postinstall": "yarn workspaces foreach --verbose --include \"examples-*\" exec yarn contentlayer2 postinstall",
1818
"release:prerelease": "yarn build && yarn workspaces foreach --verbose --topological-dev --parallel --no-private npm publish --tolerate-republish --tag=dev",
1919
"release:patch": "yarn build && yarn workspaces foreach --verbose --topological-dev --parallel --no-private npm publish --tolerate-republish",
2020
"release:minor": "yarn build && yarn workspaces foreach --verbose --topological-dev --parallel --no-private npm publish --tolerate-republish",
@@ -42,11 +42,11 @@
4242
},
4343
"resolutions": {
4444
"esbuild": "0.18.0",
45-
"contentlayer": "workspace:*",
46-
"@contentlayer/*": "workspace:*",
47-
"contentlayer-stackbit-yaml-generator": "workspace:*",
48-
"next-contentlayer": "workspace:*",
45+
"contentlayer2": "workspace:*",
46+
"@contentlayer2/*": "workspace:*",
47+
"contentlayer-stackbit-yaml-generator2": "workspace:*",
48+
"next-contentlayer2": "workspace:*",
4949
"rxjs": "^7.1.0"
5050
},
5151
"packageManager": "[email protected]"
52-
}
52+
}

packages/@contentlayer/cli/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "@contentlayer/cli",
3-
"version": "0.3.4",
2+
"name": "@contentlayer2/cli",
3+
"version": "0.4.1",
44
"type": "module",
55
"exports": "./dist/index.js",
66
"types": "./dist/index.d.ts",
@@ -13,8 +13,8 @@
1313
"test": "echo No tests yet"
1414
},
1515
"dependencies": {
16-
"@contentlayer/core": "workspace:*",
17-
"@contentlayer/utils": "workspace:*",
16+
"@contentlayer2/core": "workspace:*",
17+
"@contentlayer2/utils": "workspace:*",
1818
"clipanion": "^3.2.1",
1919
"typanion": "^3.12.1"
2020
},

packages/@contentlayer/cli/src/commands/BuildCommand.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as core from '@contentlayer/core'
2-
import { OT, pipe, T } from '@contentlayer/utils/effect'
1+
import * as core from '@contentlayer2/core'
2+
import { OT, pipe, T } from '@contentlayer2/utils/effect'
33
import type { Usage } from 'clipanion'
44

55
import { BaseCommand } from './_BaseCommand.js'
@@ -25,6 +25,6 @@ export class BuildCommand extends BaseCommand {
2525
T.tap((config) => (config.source.options.disableImportAliasWarning ? T.unit : T.fork(core.validateTsconfig))),
2626
T.chain((config) => core.generateDotpkg({ config, verbose: this.verbose })),
2727
T.tap(core.logGenerateInfo),
28-
OT.withSpan('@contentlayer/cli/commands/BuildCommand:executeSafe'),
28+
OT.withSpan('@contentlayer2/cli/commands/BuildCommand:executeSafe'),
2929
)
3030
}

packages/@contentlayer/cli/src/commands/DefaultCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { OT, pipe, T } from '@contentlayer/utils/effect'
1+
import { OT, pipe, T } from '@contentlayer2/utils/effect'
22
import { Command } from 'clipanion'
33

44
import { BaseCommand } from './_BaseCommand.js'
@@ -9,6 +9,6 @@ export class DefaultCommand extends BaseCommand {
99
executeSafe = () =>
1010
pipe(
1111
T.succeedWith(() => console.log(this.cli.usage())),
12-
OT.withSpan('@contentlayer/cli/commands/DefaultCommand:executeSafe', { attributes: { cwd: process.cwd() } }),
12+
OT.withSpan('@contentlayer2/cli/commands/DefaultCommand:executeSafe', { attributes: { cwd: process.cwd() } }),
1313
)
1414
}

packages/@contentlayer/cli/src/commands/DevCommand.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as core from '@contentlayer/core'
2-
import { errorToString } from '@contentlayer/utils'
3-
import { E, OT, pipe, S, T } from '@contentlayer/utils/effect'
1+
import * as core from '@contentlayer2/core'
2+
import { errorToString } from '@contentlayer2/utils'
3+
import { E, OT, pipe, S, T } from '@contentlayer2/utils/effect'
44
import type { Usage } from 'clipanion'
55

66
import { BaseCommand } from './_BaseCommand.js'
@@ -31,8 +31,8 @@ export class DevCommand extends BaseCommand {
3131
core.generateDotpkgStream({ config, verbose: this.verbose, isDev: true }),
3232
),
3333
S.tap(E.fold((error) => T.log(errorToString(error)), core.logGenerateInfo)),
34-
OT.withStreamSpan('@contentlayer/cli/commands/DevCommand:stream'),
34+
OT.withStreamSpan('@contentlayer2/cli/commands/DevCommand:stream'),
3535
S.runDrain,
36-
OT.withSpan('@contentlayer/cli/commands/DevCommand:executeSafe'),
36+
OT.withSpan('@contentlayer2/cli/commands/DevCommand:executeSafe'),
3737
)
3838
}

packages/@contentlayer/cli/src/commands/PostInstallCommand.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as path from 'node:path'
22

3-
import * as core from '@contentlayer/core'
4-
import { fs } from '@contentlayer/utils'
5-
import { OT, pipe, T } from '@contentlayer/utils/effect'
3+
import * as core from '@contentlayer2/core'
4+
import { fs } from '@contentlayer2/utils'
5+
import { OT, pipe, T } from '@contentlayer2/utils/effect'
66

77
import { BaseCommand } from './_BaseCommand.js'
88

@@ -19,7 +19,9 @@ export class PostInstallCommand extends BaseCommand {
1919

2020
yield* $(addToplevelDotpkgToGitignore())
2121
}),
22-
OT.withSpan('@contentlayer/cli/commands/PostInstallCommand:executeSafe', { attributes: { cwd: process.cwd() } }),
22+
OT.withSpan('@contentlayer2/cli/commands/PostInstallCommand:executeSafe', {
23+
attributes: { cwd: process.cwd() },
24+
}),
2325
)
2426
}
2527
}

packages/@contentlayer/cli/src/commands/_BaseCommand.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import type { HasCwd } from '@contentlayer/core'
2-
import * as core from '@contentlayer/core'
3-
import { fs } from '@contentlayer/utils'
4-
import type { HasClock, HasConsole, OT } from '@contentlayer/utils/effect'
5-
import { pipe, T } from '@contentlayer/utils/effect'
1+
import type { HasCwd } from '@contentlayer2/core'
2+
import * as core from '@contentlayer2/core'
3+
import { fs } from '@contentlayer2/utils'
4+
import type { HasClock, HasConsole, OT } from '@contentlayer2/utils/effect'
5+
import { pipe, T } from '@contentlayer2/utils/effect'
66
import { Command, Option } from 'clipanion'
77
import * as t from 'typanion'
88

packages/@contentlayer/cli/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import '@contentlayer/utils/effect/Tracing/Enable'
1+
import '@contentlayer2/utils/effect/Tracing/Enable'
22

33
import process from 'node:process'
44

5-
import { provideDummyTracing } from '@contentlayer/utils'
6-
import { pipe, T } from '@contentlayer/utils/effect'
7-
import { getContentlayerVersion, NodeFsLive } from '@contentlayer/utils/node'
5+
import { provideDummyTracing } from '@contentlayer2/utils'
6+
import { pipe, T } from '@contentlayer2/utils/effect'
7+
import { getContentlayerVersion, NodeFsLive } from '@contentlayer2/utils/node'
88
import { Builtins, Cli } from 'clipanion'
99

1010
import { BuildCommand } from './commands/BuildCommand.js'

packages/@contentlayer/cli/src/lib/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// TODO Note this seems to be unused and should be deleted soon
2-
import type { DocumentTypeDef, DocumentTypeDefMap, NestedTypeDef, NestedTypeDefMap } from '@contentlayer/core'
2+
import type { DocumentTypeDef, DocumentTypeDefMap, NestedTypeDef, NestedTypeDefMap } from '@contentlayer2/core'
33

44
export const derefDocumentOrThrow = (documentDefMap: DocumentTypeDefMap, documentDefName: string): DocumentTypeDef => {
55
if (!(documentDefName in documentDefMap)) {

packages/@contentlayer/client/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "@contentlayer/client",
3-
"version": "0.3.4",
2+
"name": "@contentlayer2/client",
3+
"version": "0.4.1",
44
"type": "module",
55
"exports": "./dist/index.js",
66
"types": "./dist/index.d.ts",
@@ -13,7 +13,7 @@
1313
"test": "echo No tests yet"
1414
},
1515
"dependencies": {
16-
"@contentlayer/core": "workspace:*"
16+
"@contentlayer2/core": "workspace:*"
1717
},
1818
"license": "MIT"
1919
}

packages/@contentlayer/client/src/guards.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Document, GetDocumentTypeMapGen, GetDocumentTypeNamesGen } from '@contentlayer/core'
1+
import type { Document, GetDocumentTypeMapGen, GetDocumentTypeNamesGen } from '@contentlayer2/core'
22

33
// type Guards = {
44
// isType: TypeGuards

0 commit comments

Comments
 (0)