Skip to content

fix: preserve manifest formatting when setting packageManager - #915

Closed
Aschenbath wants to merge 1 commit into
nodejs:mainfrom
Aschenbath:feat/preserve-manifest-format-504
Closed

Aschenbath wants to merge 1 commit into
nodejs:mainfrom
Aschenbath:feat/preserve-manifest-format-504

Conversation

@Aschenbath

Copy link
Copy Markdown

Writing packageManager currently serializes the entire manifest, removing blank lines and normalizing unrelated values. Update or append only the top-level property so automatic pinning, use, and up preserve the rest of the file byte for byte.

The updater validates the JSON before locating property boundaries. It handles nested values, escaped and duplicate keys, existing non-string values, CRLF/LF, tabs, and manifests without a trailing newline. No dependency is added.

Validation on Node.js 24.20.0:

  • Bundle and shims built successfully.
  • Full Vitest suite in replay mode with retries disabled: 9 files passed; 192 tests passed and 1 existing expected failure (193 total).
  • Repository-wide ESLint with --max-warnings=0, TypeScript, and git diff --check passed.
  • 17 updater tests and four CLI regressions cover insertion, replacement, up, and automatic pinning.

The local runner isolates inherited proxy settings from CLI fixtures while retaining proxy access for the live npm-key check. No tests were skipped for this environment adjustment.

Closes #504.

Implementation and automated validation were performed by Codex.

@aduh95

aduh95 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

This account has opened more than 10 PRs in the last 24 hours. This looks like bot activity, and will result in a ban if the behavior continues.

@aduh95 aduh95 closed this Oct 20, 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.

Corepack strips empty lines from package.json when inserting packageManager

2 participants