sindresorhus/cpy-cli

Inconsistent file tree depending on OS

Opened this issue · 9 comments

Consider the following file tree:

dist-tmp
└── index.html

On Windows, the command npx cpy-cli dist-tmp/** dist/ results in:

dist
└── index.html

On Linux, the same command npx cpy-cli dist-tmp/** dist/ results in:

dist
└── dist-tmp
    └── index.html

It happened using node 18.18.0 on both systems

Using this command should give same results cpy dist-tmp/**/* dist/

dist
└── index.html

Using this command should give same results cpy dist-tmp/**/* dist/

No, it results in 'cpy' is not recognized as an internal or external command, operable program or batch file.

One of the point of this package is having a cross-platform solution.

I also have the same problem

Using this command should give same results cpy dist-tmp/**/* dist/

No, it results in 'cpy' is not recognized as an internal or external command, operable program or batch file.

One of the point of this package is having a cross-platform solution.

replace cpy with npx cpy-cli if executed directly

replace cpy with npx cpy-cli if executed directly

The point of this thread is that npx cpy-cli has an inconsistent behaviour depending on the OS you're on, so your answer telling to use it doesn't make any sense as, once again, it is broken.

Anyway, I just found out that adding /* to the source fixes my issue.

Scratch my last. The workaround didn't work.

Just add single quote on src @adrien-febvay @zhangyahan @yukha-dw , It fixes the issue.

Wrong:
npx cpy-cli dist-tmp/** dist/

Right:
npx cpy-cli 'dist-tmp/**' dist/

ajiho commented

Just add single quote on src @adrien-febvay @zhangyahan @yukha-dw , It fixes the issue.

Wrong: npx cpy-cli dist-tmp/** dist/

Right: npx cpy-cli 'dist-tmp/**' dist/
I spent a lot of time debugging on Windows and Linux, but couldn't find where the error was. Your method is indeed effective

Just add single quote on src @adrien-febvay @zhangyahan @yukha-dw , It fixes the issue.

Wrong: npx cpy-cli dist-tmp/** dist/

Right: npx cpy-cli 'dist-tmp/**' dist/

@sanjaikumarv's solution did indeed resolve the issue. I am going to try my hand at resolving this issue given that the project is so small and; hopefully, have a fix up by the end of the week.

Just add single quote on src @adrien-febvay @zhangyahan @yukha-dw , It fixes the issue.

Wrong: npx cpy-cli dist-tmp/** dist/

Right: npx cpy-cli 'dist-tmp/**' dist/

I used double quotation marks because single ones won't work on PowerShell, but other than that, yes it works. Thank you.

{
  "scripts": {
    "postbuild": "npx cpy-cli \"dist-tmp/**\" dist/"
  }
}