Skip to content

[lexical-website] Documentation Update: fix $insertList argument in the commands guide - #9188

Merged
etrepum merged 1 commit into
meta:mainfrom
potatowagon:docs-commands-insert-list-bullet
Sep 22, 2026
Merged

etrepum merged 1 commit into
meta:mainfrom
potatowagon:docs-commands-insert-list-bullet

Conversation

@potatowagon

Copy link
Copy Markdown
Contributor

Description

The Commands guide reproduces the registerList handler for
INSERT_UNORDERED_LIST_COMMAND and calls $insertList('ul'). 'ul' is not a
ListType — it is a ListNodeTagType, the HTML tag name — so the snippet does
not typecheck and does not match the code it is quoting. $insertList takes
'number' | 'bullet' | 'check', and the real handler passes 'bullet'.

This changes the snippet to $insertList('bullet') so it matches
packages/lexical-list/src/registerList.ts.

Test plan

Documentation-only change (markdown is excluded from prettier via
.prettierignore), so the check is that the snippet now agrees with the source
it quotes.

Before

$ grep -n "insertList" packages/lexical-website/docs/concepts/commands.md
64:    $insertList('ul');

$ grep -n "export type ListType\|export type ListNodeTagType" packages/lexical-list/src/LexicalListNode.ts
56:export type ListType = 'number' | 'bullet' | 'check';
58:export type ListNodeTagType = 'ul' | 'ol';

$ grep -n "export function \$insertList" packages/lexical-list/src/formatList.ts
85:export function $insertList(listType: ListType): void {

'ul' is not assignable to ListType.

After

$ grep -n "insertList" packages/lexical-website/docs/concepts/commands.md
64:    $insertList('bullet');

$ grep -n -A4 "INSERT_UNORDERED_LIST_COMMAND," packages/lexical-list/src/registerList.ts
85:      INSERT_UNORDERED_LIST_COMMAND,
86-      () => {
87-        $insertList('bullet');
88-        return true;
89-      },

The documented snippet now matches the handler it quotes.

…he commands guide

## Description

The Commands guide reproduces the `registerList` handler for
`INSERT_UNORDERED_LIST_COMMAND` and calls `$insertList('ul')`. `'ul'` is not a
`ListType` — it is a `ListNodeTagType`, the HTML tag name — so the snippet does
not typecheck and does not match the code it is quoting. `$insertList` takes
`'number' | 'bullet' | 'check'`, and the real handler passes `'bullet'`.

This changes the snippet to `$insertList('bullet')` so it matches
`packages/lexical-list/src/registerList.ts`.

## Test plan

Documentation-only change (markdown is excluded from prettier via
`.prettierignore`), so the check is that the snippet now agrees with the source
it quotes.

### Before

```
$ grep -n "insertList" packages/lexical-website/docs/concepts/commands.md
64:    $insertList('ul');

$ grep -n "export type ListType\|export type ListNodeTagType" packages/lexical-list/src/LexicalListNode.ts
56:export type ListType = 'number' | 'bullet' | 'check';
58:export type ListNodeTagType = 'ul' | 'ol';

$ grep -n "export function \$insertList" packages/lexical-list/src/formatList.ts
85:export function $insertList(listType: ListType): void {
```

`'ul'` is not assignable to `ListType`.

### After

```
$ grep -n "insertList" packages/lexical-website/docs/concepts/commands.md
64:    $insertList('bullet');

$ grep -n -A4 "INSERT_UNORDERED_LIST_COMMAND," packages/lexical-list/src/registerList.ts
85:      INSERT_UNORDERED_LIST_COMMAND,
86-      () => {
87-        $insertList('bullet');
88-        return true;
89-      },
```

The documented snippet now matches the handler it quotes.
@vercel

vercel Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lexical Ready Ready Preview Sep 22, 2026 11:35am UTC
lexical-playground Ready Ready Preview Sep 22, 2026 11:35am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 22, 2026
@etrepum
etrepum added this pull request to the merge queue Sep 22, 2026
Merged via the queue into meta:main with commit 0d8a0ac Sep 22, 2026
42 checks passed
@etrepum etrepum mentioned this pull request Sep 28, 2026
zurfyx added a commit that referenced this pull request Oct 15, 2026
…at release, ship it in lexical, add a range view

## Description

`scripts/npm/update-changelog.mjs` wrote each release's CHANGELOG.md block
from `git log --oneline LATEST_RELEASE...HEAD~1`. It stripped every
character outside `[a-zA-Z0-9()\n \-,.#]`, so `[lexical][lexical-html]
Breaking Change:` became `lexicallexical-html Breaking Change`, `$insertList`
became `insertList`, and `Find & Replace` became `Find  Replace`. The
`HEAD~1` range dropped the newest commit, and the block had no categories,
links or migration notes.

This replaces it with the changesets added in the previous commit:

- `pnpm run update-changelog` (still called from `postversion` on the
  `latest` channel) now runs `scripts/changesets/release.mjs`: it validates
  the pending changesets, prepends a `## vX.Y.Z (date)` block (the heading
  shape Renovate and Dependabot slice on) with `### Breaking changes`,
  `### Deprecations`, `### Features`, `### Fixes`, `### Performance`,
  `### Documentation`, `### Other` (the `chore` category) and
  `### Contributors`, empty sections omitted, and deletes the consumed
  changesets. Each bullet is `**packages**: summary (#PR link)` with the
  entry's details, including `Migration:` code, reproduced verbatim. The PR
  number comes from the squash-merge subject of the commit that added the
  changeset; contributors from `@handle` lines, else that commit's author.
  Text is never filtered and nothing is dropped, since the input is the set
  of pending files rather than a git range.
- The release still picks its own version (Lexical does not run
  `changeset version`), but `increment-version` refuses a `latest` patch
  while a `[breaking]` changeset is pending, and `update-changelog` repeats
  the check. Prereleases (nightly, next, dev) leave changesets pending.
- `pnpm run changelog` previews the next block instead of printing `git log`.
- `pnpm run changelog:range -- --from X [--to Y] [--breaking] [--json]`
  prints every entry in (X, Y], oldest first, optionally only breaking
  changes and deprecations, optionally as JSON for tools and coding agents.
- `pnpm run release-notes -- --version X` prints a version's block for the
  GitHub release, under the hand-written intro.
- `lexical` now ships CHANGELOG.md: `prepare-release` copies the root file
  into `packages/lexical/` (gitignored) and `update-version` adds it to that
  package's `files`. Every app that uses Lexical installs `lexical`, so
  `node_modules/lexical/CHANGELOG.md` gives the full history to anyone
  upgrading from an installed version, offline.
- The maintainers guide describes the new release steps.

No library runtime code or public API changes.

## Test plan

### Before

The output of the old script, as committed in CHANGELOG.md:

```
$ grep -n 'lexicallexical-html\|Find  Replace\|fix insertList' CHANGELOG.md
20:- lexicallexical-html Breaking Change honor createDOM overrides in default DOM export (#9231) Bob Ippolito
47:- lexical-playground Bug Fix Fix Find  Replace offsets across decorators and slots (#9186) Monier Ayman
49:- lexical-website Documentation Update fix insertList argument in the commands guide (#9188) Sherry
```

### After

```
$ pnpm run test-unit scripts/__tests__/unit/changelog.test.ts scripts/__tests__/unit/changesets.test.ts
 ✓ |scripts-unit| scripts/__tests__/unit/changesets.test.ts (19 tests) 22ms
 ✓ |scripts-unit| scripts/__tests__/unit/changelog.test.ts (17 tests) 2327ms
 Test Files  2 passed (2)
      Tests  36 passed (36)
```

With three temporary example changesets (not committed) in `.changeset/`:

```
$ pnpm run changelog
## v0.53.0 (2026-10-15)

### Breaking changes

- **lexical, @lexical/html**: Example: remove `ExampleNode.legacyMethod`

  Migration: call `$exampleHelper(node)` instead.

  ```ts
  // Before
  node.legacyMethod();
  // After
  $exampleHelper(node);
  ```

  Detect: calls to `.legacyMethod(`.

### Deprecations

- **@lexical/table**: Example: deprecate `$exampleTableHelper`

  Replacement: `$exampleTableHelperFrom`.

  Removal: no earlier than v0.60.0.

### Fixes

- **@lexical/list**: Example: keep `listStyleType` when a list item is split

### Contributors

@Example-contributor

$ node scripts/changesets/release.mjs --version 0.52.1
Refusing to release 0.52.1 as a patch: 1 pending [breaking] changeset(s) need a minor release:
  - .changeset/tmp-breaking.md: Example: remove `ExampleNode.legacyMethod`
Run the release with the "minor" increment instead.

$ node scripts/npm/increment-version.mjs -i patch --channel latest
Refusing a patch release: 1 pending [breaking] changeset(s) need a minor release:
  - .changeset/tmp-breaking.md: Example: remove `ExampleNode.legacyMethod`
Run the "Create New Release Branch" workflow with the "minor" increment.
```

The same changesets in a throwaway clone, each committed with a
squash-merge style `(#NNNN)` subject, then the step `postversion` runs:

```
$ npm_package_version=0.53.0 node scripts/changesets/release.mjs --date 2026-10-30
Added v0.53.0 to CHANGELOG.md from 3 changeset(s).
$ git status --short
 D .changeset/tmp-breaking.md
 D .changeset/tmp-deprecation.md
 D .changeset/tmp-fix.md
 M CHANGELOG.md
$ head -32 CHANGELOG.md
## v0.53.0 (2026-10-30)

### Breaking changes

- **lexical, @lexical/html**: Example: remove `ExampleNode.legacyMethod` ([#9992](#9992))

  Migration: call `$exampleHelper(node)` instead.
  ...

### Deprecations

- **@lexical/table**: Example: deprecate `$exampleTableHelper` ([#9991](#9991))
  ...

### Fixes

- **@lexical/list**: Example: keep `listStyleType` when a list item is split ([#9990](#9990))

### Contributors

@Example-contributor, Dev Example

## v0.52.0 (2026-09-27)
```

Stock `changeset version` also accepts the config in that clone (all
published packages to 0.53.0, `lexical-playground` left at 0.52.0):

```
$ changeset version
🦋 changeset v3.0.3
All files have been updated. Review them and commit at your leisure
$ node -e "...lexical, @lexical/yjs, lexical-playground versions"
0.53.0 0.53.0 0.52.0
```

Range view and release notes on the current CHANGELOG.md (the breaking
sections are backfilled in the next commit):

```
$ pnpm run changelog:range -- --from 0.51.0 --breaking
No breaking changes or deprecations after 0.51.0.
$ pnpm run release-notes -- --version 0.52.0 | head -1
- lexical Bug Fix Track explicit Shift state for iOS line breaks (#9242) Bob Ippolito
```

The `lexical` tarball includes the copied changelog:

```
$ cp CHANGELOG.md packages/lexical/ && (cd packages/lexical && pnpm pack --dry-run) | grep -A3 'Tarball Contents'
Tarball Contents
CHANGELOG.md
LICENSE
README.md
```

`pnpm run tsc-scripts`, `pnpm run tsc-test`, ESLint and Prettier pass on the
changed files. The release workflows themselves were not run.
zurfyx added a commit that referenced this pull request Oct 15, 2026
…md from them at release

## Description

CHANGELOG.md is built from `git log` subjects by `scripts/npm/update-changelog.mjs`.
That script strips every character outside `[a-zA-Z0-9()\n \-,.#]`
(`[lexical][lexical-html] Breaking Change:` becomes
`lexicallexical-html Breaking Change`, `$insertList` becomes `insertList`),
drops the newest commit (`HEAD~1`), and has no categories, links or
migration notes. Whether a change is breaking is only as reliable as the PR
title, and migration instructions exist only in hand-written GitHub release
notes. Someone upgrading across several 0.x minors, or a tool such as
Renovate, Dependabot, or a coding agent, has nothing consistent to read.

This adds changesets, in the layout of the changesets project and following
the conventions of facebook/astryx, as the source of each changelog entry.
No new dependency: the scripts use Node built-ins only.

Format and checks:

- `.changeset/config.json` has one `fixed` group with every published package
  (globs) and ignores the private ones, so it stays compatible with standard
  changesets tooling. `.changeset/README.md` documents the format.
- A changeset body starts with `[category] one-line summary`; categories, in
  changelog order: `breaking`, `deprecation`, `feature`, `fix`, `perf`,
  `docs`, `chore` (aliases accepted). While 0.x, `breaking` uses `minor`,
  everything else `patch`; `major` is rejected. `breaking` needs a
  `Migration:` paragraph (optional `Detect:`, `Codemod:`, `Verify:`); `deprecation`
  needs `Replacement:` and should have `Removal:`. Optional `@handle` and
  `PR: #123` lines go under the summary.
- `pnpm run check-changesets` (in `ci-check`, a hard failure) also rejects
  empty frontmatter (pointing at the `skip-changeset` label), frontmatter
  comments, duplicate packages, Markdown headings in the body, TODO
  placeholders, and a config that no longer covers every package.
- `pnpm run changeset:new -- --category fix --packages lexical --summary "..."`
  writes a valid file, with TODO lines for the required breaking or
  deprecation paragraphs.
- A `Changesets` workflow checks coverage on pull requests: a change to a
  published package's `src/` (tests, benches, mocks excluded), Flow types, or
  consumer-facing `package.json` fields (dependencies, exports, files, type,
  imports, typesVersions, browser, publishConfig, ...) needs a changeset
  naming that package; deleting a published package needs a `[breaking]` one.
  It runs the checker from the base revision, exempts release PRs only from
  this repository, honors a `skip-changeset` label, and starts in warning
  mode (`CHANGESET_COVERAGE: warn`: job summary plus an annotation with the
  file to add).

Release:

- `update-changelog` (run by `postversion` on `latest`) now runs
  `scripts/changesets/release.mjs`. It renders the pending changesets as
  `## vX.Y.Z (date)` (the heading Renovate and Dependabot slice on) with
  Breaking changes, Deprecations, Features, Fixes, Performance,
  Documentation, Other and Contributors, then `### All changes`: every commit
  since the previous release with its subject unchanged and its PR linked,
  the newest included and release bump commits excluded. It then deletes the
  consumed changesets.
- PRs come from a `PR:` line, the squash-merge subject of the commit that
  added the changeset (following renames, not copies), the first-parent
  `Merge pull request #N`, or, with `GITHUB_TOKEN` (now passed in
  `call-release.yml`), the GitHub API, which also gives contributor logins.
  Bots are not credited.
- It refuses to run while the previous stable release (newest tag or
  `LATEST_RELEASE`) has no section in CHANGELOG.md, i.e. its release PR is
  not merged, so a second run cannot consume the same changesets.
  `increment-version` and `update-changelog` refuse a `latest` patch while a
  `[breaking]` changeset is pending.
- `lexical` ships CHANGELOG.md (copied by `prepare-release`, gitignored). For
  a prerelease the copy also lists pending changesets as `## Unreleased`; the
  repository file is unchanged.
- `pnpm run changelog` previews the next section;
  `pnpm run changelog:range -- --from X [--to Y] [--breaking] [--json] [--changelog F]`
  prints a range, oldest first (strict arguments, exit 2 on bad input, a
  note naming versions `--breaking` cannot show);
  `pnpm run release-notes -- --version X` prints a section as a starting
  point for the GitHub release.

CONTRIBUTING.md, the PR template, AGENTS.md and the maintainers guide
describe all of this. The maintainers guide keeps the `[Breaking Change]`
title rule and adds the changeset rule beside it. No library runtime code
or public API changes.

## Test plan

### Before

The output of the old script, as committed in CHANGELOG.md on main:

```
$ grep -n 'lexicallexical-html\|Find  Replace\|fix insertList' CHANGELOG.md
20:- lexicallexical-html Breaking Change honor createDOM overrides in default DOM export (#9231) Bob Ippolito
47:- lexical-playground Bug Fix Fix Find  Replace offsets across decorators and slots (#9186) Monier Ayman
49:- lexical-website Documentation Update fix insertList argument in the commands guide (#9188) Sherry
```

### After

```
$ pnpm run test-unit scripts/__tests__/unit/changesets.test.ts scripts/__tests__/unit/changelog.test.ts
      Tests  58 passed (58)

$ pnpm install --frozen-lockfile && git diff --stat origin/main -- pnpm-lock.yaml
(no lockfile change)
```

Format errors:

```
$ node scripts/changesets/check.mjs --dir demo-cs
Changeset check found 4 problem(s):

- demo-cs/bad.md: comments are not supported in the frontmatter ("# note"); list only "'package': bump" lines and put notes in the body.
- demo-cs/bad.md: "lexical" is listed more than once in the frontmatter.
- demo-cs/bad.md: Markdown headings ("## Details") are not allowed in a changeset; they would break the CHANGELOG.md structure. Use a paragraph or **bold** text instead.
- demo-cs/empty.md: the frontmatter lists no packages. Empty changesets are not used here: if the change has no effect on people who use Lexical, delete this file and ask a maintainer for the `skip-changeset` label instead.
```

Coverage on this commit alone (it changes `lexical`'s `files`, and its
changeset is in the next commit):

```
$ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn
warning: This pull request changes published code without a changeset for:
  lexical: packages/lexical/package.json (files)

Add a changeset, e.g. with

  pnpm run changeset:new -- --category fix --packages lexical --summary "..."
...
Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only.
```

Range input checks:

```
$ pnpm run changelog:range -- --from latest
--from must be a version such as 0.40.0, got "latest".
usage: pnpm run changelog:range -- --from <version> [--to <version>] [--breaking] [--json] [--changelog <file>]
(exit 2)
$ pnpm run changelog:range -- --from 0.50.0 --bogus
Unknown option '--bogus'
(exit 2)
```

Release dry runs with the changesets from the next commit are in that
commit's message. `pnpm run tsc-scripts`, `pnpm run tsc-test`, ESLint and
Prettier pass. The workflows themselves only run on GitHub.
zurfyx added a commit that referenced this pull request Oct 15, 2026
…md from them at release

## Description

CHANGELOG.md is built from `git log` subjects by `scripts/npm/update-changelog.mjs`.
That script strips every character outside `[a-zA-Z0-9()\n \-,.#]`
(`[lexical][lexical-html] Breaking Change:` becomes
`lexicallexical-html Breaking Change`, `$insertList` becomes `insertList`),
drops the newest commit (`HEAD~1`), and has no categories, links or
migration notes. Whether a change is breaking is only as reliable as the PR
title, and migration instructions exist only in hand-written GitHub release
notes. Someone upgrading across several 0.x minors, or a tool such as
Renovate, Dependabot, or a coding agent, has nothing consistent to read.

This adds changesets, in the layout of the changesets project and following
the conventions of facebook/astryx, as the source of each changelog entry.
No new dependency: the scripts use Node built-ins only.

Format and checks:

- `.changeset/config.json` has one `fixed` group with every published package
  (globs) and ignores the private ones, so it stays compatible with standard
  changesets tooling. `.changeset/README.md` documents the format.
- A changeset body starts with `[category] one-line summary`; categories, in
  changelog order: `breaking`, `deprecation`, `feature`, `fix`, `perf`,
  `docs`, `chore` (aliases accepted). While 0.x, `breaking` uses `minor`,
  everything else `patch`; `major` is rejected. `breaking` needs
  `Migration:` and `Detect:` (optional `Codemod:`, `Verify:`); `deprecation`
  needs `Replacement:` and `Removal:` (a version, `no earlier than v0.NN`,
  or `not scheduled`). Optional `@handle` and `PR: #123` lines go under the
  summary.
- A non-breaking entry with a `Verify:` paragraph (a fix that changes
  observable output or behavior) is listed under `### Behavior changes`,
  right after the breaking changes, with no new category.
- `pnpm run check-changesets` (in `ci-check`, a hard failure) also rejects
  empty frontmatter (pointing at the `skip-changeset` label), frontmatter
  comments, duplicate packages, Markdown headings in the body, TODO
  placeholders, and a config that no longer covers every package.
- `pnpm run changeset:new -- --category fix --packages lexical --summary "..."`
  writes a valid file, with TODO lines for the required breaking or
  deprecation paragraphs.
- A `Changesets` workflow checks coverage on pull requests: a change to a
  published package's `src/` (tests, benches, mocks excluded), Flow types, or
  consumer-facing `package.json` fields (dependencies, exports, files, type,
  imports, typesVersions, browser, publishConfig, ...) needs a changeset
  naming that package; deleting a published package needs a `[breaking]` one.
  It runs the checker from the base revision, exempts release PRs only from
  this repository, honors a `skip-changeset` label, and starts in warning
  mode (`CHANGESET_COVERAGE: warn`: job summary plus an annotation with the
  file to add and a link that opens it prefilled on the pull request's
  branch, built from the event payload). It stays `warn` until the
  `skip-changeset` label exists.

Release:

- `update-changelog` (run by `postversion` on `latest`) now runs
  `scripts/changesets/release.mjs`. It renders the pending changesets as
  `## vX.Y.Z (date)` (the heading Renovate and Dependabot slice on) with
  Breaking changes, Behavior changes, Deprecations, Features, Fixes, Performance,
  Documentation, Other and Contributors, then `### All changes`: every commit
  since the previous release with its subject unchanged and its PR linked,
  the newest included and release bump commits excluded. It then deletes the
  consumed changesets.
- PRs come from a `PR:` line, the squash-merge subject of the commit that
  added the changeset (following renames, not copies), the first-parent
  `Merge pull request #N`, or, with `GITHUB_TOKEN` (now passed in
  `call-release.yml`), the GitHub API, which also gives contributor logins.
  Bots are not credited.
- It refuses to run while the previous stable release (newest tag or
  `LATEST_RELEASE`) has no section in CHANGELOG.md, i.e. its release PR is
  not merged, so a second run cannot consume the same changesets.
  `increment-version` and `update-changelog` refuse a `latest` patch while a
  `[breaking]` changeset is pending.
- `lexical` ships CHANGELOG.md (copied by `prepare-release`, gitignored). For
  a prerelease the copy also lists pending changesets as `## Unreleased`; the
  repository file is unchanged.
- `pnpm run changelog` previews the next section;
  `pnpm run changelog:range -- --from X [--to Y] [--breaking] [--json] [--changelog F]`
  prints a range, oldest first; `--breaking` keeps breaking changes,
  behavior changes and deprecations, and JSON marks behavior changes with
  `behavior: true` (strict arguments, exit 2 on bad input, a note naming
  versions `--breaking` cannot show);
  `pnpm run release-notes -- --version X` prints a section as a starting
  point for the GitHub release.

CONTRIBUTING.md, the PR template, AGENTS.md and the maintainers guide
describe all of this. The maintainers guide keeps the `[Breaking Change]`
title rule and adds the changeset rule beside it. No library runtime code
or public API changes.

## Test plan

### Before

The output of the old script, as committed in CHANGELOG.md on main:

```
$ grep -n 'lexicallexical-html\|Find  Replace\|fix insertList' CHANGELOG.md
20:- lexicallexical-html Breaking Change honor createDOM overrides in default DOM export (#9231) Bob Ippolito
47:- lexical-playground Bug Fix Fix Find  Replace offsets across decorators and slots (#9186) Monier Ayman
49:- lexical-website Documentation Update fix insertList argument in the commands guide (#9188) Sherry
```

### After

```
$ pnpm run test-unit scripts/__tests__/unit/changesets.test.ts scripts/__tests__/unit/changelog.test.ts
      Tests  63 passed (63)

$ pnpm install --frozen-lockfile && git diff --stat origin/main -- pnpm-lock.yaml
(no lockfile change)
```

Format errors:

```
$ node scripts/changesets/check.mjs --dir demo-cs
Changeset check found 4 problem(s):

- demo-cs/bad.md: comments are not supported in the frontmatter ("# note"); list only "'package': bump" lines and put notes in the body.
- demo-cs/bad.md: "lexical" is listed more than once in the frontmatter.
- demo-cs/bad.md: Markdown headings ("## Details") are not allowed in a changeset; they would break the CHANGELOG.md structure. Use a paragraph or **bold** text instead.
- demo-cs/empty.md: the frontmatter lists no packages. Empty changesets are not used here: if the change has no effect on people who use Lexical, delete this file and ask a maintainer for the `skip-changeset` label instead.
```

Coverage on this commit alone (it changes `lexical`'s `files`, and its
changeset is in the next commit):

```
$ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn
warning: This pull request changes published code without a changeset for:
  lexical: packages/lexical/package.json (files)

Add a changeset, e.g. with

  pnpm run changeset:new -- --category fix --packages lexical --summary "..."
...
Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only.
```

The same check as the Changesets workflow runs it, with the event values it
copies into the environment:

```
$ GITHUB_ACTIONS=true GITHUB_STEP_SUMMARY=summary.md HEAD_REPO=zurfyx/lexical HEAD_REF=zurfyx/upgrade-guide \
    PR_TITLE="[lexical] Chore: Ship CHANGELOG.md in lexical" node scripts/changesets/check.mjs --base origin/main --coverage warn
$ tail -3 summary.md
[Add the changeset in the browser](https://github.com/zurfyx/lexical/new/zurfyx/upgrade-guide?filename=.changeset%2Fship-changelog-md-in-lexical.md&value=---%0A'lexical'%3A%20patch%0A---%0A%0A%5Bchore%5D%20Ship%20CHANGELOG.md%20in%20lexical%0A) (opens a prefilled file on this pull request's branch; edit the summary before committing).

See "Changesets" in CONTRIBUTING.md.
```

Range input checks:

```
$ pnpm run changelog:range -- --from latest
--from must be a version such as 0.40.0, got "latest".
usage: pnpm run changelog:range -- --from <version> [--to <version>] [--breaking] [--json] [--changelog <file>]
(exit 2)
$ pnpm run changelog:range -- --from 0.50.0 --bogus
Unknown option '--bogus'
(exit 2)
```

Release dry runs with the changesets from the next commit are in that
commit's message. `pnpm run tsc-scripts`, `pnpm run tsc-test`, ESLint and
Prettier pass. The workflows themselves only run on GitHub.
zurfyx added a commit that referenced this pull request Oct 15, 2026
…md from them at release

## Description

CHANGELOG.md is built from `git log` subjects by `scripts/npm/update-changelog.mjs`.
That script strips every character outside `[a-zA-Z0-9()\n \-,.#]`
(`[lexical][lexical-html] Breaking Change:` becomes
`lexicallexical-html Breaking Change`, `$insertList` becomes `insertList`),
drops the newest commit (`HEAD~1`), and has no categories, links or
migration notes. Whether a change is breaking is only as reliable as the PR
title, and migration instructions exist only in hand-written GitHub release
notes. Someone upgrading across several 0.x minors, or a tool such as
Renovate, Dependabot, or a coding agent, has nothing consistent to read.

This adds changesets, in the layout of the changesets project and following
the conventions of facebook/astryx, as the source of each changelog entry.
No new dependency: the scripts use Node built-ins only.

Format and checks:

- `.changeset/config.json` has one `fixed` group with every published package
  (globs) and ignores the private ones, so it stays compatible with standard
  changesets tooling. `.changeset/README.md` documents the format.
- A changeset body starts with `[category] one-line summary`; categories, in
  changelog order: `breaking`, `deprecation`, `feature`, `fix`, `perf`,
  `docs`, `chore` (aliases accepted). While 0.x, `breaking` uses `minor`,
  everything else `patch`; `major` is rejected. `breaking` needs
  `Migration:` and `Detect:` (optional `Codemod:`, `Verify:`); `deprecation`
  needs `Replacement:` and `Removal:` (a version, `no earlier than v0.NN`,
  or `not scheduled`). Optional `@handle` and `PR: #123` lines go under the
  summary.
- A non-breaking entry with a `Verify:` paragraph (a fix that changes
  observable output or behavior) is listed under `### Behavior changes`,
  right after the breaking changes, with no new category.
- `pnpm run check-changesets` (in `ci-check`, a hard failure) also rejects
  empty frontmatter (pointing at the `skip-changeset` label), frontmatter
  comments, duplicate packages, Markdown headings in the body, TODO
  placeholders, and a config that no longer covers every package.
- `pnpm run changeset:new -- --category fix --packages lexical --summary "..."`
  writes a valid file, with TODO lines for the required breaking or
  deprecation paragraphs.
- A `Changesets` workflow checks coverage on pull requests: a change to a
  published package's `src/` (tests, benches, mocks excluded), Flow types, or
  consumer-facing `package.json` fields (dependencies, exports, files, type,
  imports, typesVersions, browser, publishConfig, ...) needs a changeset
  naming that package; deleting a published package needs a `[breaking]` one.
  It runs the checker from the base revision, exempts release PRs only from
  this repository, honors a `skip-changeset` label, and starts in warning
  mode (`CHANGESET_COVERAGE: warn`: job summary plus an annotation with the
  file to add and a link that opens it prefilled on the pull request's
  branch, built from the event payload). It stays `warn` until the
  `skip-changeset` label exists.

Release:

- `update-changelog` (run by `postversion` on `latest`) now runs
  `scripts/changesets/release.mjs`. It renders the pending changesets as
  `## vX.Y.Z (date)` (the heading Renovate and Dependabot slice on) with
  Breaking changes, Behavior changes, Deprecations, Features, Fixes, Performance,
  Documentation, Other and Contributors, then `### All changes`: every commit
  since the previous release with its subject unchanged and its PR linked,
  the newest included and release bump commits excluded. It then deletes the
  consumed changesets.
- PRs come from a `PR:` line, the squash-merge subject of the commit that
  added the changeset (following renames, not copies), the first-parent
  `Merge pull request #N`, or, with `GITHUB_TOKEN` (now passed in
  `call-release.yml`), the GitHub API, which also gives contributor logins.
  Bots are not credited.
- It refuses to run while the previous stable release (newest tag or
  `LATEST_RELEASE`) has no section in CHANGELOG.md, i.e. its release PR is
  not merged, so a second run cannot consume the same changesets.
  `increment-version` and `update-changelog` refuse a `latest` patch while a
  `[breaking]` changeset is pending.
- `lexical` ships CHANGELOG.md (copied by `prepare-release`, gitignored). For
  a prerelease the copy also lists pending changesets as `## Unreleased`; the
  repository file is unchanged.
- `pnpm run changelog` previews the next section;
  `pnpm run changelog:range -- --from X [--to Y] [--breaking] [--json] [--changelog F]`
  prints a range, oldest first; `--breaking` keeps breaking changes,
  behavior changes and deprecations, and JSON marks behavior changes with
  `behavior: true` (strict arguments, exit 2 on bad input, a note naming
  versions `--breaking` cannot show);
  `pnpm run release-notes -- --version X` prints a section as a starting
  point for the GitHub release.

CONTRIBUTING.md, the PR template, AGENTS.md and the maintainers guide
describe all of this. The maintainers guide keeps the `[Breaking Change]`
title rule and adds the changeset rule beside it. No library runtime code
or public API changes.

## Test plan

### Before

The output of the old script, as committed in CHANGELOG.md on main:

```
$ grep -n 'lexicallexical-html\|Find  Replace\|fix insertList' CHANGELOG.md
20:- lexicallexical-html Breaking Change honor createDOM overrides in default DOM export (#9231) Bob Ippolito
47:- lexical-playground Bug Fix Fix Find  Replace offsets across decorators and slots (#9186) Monier Ayman
49:- lexical-website Documentation Update fix insertList argument in the commands guide (#9188) Sherry
```

### After

```
$ pnpm run test-unit scripts/__tests__/unit/changesets.test.ts scripts/__tests__/unit/changelog.test.ts
      Tests  64 passed (64)

$ pnpm install --frozen-lockfile && git diff --stat origin/main -- pnpm-lock.yaml
(no lockfile change)
```

Format errors:

```
$ node scripts/changesets/check.mjs --dir demo-cs
Changeset check found 4 problem(s):

- demo-cs/bad.md: comments are not supported in the frontmatter ("# note"); list only "'package': bump" lines and put notes in the body.
- demo-cs/bad.md: "lexical" is listed more than once in the frontmatter.
- demo-cs/bad.md: Markdown headings ("## Details") are not allowed in a changeset; they would break the CHANGELOG.md structure. Use a paragraph or **bold** text instead.
- demo-cs/empty.md: the frontmatter lists no packages. Empty changesets are not used here: if the change has no effect on people who use Lexical, delete this file and ask a maintainer for the `skip-changeset` label instead.
```

Coverage on this commit alone (it changes `lexical`'s `files`, and its
changeset is in the next commit):

```
$ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn
warning: This pull request changes published code without a changeset for:
  lexical: packages/lexical/package.json (files)

Add a changeset, e.g. with

  pnpm run changeset:new -- --category fix --packages lexical --summary "..."
...
Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only.
```

The same check as the Changesets workflow runs it, with the event values it
copies into the environment:

```
$ GITHUB_ACTIONS=true GITHUB_STEP_SUMMARY=summary.md HEAD_REPO=zurfyx/lexical HEAD_REF=zurfyx/upgrade-guide \
    PR_TITLE="[lexical] Chore: Ship CHANGELOG.md in lexical" node scripts/changesets/check.mjs --base origin/main --coverage warn
$ tail -3 summary.md
[Add the changeset in the browser](https://github.com/zurfyx/lexical/new/zurfyx/upgrade-guide?filename=.changeset%2Fship-changelog-md-in-lexical.md&value=---%0A'lexical'%3A%20patch%0A---%0A%0A%5Bchore%5D%20Ship%20CHANGELOG.md%20in%20lexical%0A) (opens a prefilled file on this pull request's branch; edit the summary before committing).

See "Changesets" in CONTRIBUTING.md.
```

Range input checks:

```
$ pnpm run changelog:range -- --from latest
--from must be a version such as 0.40.0, got "latest".
usage: pnpm run changelog:range -- --from <version> [--to <version>] [--breaking] [--json] [--changelog <file>]
(exit 2)
$ pnpm run changelog:range -- --from 0.50.0 --bogus
Unknown option '--bogus'
(exit 2)
```

Release dry runs with the changesets from the next commit are in that
commit's message. `pnpm run tsc-scripts`, `pnpm run tsc-test`, ESLint and
Prettier pass. The workflows themselves only run on GitHub.

This branch was successfully deployed

2 active deployments
Preview – lexical — 8c9dd776 Deployed Sep 22, 2026 by vercel[bot]
Preview – lexical-playground — 8c9dd776 Deployed Sep 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants