You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dry: true still writes files to disk (dry vs dryRun mismatch with comment-block-replacer) #126
With markdown-magic@4.8.0, passing dry: true to markdownMagic() does not prevent disk writes. Files are still modified, while the return value reports filesChanged: [] — so a "check"-style invocation silently mutates the files it was auditing.
Root cause
src/index.js derives its dry-run state from opts.dry (used for the return value and logging), but the actual write lives in the comment-block-replacer package, which reads opts.dryRun — a key index.js never sets or forwards. The two halves of the pipeline disagree about which option name means "don't write".
Repro
const{ markdownMagic }=require("markdown-magic");// file.md contains any transform block, e.g. <!-- docs TOC -->...<!-- /docs -->constresult=awaitmarkdownMagic(["./file.md"],{dry: true});console.log(result.filesChanged);// [] — claims nothing changed// ...but ./file.md has been rewritten on disk
dry: true performs the full transform pipeline in-memory and never touches disk (the per-file results[].isChanged / updatedContents are already populated correctly in that mode once dryRun is also set).
Suggested fix
Forward dry into the replacer's dryRun option (or unify the option name across the packages).
Environment: markdown-magic@4.8.0, comment-block-replacer as resolved by its lockfile, Node 25.
Activity