Poor/broken monorepo DX: can't specify .contentlayer/ output path, no docs for custom config path
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 38/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- nextjs, typescript
调研方向
从 createContentlayerPlugin() 和 next-contentlayer 文档开始,包括 configPath 选项以及围绕 tsconfig.json 的行为。使用 pnpm nx serve 重现 apps/my-nextjs-app monorepo 场景,然后将完成标准定义为:为配置路径和输出路径提供有文档说明的配置,并且能够干净地支持多个 app,避免产生令人困惑的控制台输出。
由索引模型根据 Issue 内容生成。
描述
I tried getting Contentlayer rolling in an nx monorepo and found the developer experience to be poor.
I'm creating an issue to potentially influence the roadmap per the project website.
Contentlayer seems like a decent approach to supporting mdx that covers many use-cases so it'd be great to use it.
If you want to make this issue about one thing: developers should be able to configure the .contentlayer output location such that multiple sites/apps can be cleanly supported.
Context
In a monorepo a developer may have a nextjs blog/website/app at apps/my-app-name or packages/my-app-name.
(or even in an even deeper nested path in really large projects)
A given monorepo may house many different apps and libraries.
Developer Requirements
Contentlayer should not "take over" a project's root folder unless configured to do so, and it should support a monorepo where there may be several apps that use it and others that do not. An organization might have respective blog, product documentation, and marketing websites, each with their own MDX content; an individual might have multiple blogs.
- a way to specify the path to the
.contentlayeroutput dir for a given website/app that uses it - a straightforward and documented way to specify where the contentlayer config file is
- contentlayer to consider where
tsconfig.jsonis based on the path to its config (and/or specify a custom path to tsconfig)- right now contentlayer looks in the root of the project folder vs. where the config file is
- nx apps have a
tsconfig.jsonin their respective folders (it extendstsconfig.base.jsonin monorepo root)
Its ok if that's the default behaviour / happy path is no monorepo however I think there should be ways to support them far more elegantly.
In many cases would be best to be best to house everything together in each app's respective folder: the website content mdx, the contentlayer output, and the app itself.
In other cases a dev might prefer paths for content at the root of the project folder e.g. .contentlayer/ with subfolders for each app, content/ with subfolders for each app's content, etc off the project root.
Acceptance
Consider the scenario where a dev runs pnpm nx serve my-nextjs-app that's housed in apps/my-nextjs-app and everything is clean, organized, and plays nice and the console output isn't filled with confused contentlayer barf.
Documentation Issues
It is not well-documented that I can use createContentlayerPlugin() in next config to specify a configPath.
The docs at https://www.contentlayer.dev/docs/reference/next-contentlayer don't mention any of the "non default configuration options" but mention the existence. I had to find that out from looking at issue comments and PR's e.g. https://github.com/contentlayerdev/contentlayer/pull/248
- 主要语言
- TypeScript
- 星标
- 3.5k
- 派生
- 192
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
contentlayerdev/contentlayer 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 25/100
contentlayerdev/contentlayer#506 · 84 条评论 · 47 个 reaction ·
-
meta: never-stale
难度 5/5 一周以上 新手友好度 10/100
contentlayerdev/contentlayer#429 · 49 条评论 · 83 个 reaction ·
-
meta: never-stale topic: markdown/mdx
难度 4/5 3-5 天 新手友好度 42/100
contentlayerdev/contentlayer#421 · 4 个 reaction ·
-
meta: never-stale needs-research topic: schema
难度 5/5 一周以上 新手友好度 25/100
contentlayerdev/contentlayer#420 ·
-
needs-research
难度 5/5 一周以上 新手友好度 35/100
contentlayerdev/contentlayer#414 · 1 个 reaction ·
查看 contentlayerdev/contentlayer 的全部 Issue
相似的 Issue
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
-
Crush 未关闭
难度 1/5 1 小时以内 新手友好度 85/100
catppuccin/catppuccin#3125 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
ElementsProject/cln-application#167 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 75/100
Quantco/pnpm-licenses#17 ·
-
难度 2/5 1-3 小时 新手友好度 75/100