Skip to content

refactor: replace copy-dir with fs.cpSync()#154

Closed
sjinks wants to merge 12 commits intomainfrom
remove/copy-dir
Closed

refactor: replace copy-dir with fs.cpSync()#154
sjinks wants to merge 12 commits intomainfrom
remove/copy-dir

Conversation

@sjinks
Copy link
Copy Markdown
Member

@sjinks sjinks commented Dec 18, 2025

This pull request refactors the way directories are copied in the lib/utils.js module by replacing the use of the external copy-dir package with Node.js's built-in fs.cpSync method. This change simplifies dependencies and streamlines the codebase.

Dependency removal and code refactoring:

  • Removed the copy-dir dependency from package.json and all related require statements in lib/utils.js. [1] [2]
  • Replaced all usage of copydir.sync with the built-in fs.cpSync method, updating the filter function accordingly in the moveConfig function in lib/utils.js. [1] [2]

See also: Automattic/vip-cli#2295

Copy link
Copy Markdown

Copilot AI left a comment

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 refactors the directory copying functionality by removing the external copy-dir dependency and replacing it with Node.js's built-in fs.cpSync() method. This simplifies the dependency tree and leverages native filesystem capabilities.

Key changes:

  • Removed copy-dir package from dependencies
  • Updated moveConfig function to use fs.cpSync() with an adapted filter function
  • Modified filter function signature to match fs.cpSync() API expectations

Reviewed changes

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

File Description
package.json Removed copy-dir dependency from the dependencies list
yarn.lock Removed lockfile entry for copy-dir package
lib/utils.js Removed copydir import and replaced two instances of copydir.sync() calls with fs.cpSync(), updating the filter function accordingly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/utils.js Outdated
Comment thread lib/utils.js Outdated
Comment thread lib/utils.js
@sjinks sjinks force-pushed the remove/copy-dir branch 2 times, most recently from 4860bde to 13f8982 Compare December 18, 2025 19:36
@sjinks sjinks closed this Dec 18, 2025
@sjinks sjinks deleted the remove/copy-dir branch December 18, 2025 19:54
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