Programic API
See original GitHub issueDesperate need for documentation here.
I have been an advocate for npm scripting of build processes for many departments at my work and I sold them a group of npm packages to get the job done, copyfiles
being one of them. We have recently converted from npm scripts within package.json to writing out a node build file.
We are going to have to switch away from copyfiles
do to the lack of documentation and below.
takes an array of paths, last one is the destination path…
On the command line that makes sense, programatically it is nonsensical. I can’t explain to other developers why the “last item in the array is the destination” and any new developer coming on board would have to get taught that as well.
This npm package has been great to me, I would love to see more documentation on “programmatic” usage as well an additional parameter when calling copyfiles
in that environment.
Something like:
copyfiles(path, dest [, opts] [, callback])
Example
var copyfiles = require('copyfiles');
copyfiles(["./src/**/*.html"], "./dist/", function (err) {
if (err) console.error(err);
});
Example w/opts
var copyfiles = require('copyfiles');
// I honestly don't understand how you are taking options here because it isn't documented.
copyfiles(["./src/**/*.html"], "./dist/", "-u", function (err) {
if (err) console.error(err);
});
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:10 (3 by maintainers)
Top GitHub Comments
Actually in my case where I wanted to flatten while copying Programmatically I had to do this:
I found this out by checking your tests. This really needs to be documented
I know this issue is pretty old but using
true
as the second parameter stops you from adding other parameters likeerror
orverbose
.After looking through the code I saw that
flat = true
is actually transformed intoup = true
so for anyone who wants to use multiple parameters one of which isflat
, the following will do the trick:@calvinmetcalf might be worth allowing people to use
flat
in the parameters object since the Read.me says:If you agree, I can create a PR.