sindresorhus / cpy-cli

Copy files
MIT License
344 stars 33 forks source link

Initial folder structure not restored in destination folder #27

Closed johannchopin closed 2 years ago

johannchopin commented 3 years ago

Hey πŸ‘‹ First thanks for the effort put in this project πŸ‘

I have a project structure that looks like this:

project
β”‚
└───node_modules
β”‚   └───module
β”‚       └───public
β”‚           └───dist
β”‚               β”‚ styles.css
β”‚           β”‚ index.html
β”‚   
└───src

And I want to copy the public folder from node_modules/module/public into the src/public folder. So I run this command:

$ yarn cpy ./node_modules/module/public ./src/public

It works but the final src/public folder contains all the files but not the initial folder structure:

# just the files
β”‚   
└───src
    └───public
        β”‚ styles.css
        β”‚ index.html
# expected folder structure
β”‚   
└───src
    └───public
        └───dist
            β”‚ styles.css
        β”‚ index.html

And if I run it with the --parents I got this structure:

public
β”‚
└───node_modules
β”‚   └───module
β”‚       └───public
β”‚           └───dist
β”‚               β”‚ styles.css
β”‚           β”‚ index.html

Has someone an idea how I could get the expected folder structure?

Thanks in advance πŸ˜„

sindresorhus commented 3 years ago

I think https://github.com/sindresorhus/cpy/pull/77 will resolve your issue.

JounQin commented 3 years ago

@sindresorhus

Is the following expected because https://github.com/sindresorhus/cpy/pull/77 has been merged?

cpy node_modules/shiki/{dist,languages,themes} public/shiki --parents

image

sindresorhus commented 2 years ago

This is now fixed in cpy, so someone just needs to bring the updates here. https://github.com/sindresorhus/cpy/releases/tag/v9.0.0