{"action":"created","issue":{"url":"https://api.github.com/repos/componentjs/builder2.js/issues/69","repository_url":"https://api.github.com/repos/componentjs/builder2.js","labels_url":"https://api.github.com/repos/componentjs/builder2.js/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/componentjs/builder2.js/issues/69/comments","events_url":"https://api.github.com/repos/componentjs/builder2.js/issues/69/events","html_url":"https://github.com/componentjs/builder2.js/issues/69","id":38978878,"number":69,"title":"Example from documentation does not copy files","user":{"login":"ismay","id":7355199,"avatar_url":"https://avatars.githubusercontent.com/u/7355199?v=3","gravatar_id":"","url":"https://api.github.com/users/ismay","html_url":"https://github.com/ismay","followers_url":"https://api.github.com/users/ismay/followers","following_url":"https://api.github.com/users/ismay/following{/other_user}","gists_url":"https://api.github.com/users/ismay/gists{/gist_id}","starred_url":"https://api.github.com/users/ismay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ismay/subscriptions","organizations_url":"https://api.github.com/users/ismay/orgs","repos_url":"https://api.github.com/users/ismay/repos","events_url":"https://api.github.com/users/ismay/events{/privacy}","received_events_url":"https://api.github.com/users/ismay/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-07-29T11:11:29Z","updated_at":"2016-05-07T14:55:04Z","closed_at":"2014-07-29T12:00:08Z","body":"The [example](https://github.com/component/builder2.js#example) from the documentation does not copy files to the destination folder when the `copy()` plugin is used instead of the `symlink()` plugin.\r\n\r\n```javascript\r\n  // only copy `images` to the build folder\r\n  build.files(tree)\r\n    .use('images', build.plugins.copy())\r\n    .end(); // callback optional\r\n```\r\n\r\nIt seems like there's something missing from the example (I assume that the actual copying still has to be done, with a callback maybe?), but I'm not able to figure it out from the docs alone, as I couldn't find any documentation on what the copy plugin actually does. My full code is:\r\n\r\n```javascript\r\nvar fs = require('fs');\r\nvar resolve = require('component-resolver');\r\nvar build = require('component-builder');\r\nvar mkdirp = require('mkdirp');\r\n\r\nvar argv = require('minimist')(process.argv.slice(2), {boolean: true}); // parse argument options\r\nvar src = process.cwd() + '/' + argv.src;\r\nvar dest = process.cwd() + '/' + argv.dest;\r\nvar components = process.cwd() + '/' + argv.components;\r\nvar buildname = argv.buildname;\r\nvar dev = argv.dev || false;\r\n\r\n// resolve the dependency tree\r\nresolve(src, {\r\n  install: true, // install the remote components locally\r\n  development: dev, // whether to include development components\r\n  out: components // folder to install components to\r\n}, function (err, tree) {\r\n  if (err) throw err;\r\n\r\n  // create 'dest' path\r\n  mkdirp(dest, function (err) {\r\n    if (err) throw err;\r\n  });\r\n\r\n  // build `.js` files from components' `.scripts` field\r\n  build.scripts(tree)\r\n    .use('scripts', build.plugins.js())\r\n    .end(function (err, string) {\r\n      if (err) throw err;\r\n      fs.writeFileSync(dest + '/' + buildname + '.js', string);\r\n    });\r\n\r\n  // build `.css` files from components' `.styles` field\r\n  build.styles(tree)\r\n    .use('styles', build.plugins.css())\r\n    .end(function (err, string) {\r\n      if (err) throw err;\r\n      fs.writeFileSync(dest + '/' + buildname + '.css', string);\r\n    });\r\n\r\n  // copy other files to the build folder\r\n  build.files(tree)\r\n    .use('files', build.plugins.copy())\r\n    .use('fonts', build.plugins.copy())\r\n    .use('images', build.plugins.copy())\r\n    .end(); // callback optional\r\n})\r\n```\r\n\r\nand the component I'm trying to compile is:\r\n\r\n```json\r\n{\r\n  \"name\": \"boot\",\r\n  \"images\": [\r\n    \"logo.jpg\"\r\n  ]\r\n}\r\n```\r\n\r\nMaybe the docs could be expanded with an example for `.copy()`, or elaborate a little on what the `.copy()` plugin actually does?"},"comment":{"url":"https://api.github.com/repos/componentjs/builder2.js/issues/comments/217642495","html_url":"https://github.com/componentjs/builder2.js/issues/69#issuecomment-217642495","issue_url":"https://api.github.com/repos/componentjs/builder2.js/issues/69","id":217642495,"user":{"login":"timaschew","id":110870,"avatar_url":"https://avatars.githubusercontent.com/u/110870?v=3","gravatar_id":"","url":"https://api.github.com/users/timaschew","html_url":"https://github.com/timaschew","followers_url":"https://api.github.com/users/timaschew/followers","following_url":"https://api.github.com/users/timaschew/following{/other_user}","gists_url":"https://api.github.com/users/timaschew/gists{/gist_id}","starred_url":"https://api.github.com/users/timaschew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timaschew/subscriptions","organizations_url":"https://api.github.com/users/timaschew/orgs","repos_url":"https://api.github.com/users/timaschew/repos","events_url":"https://api.github.com/users/timaschew/events{/privacy}","received_events_url":"https://api.github.com/users/timaschew/received_events","type":"User","site_admin":false},"created_at":"2016-05-07T14:55:04Z","updated_at":"2016-05-07T14:55:04Z","body":"Not sure, but here is the source code: https://github.com/componentjs/builder2.js/blob/master/lib/plugins/copy.js\r\n\r\nIt uses the __cp__ module https://www.npmjs.com/package/cp"}}