Skip to content
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

Option 'parents' missing #103

Open
h-evers opened this issue Jun 30, 2022 · 3 comments
Open

Option 'parents' missing #103

h-evers opened this issue Jun 30, 2022 · 3 comments

Comments

@h-evers
Copy link

h-evers commented Jun 30, 2022

Hey, i am not able to copy a directory structure with the whole structure any more. With v9.x i always end up getting a flattened result - what is my error?

In v8 i used

await cpy('**', destination, { parents: true, cwd: source });

and now i thought

await cpy(source, destination);
or maybe
await cpy(source+'/**', destination);

should work?

@sindresorhus
Copy link
Owner

Did you read the release notes? It shows how to migrate the option.

@h-evers
Copy link
Author

h-evers commented Jun 30, 2022

I did read them - maybe i didn't understand correctly. From what i understood "parents" should not be neccessary anymore

Old:
cpy('.github/**', 'dest', {parents: true})

New:
cpy('.github', 'dest')

and that's what i tried with

cpy(source, destination)

but that's flattened anyhow?

@h-evers
Copy link
Author

h-evers commented Jul 1, 2022

After some digging found the problem / difference with versions prior to v9: in case the destination path given is absolute, the source path is stripped and - as stated - all source directories are omitted / flattened.

96ll
if (path.isAbsolute(destination)) { return path.join(destination, entry.name); }
That definitely hadn't been the case in versions prior v9 - and it makes no sense to me.

lselden added a commit to lselden/cpy that referenced this issue Jul 25, 2022
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

No branches or pull requests

2 participants