Poor/broken monorepo DX: can't specify .contentlayer/ output path, no docs for custom config path
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 38/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- nextjs, typescript
調査の方向性
createContentlayerPlugin() と next-contentlayer のドキュメントから始め、configPath オプションと tsconfig.json 周辺の動作を含めて確認します。pnpm nx serve を使って apps/my-nextjs-app モノレポのシナリオを再現し、設定パスと出力パスの文書化された設定、および混乱を招くコンソール出力なしで複数の 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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
contentlayerdev/contentlayer のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
contentlayerdev/contentlayer#506 · コメント 84 件 · リアクション 47 件 ·
-
State of the project オープンmeta: never-stale
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
contentlayerdev/contentlayer#429 · コメント 49 件 · リアクション 83 件 ·
-
meta: never-stale topic: markdown/mdx
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
contentlayerdev/contentlayer#421 · リアクション 4 件 ·
-
meta: never-stale needs-research topic: schema
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
contentlayerdev/contentlayer#420 ·
-
Derived documents オープンneeds-research
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
contentlayerdev/contentlayer#414 · リアクション 1 件 ·
contentlayerdev/contentlayer の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
EclipseFdn/open-vsx.org#13385 · コメント 1 件 ·
-
S: triage
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
fix(errors): EHOSTUNREACH from a happy-eyeballs connect is reported as a resolver error (STAMP-80) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
snapshot-labs/stamp#666 ·
-
vangogh
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
knaw-huc/textannoviz#691 ·