question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Desperate 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:open
  • Created 6 years ago
  • Reactions:2
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
spenoircommented, Feb 14, 2018

Actually in my case where I wanted to flatten while copying Programmatically I had to do this:

copyfiles(["./src/**/*.html", "./dist/"], true, function (err) {
    if (err) console.error(err);
});

I found this out by checking your tests. This really needs to be documented

2reactions
topalavladcommented, Jul 3, 2019

I know this issue is pretty old but using true as the second parameter stops you from adding other parameters like error or verbose.

After looking through the code I saw that flat = true is actually transformed into up = true so for anyone who wants to use multiple parameters one of which is flat, the following will do the trick:

copyfiles(["./src/**/*.html", "./dist/"], {up: true, error: true, verbose: true}, function (err) {
    if (err) console.error(err);
});

@calvinmetcalf might be worth allowing people to use flat in the parameters object since the Read.me says:

if it is an object it is a hash of the various options (the long version e.g. up, all, flat, exclude, error, verbose and soft)

If you agree, I can create a PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is an Application Programming Interface (API)? - IBM
An API is a set of defined rules that explain how computers or applications communicate with one another. APIs sit between an application...
Read more >
API - Wikipedia
An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type...
Read more >
What is an API? (Application Programming Interface) - MuleSoft
API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other.
Read more >
What is an API? - API Beginner's Guide - AWS
API stands for Application Programming Interface. In the context of APIs, the word Application refers to any software with a distinct function.
Read more >
What is an API? Application programming interfaces explained
An API is an interface that software developers use to programmatically interact with software components or resources outside of their own code ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found