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

--cwd flag does not work #35

Open
ZebraFlesh opened this issue Mar 1, 2022 · 10 comments
Open

--cwd flag does not work #35

ZebraFlesh opened this issue Mar 1, 2022 · 10 comments

Comments

@ZebraFlesh
Copy link

Previously I was executing the following command with 3.1.x

cpy **/*.scss !**/*.stories.scss ../lib --parents --cwd=src

with a result similar to:

% ls lib/**/*.scss 
lib/Button/Button.scss
lib/ButtonLink/ButtonLink.scss
lib/Checkbox/Checkbox.scss

However, the 4.0 release doesn't find any files to copy. This seems like a globbing problem.

@sindresorhus
Copy link
Owner

Does it work if you remove !**/*.stories.scss?

@sindresorhus
Copy link
Owner

// @andy2mrqz

@ZebraFlesh
Copy link
Author

Does it work if you remove !**/*.stories.scss?

Strangely no: it encounters an error trying to copy a file from the node_modules directory, which is a sibling to src. So it seems like the --cwd=src flag is not being honored. (If the flag was honored, cpy-cli wouldn't even traverse into the node_modules directory.)

@farfromrefug
Copy link

I face the same issue. 4.x is not working for me anymore. Had to rollback to 3.x

@andy2mrqz
Copy link
Contributor

@sindresorhus thanks for tagging, I totally missed the notifications and didn't see this until now.

I inspected #34 to see if that could have introduced a regression. The areas that my PR touched were:

  • upgrading to cpy v9
  • updating tests
  • updating documentation

I think the regression may have been introduced in cpy v9, which this package proxies to, in sindresorhus/cpy#92. The most recent comment as of writing mentions an issue very similar to this one.

I also was able to recreate this issue by creating a simple repo with cpy and the file structure that ZebraFresh mentioned in his description. This seems to indicate that cpy-cli is not the failure point.

Sometime in the coming days/weeks I'll spend some time and see if I can resolve the issue in cpy - but the main blockers there are time and my lack of familiarity with cpy internals. Anyone else interested should feel free to jump in and contribute as well, if able.

@jurijzahn8019
Copy link

Hi there,

The current behavior i see is, that glob patterns must start with a posix path segment:

  • src/*.foo
  • ./*foo
  • ./**/*.foo

**/* will not work.

Possible fix could be

  • change glob pattern to start with some posix segment. (which i am doing 😄 )
  • cpy could do it internally

@farfromrefug
Copy link

Just managed to fix this in my setup and i saw actually 1 issue and 1 breaking change:

  • indeed as @jurijzahn8019 said the pattern must start with a posix path.
  • the destination is not relative to --cwd anymore but instead relative to actual current cwd.

@RiZKiT
Copy link

RiZKiT commented Sep 25, 2023

Not sure if it is related or if I should open another ticket, but with 5.0.0 --cwd isn't working for us anymore the way it does in 4.x, so we had to switch back to 4.x.

@stweet
Copy link

stweet commented Feb 15, 2024

with 5.0.0 don't work '--cwd'

@farfromrefug
Copy link

@sindresorhus would be nice to have some feedback on this. I have been stuck on 3.x because of this. Hope you can look at it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants