kentcdodds / nps-utils

Utilities for http://npm.im/nps (npm-package-scripts)
https://doclets.io/kentcdodds/nps-utils/master
MIT License
101 stars 23 forks source link

cpy-cli fails to copy a folder recursively #20

Closed indfnzo closed 6 years ago

indfnzo commented 7 years ago

Can't seem to copy folders with subfolders recursively using the built-in cpy-cli. See https://github.com/sindresorhus/cpy-cli/issues/10.

Project is running on Windows.

indfnzo commented 7 years ago

Since apparently, cpy doesn't currently support recursive copying, would it be possible to somehow switch providers from cpy-cli to ncp? Or maybe we could simply create a new util (say, ncopy), referencing ncp via cli.

Another alternative: a wrapper for fs-extra as nps utils.

indfnzo commented 7 years ago

Update: I have a working setup with ncopy exported as another utility under nps-utils. I use it like so:

const { series, ncp } = require('nps-utils');

module.exports = {
    scripts: {
        someScript: series(
            ( ... ),
            ncp('dist dist2')
        )
    }
}

This successfully copies all contents of dist onto dist2, including subfolders and files inside subfolders.

If you're fine with this implementation, I can make a PR to get this merged.

kentcdodds commented 7 years ago

That looks good to me! Feel free to make a pull request 👍 Be sure to include tests and docs 😀

kentcdodds commented 7 years ago

And thank you!