Files
Leosvel Pérez Espinosa c8f67bb236 fix(react-native): include migration docs in the built package (#36378)
> [!NOTE]
> #36377 makes the migrations reference pages read the `documentation`
key, which is what surfaces this package's missing file on the page. The
two PRs are independent and can merge in any order.

## Current Behavior

`@nx/react-native` declares a `documentation` file for
`update-23-0-0-migrate-create-nodes-v2-import`, but its assets config
never copies `src/migrations/**/*.md` into `dist`. Since the published
package ships its built output from `dist`, it points at a file it does
not contain:

- `nx migrate --run-migrations --agentic` warns that the documentation
file could not be resolved and drops it as agent context.
- The migrations reference page renders the entry with only its one-line
description, while the identical migration in sibling plugins renders
its docs.

Nothing caught this. `assertValidMigrationPaths` maps the published
`./dist/...` path back to the source tree and asserts the source file
exists, which it does, so the spec passes while the built package stays
broken.

## Expected Behavior

The markdown is copied into the built package, so the published tarball
contains the file it references and both consumers read it.

The `migration-markdown-assets` conformance rule closes the gap the spec
leaves open, for every package rather than the 27 with a
`migrations.spec.ts`. It checks each `prompt` and `documentation`
reference against the files the assets config actually produces,
catching a file that is never copied, one copied somewhere other than
the declared path, and a reference resolving outside the built output.
Rather than reimplementing the glob and output semantics, it drives the
copy-assets pipeline with a collecting callback in place of the copying
one, so the paths it compares against are the ones a build produces; it
needs no `dist`. `toExecutorAssets` moves out of the copy-assets plugin
so the rule and the plugin expand an `assets.json` the same way. The
generated `copy-assets` targets are unchanged.

Relative imports need a `.js` specifier under `nodenext`, which jest
resolves back to the TypeScript sources through the added
`moduleNameMapper`.

## Related Issue(s)

Fixes NXC-4713

<!-- polygraph-session-start -->
---
[View session information
↗](https://app.trypolygraph.com/orgs/6a061dcb561c062131116eca/sessions/fix-migration-docs-3961141b)
<!-- polygraph-session-end -->

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-07-22 17:04:10 +00:00

26 lines
398 B
JSON

{
"outDir": "packages/react-native/dist",
"assets": [
{
"glob": "src/migrations/**/*.md"
},
{
"glob": "**/files/**"
},
{
"glob": "**/files/**/.gitkeep"
},
{
"glob": "src/**/schema.json"
},
{
"glob": "src/**/schema.d.ts"
},
{
"glob": "typings/**/*.d.ts"
},
"LICENSE",
"packages/react-native/*.md"
]
}