Skip to content

Fork ubroken module#15892

Merged
vmoroz merged 2 commits intomicrosoft:mainfrom
vmoroz:PR/fork-unbroken-module
Apr 1, 2026
Merged

Fork ubroken module#15892
vmoroz merged 2 commits intomicrosoft:mainfrom
vmoroz:PR/fork-unbroken-module

Conversation

@vmoroz
Copy link
Copy Markdown
Member

@vmoroz vmoroz commented Mar 31, 2026

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Why

The CI linting pipeline uses the external unbroken npm package (v1.0.27) to
check for broken links in markdown files. The package is no longer actively
maintained, and it fails on transient HTTP errors (e.g. 502) without retrying,
causing spurious CI failures when GitHub is temporarily flaky. It also pulls in
several external dependencies (axios, chalk, command-line-args, command-line-usage,
micromatch) that increase the supply chain risk surface.

What

Forked the unbroken package into the monorepo as @rnw-scripts/unbroken,
following the same conventions as other @rnw-scripts packages
(e.g. prepare-release).

Key changes from the original:

  • Retry transient HTTP errors: HTTP 502, 503, and 504 responses now trigger
    retries with exponential backoff (up to 5 attempts), instead of failing
    immediately. Previously only HTTP 429 (rate limiting) was retried.
  • Replaced axios with Node.js built-in fetch: Removes the external HTTP
    client dependency entirely. The fetch API is available globally since
    Node 18, and the package targets Node >= 22.
  • Replaced command-line-args/command-line-usage with parseArgs from
    node:util
    : Uses the Node.js built-in CLI argument parser, matching the
    pattern established in @rnw-scripts/prepare-release.
  • Replaced micromatch with path.matchesGlob(): Uses the Node.js 22.5+
    built-in glob matcher for exclusion pattern matching.
  • Replaced chalk with ANSI escape codes: Simple helper functions
    (yellowBold, redBold) for colored output, no external dependency needed.
  • Replaced source-map-support with process.setSourceMapsEnabled(true):
    Uses the Node.js built-in source map support.
  • Replaced fs with @react-native-windows/fs: Follows the repo convention
    enforced by ESLint.
  • Fixed broken links in docs/react-native-windows-init.md: Updated
    http:// mustache links to https://.

The result is a package with zero external runtime dependencies (only
@react-native-windows/fs from the monorepo).

Original copyright and license (MIT, Alexander Sklar) are preserved in both
the LICENSE file and source file headers. The original project URL
(https://github.com/asklar/unbroken) is referenced in the help output.

The root package.json now depends on @rnw-scripts/unbroken instead of
unbroken. No pipeline YAML changes are needed since the binary name
(unbroken) is preserved via the package's bin field.

Screenshots

N/A

Testing

  • Ran npx unbroken -q --local-only --allow-local-line-sections successfully
    (0 errors, 1 warning — same as before).
  • Ran npx unbroken --help to verify CLI argument parsing works correctly.
  • Ran yarn build and rnw-scripts lint:fix on the new package with no errors.

Changelog

Should this change be included in the release notes: no

Microsoft Reviewers: Open in CodeFlow

@vmoroz vmoroz requested a review from a team as a code owner March 31, 2026 23:59
@vmoroz vmoroz enabled auto-merge (squash) April 1, 2026 02:16
Copy link
Copy Markdown
Contributor

@iamAbhi-916 iamAbhi-916 left a comment

Choose a reason for hiding this comment

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

LGTM

@vmoroz vmoroz merged commit 7cde79d into microsoft:main Apr 1, 2026
32 checks passed
iamAbhi-916 pushed a commit to iamAbhi-916/react-native-windows that referenced this pull request Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants