Reputation: 13194
I'm trying to use the NPM copyfiles
package, which I used many times. But I'm trying to copy the content of a dist
folder in a destination folder without creating a dist
but I can't find the correct way of doing it. I basically just want the content of the dist
(not the folder in itself).
So what I have is
-- dist
|
-- bundles
-- lib
package.json
I want this result
-- destination
|
-- bundles
-- lib
package.json
but I always get the dist
in the destination which is unwanted
-- destination
|
-- dist
|
-- bundles
-- lib
package.json
I tried
cross-env copyfiles dist/**/*.* ../dest
I also tried with the --up 1
cross-env copyfiles --up 1 dist/**/*.* ../dest
The only thing that works is with the -f
(flatten) flag but I lose the folder structure.
cross-env -f copyfiles dist/**/*.* ../dest
Am I missing something or is it just not possible?
Upvotes: 1
Views: 4851
Reputation: 341
Got this working with ncp npm package.
ncp ./dist/ dest --filter **/*.*
Upvotes: 0
Reputation: 24982
Firstly, given the examples shown in your question there is no need to use copyfiles
with the additional package cross-env. The package copyfiles will work cross platforms.
cross-env
is used for setting and using environment variables, e.g. NODE_ENV=production
.
Using the --up 1
argument, (or its shorthand equivalent -u 1
), with copyfiles
is the correct way to omit the dist
directory. So just use the following instead:
copyfiles --up 1 dist/**/*.* ../dest
I.e. remove the initial cross-env
part to resolve the issue.
Upvotes: 7