Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"analytics": "^0.2.0",
"analytics-plugin-ga": "^0.2.0",
"ava": "^5.3.1",
"cp-file": "^7.0.0",
"cp-file": "^10.0.0",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

Upgrading cp-file to version 10.0.0 introduces significant breaking changes that will likely break your project's scripts.

1. ESM-only package (Critical)

Version 10.0.0 is a pure ESM package, which means it can no longer be imported using require('cp-file') in a CommonJS project like this one. The project appears to be using CommonJS, as indicated by the use of require() in its source files and the absence of "type": "module" in package.json.

To resolve this, you will need to find where cp-file is used and switch to using a dynamic import() expression.

For example, if the code was:

const cpFile = require('cp-file');
// ...
await cpFile(source, destination);

It would need to be changed to something like this inside an async function:

const { cpFile } = await import('cp-file');
// ...
await cpFile(source, destination);

2. Progress Event API Change

Version 10.0.0 also removes the .on('progress') event emitter API in favor of an onProgress option. If your code uses the progress event, it will need to be updated.

Example of the new API:

await cpFile('source.txt', 'destination.txt', {
	onProgress: progress => {
		// ...
	}
});

Since I don't have access to the file using cp-file, I cannot provide a direct code suggestion. Please locate the usage and apply the necessary changes.

"eslint": "^9.0.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-import": "^2.29.1",
Expand Down