Skip to content

Move outputFile to lib/ and simplify - #530

Merged
RyanZim merged 1 commit into
masterfrom
ryan/output-lib
Aug 27, 2026
Merged

Move outputFile to lib/ and simplify#530
RyanZim merged 1 commit into
masterfrom
ryan/output-lib

Conversation

@RyanZim

@RyanZim RyanZim commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Calling access before readFile is an anti-pattern; just handle the read error.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extracts the outputFile helper from index.js into a dedicated lib/outputFile.js module, reducing CLI entrypoint complexity and making the write-if-changed behavior reusable.

Changes:

  • Added lib/outputFile.js containing the extracted outputFile helper.
  • Updated index.js to import and use the new helper, removing the previous nested implementation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
lib/outputFile.js Introduces a shared outputFile helper for “write only if content changed” behavior.
index.js Replaces the inline outputFile helper with an import from lib/outputFile.js.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/outputFile.js
@@ -0,0 +1,11 @@
import fs from 'node:fs/promises'
import path from 'node:path'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Out of scope for this PR

Comment thread lib/outputFile.js
@RyanZim RyanZim changed the title Move outputFile to lib/ Move outputFile to lib/ and simplify Aug 27, 2026
@RyanZim
RyanZim merged commit 05d6568 into master Aug 27, 2026
7 checks passed
@RyanZim
RyanZim deleted the ryan/output-lib branch August 27, 2026 14:46
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