Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

docs: align CONTRIBUTING.md with pnpm/Turborepo stack - #236

Merged
Jocs merged 2 commits into
masterfrom
docs/contributing-align
May 21, 2026
Merged

docs: align CONTRIBUTING.md with pnpm/Turborepo stack#236
Jocs merged 2 commits into
masterfrom
docs/contributing-align

Conversation

@Jocs

@Jocs Jocs commented May 21, 2026

Copy link
Copy Markdown
Member

Summary

The initial CONTRIBUTING.md landed in #193 (thanks @tewaris for spotting the gap!). Reading it against the current stack, almost every step would mislead a new contributor:

  • It tells you to run npm install / npm run dev / npm test — the repo uses pnpm + Turborepo (pinned to pnpm@10.22.0), and the dev surface is pnpm dev (a Turbo task that boots the examples Vite server).
  • It tells you to PR against main — the base branch is master.
  • It says nothing about Conventional Commits, which husky's commit-msg hook enforces via commitlint. New contributors who follow the doc will get their first commit rejected.
  • The Style Guide is generic ("standard linting rules") — no mention of the antfu config, the I-prefix rule for interfaces, the _-prefix rule for private members, the complexity ≤ 20 cap, or the CI-enforced pnpm check-circular gate.
  • The monorepo layout, the examples/ dev surface, and the e2e/ Playwright suite are not mentioned at all.

This PR rewrites the doc to match what's actually enforced today, drawing from README.md, CLAUDE.md, .commitlintrc.cjs, eslint.config.mjs, and the root package.json scripts. Key additions:

  • Prerequisites with real version pins (Node ≥18 dev, ≥20.19/≥22.13/≥24 release, pnpm 10.22 via corepack).
  • First-time setup with fork + upstream remote + pnpm install (which also wires up husky).
  • Repository layout block matching the actual tree (core / examples / e2e / docs / stubs).
  • Full command cheat sheet (build / test / coverage / lint / lint:types / lint:css / check-circular / e2e / e2e:ui) plus scoped runs (--filter @muyajs/core test:spec, test:spec:commonmark, test:spec:gfm).
  • Coding conventions section pointing at the actual rules ESLint flags, plus the block-registration footgun (ScrollPage.loadBlock returns undefined for unregistered blocks) and the "no new ILinkReferenceDefinitionState" rule.
  • Conventional Commits section with the allowed type list and example subjects.
  • "Before opening a PR" checklist mirroring what reviewers actually ask for, including the conformance baseline (expected-failures.json) and MIGRATION.md updates for public-API changes.
  • Routes support requests to issues (Discussions are not enabled on this repo).

Refs #193.

Test plan

  • Markdown headings render with anchors that match the TOC links.
  • All command invocations cross-checked against package.json and packages/core/package.json scripts (test:spec*, e2e:ui, coverage all exist; e2e/BACKLOG.md and e2e/README.md exist).
  • Engine versions match package.json (node >=18, pnpm >=8.5, packageManager: pnpm@10.22.0) and the changelog plugin pin documented in CLAUDE.md.
  • No claim of Discussions being available (gh api repos/marktext/muya reports has_discussions: false).
  • Conventional Commits type list matches .commitlintrc.cjs verbatim.

🤖 Generated with Claude Code

The initial CONTRIBUTING.md added in #193 documented npm + a `main`
branch + a generic style guide, none of which match the repo's actual
conventions. New contributors following it would fail on the first
`npm install`, then again at the commitlint hook.

This rewrite covers what's actually enforced today:

- pnpm 10.22 + Turborepo, Node engines (≥18 for dev, ≥20.19/≥22.13/≥24
  for release).
- `master` as the base branch.
- Conventional Commits enforced by husky + commitlint, with the
  allowed type list and example subjects.
- antfu ESLint rules that actually flag PRs: `I`-prefixed interfaces,
  `_`-prefixed private members, 4-space indent, complexity caps,
  the `pnpm check-circular` gate.
- Real command surface: `pnpm dev/build/test/coverage/lint/lint:types/
  lint:css/check-circular/e2e/e2e:ui` and the scoped `--filter
  @muyajs/core test:spec[:commonmark|:gfm]` runs.
- Repository layout (packages/core as the only source package today,
  examples/, e2e/, stub packages), with a pointer to CLAUDE.md for
  architecture.
- A "before opening a PR" checklist that mirrors what reviewers ask
  for in practice (lint, types, tests, check-circular, e2e/spec when
  relevant, MIGRATION.md updates for public-API changes).
- Issues-only support routing (Discussions are not enabled on this
  repo).

Refs #193.
Copilot AI review requested due to automatic review settings May 21, 2026 01:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates CONTRIBUTING.md to match Muya’s current monorepo tooling and contribution workflow (pnpm + Turborepo, enforced commit conventions, and the repo’s actual dev/test commands), so new contributors aren’t following outdated instructions.

Changes:

  • Rewrites setup instructions to use pnpm/corepack + Turbo tasks and documents the repo layout (packages/examples/e2e/docs).
  • Adds an actionable command cheat sheet (dev/build/test/coverage/lint/types/css/circular/e2e) plus scoped core test runs.
  • Documents contribution expectations (Conventional Commits types, PR checklist, and key coding conventions enforced by ESLint/CI).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CONTRIBUTING.md Outdated

By participating in this project, you agree to abide by our code of conduct. We expect all
contributors to be kind, treat each other with respect, and forgive mistakes.
Be kind, assume good intent, and keep discussions on-topic. Personal attacks, harassment, and discriminatory language are not welcome. Reports about violations can be sent to the maintainers via a GitHub DM or by opening a confidential issue.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 90b4a88. The Code of Conduct section now points at GitHub's abuse reporting flow and the maintainer email in package.json instead.

Comment thread CONTRIBUTING.md Outdated
| `pnpm dev` | Boot the examples Vite dev server (`turbo dev:demo`). |
| `pnpm build` | `tsc && vite build` in `packages/core`. Emits `lib/{es,umd,cjs}` and `lib/types`. |
| `pnpm test` | Vitest unit tests (`--passWithNoTests`). |
| `pnpm coverage` | Vitest with V8 coverage. |

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed — packages/core/vite.config.ts line 26 sets provider: 'istanbul' and the dep is @vitest/coverage-istanbul. Fixed in 90b4a88.

Comment thread CONTRIBUTING.md Outdated
- Base branch is `master` (not `main`).
- Use a Conventional-Commit-style title (it becomes the squash commit subject).
- Describe the **why** in the body, not just the **what** — the diff already shows the what. Link related issues with `Closes #123` / `Refs #123`.
- Pre-commit, `lint-staged` runs `eslint --fix` on staged `*.ts` and `stylelint --fix` on staged `*.{html,css}`. If a hook fails, fix the issue and create a new commit — **don't bypass with `--no-verify`** unless a maintainer asks you to.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right — .lintstagedrc is just {"*.ts": ["eslint --fix"], "*.css": ["stylelint --fix"]}, no HTML glob. Fixed in 90b4a88 and added a pointer to the file.

Comment thread CONTRIBUTING.md Outdated
## Testing

# Style Guide
- **Unit tests** live next to their source in `packages/core/src/**/__tests__/` or `*.test.ts`, run with Vitest under `happy-dom`. New parser logic, state transforms, and pure helpers should ship with unit coverage.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed — vite.config.ts doesn't set a global Vitest environment. A quick grep shows 23 of 47 test files in core opt into happy-dom via // @vitest-environment happy-dom; the rest run under the default Node environment. Reworded in 90b4a88.

Four factual corrections flagged in the PR #236 review:

- Code of Conduct: GitHub doesn't have DMs and issues in a public
  repo aren't confidential. Point at GitHub's abuse-reporting flow
  and the `author` email in `package.json` instead.
- `pnpm coverage`: the configured provider in `packages/core/vite.config.ts`
  is `istanbul` (`@vitest/coverage-istanbul`), not V8.
- lint-staged: `.lintstagedrc` only targets `*.css`, not `*.{html,css}`.
- Vitest environment: `vite.config.ts` doesn't set a global
  `environment`. Tests default to Node and opt into happy-dom with
  a `// @vitest-environment happy-dom` directive per file.
@Jocs
Jocs merged commit 5014463 into master May 21, 2026
6 checks passed
@Jocs
Jocs deleted the docs/contributing-align branch May 21, 2026 01:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants