New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Directory structure not maintained during copy #113
Comments
Okay, it seems my issue is similar to this. #105 |
Seems I've just ran into the same issue and I managed to solve it by using a relative path for the destination. Hope it'll work for your case as well. |
@editedredx Can you share an example of the code that works for you? |
Sure, my failing code looked like this: cpy(
[
appPath
],
path.resolve('dist')
); The change is just a relative destination path: cpy(
[
appPath
],
'dist'
); EDIT: Removed the no longer needed options. I checked where it went wrong in the installed cpy and it seems to be in the preprocessDestinationPath function where it just appends the file name to the destination. https://github.com/sindresorhus/cpy/blob/main/index.js#L96 if (path.isAbsolute(destination)) {
return path.join(destination, entry.name);
} |
FYI, I think I found a breaking change in how CWD is handled (default |
I can confirm this issue after upgrading from 8.1.2 to 9.0.1. Before:
After:
|
You can find source code for reproduction here. https://github.com/thetutlage/cpy-issue-reproduction
I expect
cpy
to maintain the folder structure of the source when copying files to destination.Source directory structure
Code to copy the files
Expected output
Actual output
The text was updated successfully, but these errors were encountered: