{"action":"created","issue":{"url":"https://api.github.com/repos/bower/bower.json-spec/issues/47","labels_url":"https://api.github.com/repos/bower/bower.json-spec/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/bower/bower.json-spec/issues/47/comments","events_url":"https://api.github.com/repos/bower/bower.json-spec/issues/47/events","html_url":"https://github.com/bower/bower.json-spec/issues/47","id":90096553,"number":47,"title":"files: list all required files for build tools","user":{"login":"desandro","id":85566,"avatar_url":"https://avatars.githubusercontent.com/u/85566?v=3","gravatar_id":"","url":"https://api.github.com/users/desandro","html_url":"https://github.com/desandro","followers_url":"https://api.github.com/users/desandro/followers","following_url":"https://api.github.com/users/desandro/following{/other_user}","gists_url":"https://api.github.com/users/desandro/gists{/gist_id}","starred_url":"https://api.github.com/users/desandro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/desandro/subscriptions","organizations_url":"https://api.github.com/users/desandro/orgs","repos_url":"https://api.github.com/users/desandro/repos","events_url":"https://api.github.com/users/desandro/events{/privacy}","received_events_url":"https://api.github.com/users/desandro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":39,"created_at":"2015-06-22T13:22:15Z","updated_at":"2015-06-26T05:12:50Z","closed_at":null,"body":"Since resolving `main` in #43, we've thrown a wrench in the gears for build tools, most prevelantly [Wiredep](https://github.com/taptapship/wiredep). Wiredep needs a list of all the files to be included when you install the package. Previously, `main` was being widely used for this purpose. Now `main` should no longer lists all the files (_The entry-point files necessary to use your package. One per filetype_). We need another field.\r\n\r\nThese two proposals are my first shot at it. Your thoughts appreciated :watermelon:\r\n\r\n## Proposal 1: `files` flat list\r\n\r\n> `files` is an array of all the files required to use the package. Filepaths may include globs.\r\n>\r\n>`files` differs from `main` in that `main` only lists single files per filetype, whereas `files` should include every file.\r\n>\r\n> We recommend listing source files in `files`, rather than compiled distribution files.\r\n\r\n``` json\r\n\"files\": [\r\n  \"js/motion.js\",\r\n  \"js/run.js\",\r\n  \"js/walk.js\",\r\n  \"sass/motion.scss\",\r\n  \"sass/run.scss\",\r\n  \"sass/walk.scss\",\r\n  \"img/motion.png\",\r\n  \"img/walk.png\",\r\n  \"img/run.png\",\r\n  \"fonts/icons.woff2\",\r\n  \"fonts/icons.woff\"\r\n]\r\n```\r\n\r\nMost likely you would list globs for multiple files of the same type.\r\n\r\n``` json\r\n\"files\": [\r\n  \"js/*.js\",\r\n  \"sass/*.scss\",\r\n  \"img/*.*\",\r\n  \"fonts/*.*\"\r\n]\r\n```\r\n\r\n**Pros**: Simple specification, easier for developers to adopt. Don't have to worry on Bower spec side about asset-type specification. **Cons**: Aside from file extension, it's not clear what files do what. For example, a package make require `icon.svg` — is this file a font or should be it used as an image?\r\n\r\nWe leave it up to build tools on how they make use of the array. Some might only be concerned about `.js` and `.css` files. For globs, they'd have to expand the glob and do the logic on their side.\r\n\r\n## Proposal 2: asset-type object\r\n\r\nTaking from #21 \r\n\r\n> `files` is an object listing all the files required to use the package. `files` are listed as arrays for each type of asset.\r\n>\r\n> + `scripts`: Script files like JavaScript `.js` or CoffeeScript `.coffee`\r\n> + `styles`: Style files like CSS `.css`, Sass `.scss`, or LESS `.less`\r\n> + `images`: ...\r\n> + `fonts`: ...\r\n> + `data`\r\n> + `templates`\r\n> + (Others — we'd have to determine this spec)\r\n> \r\n> Filepaths may include globs. yada yada yada ....\r\n\r\n``` json\r\n\"files\": {\r\n  \"scripts\": [\r\n    \"js/motion.js\",\r\n    \"js/run.js\",\r\n    \"js/walk.js\",\r\n  ],\r\n  \"styles\": [\r\n    \"sass/motion.scss\",\r\n    \"sass/run.scss\",\r\n    \"sass/walk.scss\",\r\n  ],\r\n  \"images\": [\r\n    \"img/motion.png\",\r\n    \"img/walk.png\",\r\n    \"img/run.png\",\r\n  ],\r\n  \"fonts\": [\r\n    \"fonts/icons.woff2\",\r\n    \"fonts/icons.woff\"\r\n  ]\r\n}\r\n```\r\n\r\n**Pro**: Clear about what files do what. **Cons**: More complex. We'd have to figure out the list of types. Might be confusing files that do not have an explicit type, like if there's a video file and we don't have a `videos` field.\r\n\r\n_Fun fact_: recommended way back in 2013 https://github.com/bower/bower/issues/935#issuecomment-26923813\r\n\r\n---\r\n\r\n`files` would live along side `main`, not overwrite it. I'm not sure if it should be required or part of the `bower init` flow at this point.\r\n\r\nCurrently, I prefer Proposal 1. Easier for authors and for Bower spec.\r\n\r\n### Related issues\r\n\r\n+ taptapship/wiredep#180\r\n+ twbs/bootstrap#16663\r\n+ metafizzy/outlayer#33"},"comment":{"url":"https://api.github.com/repos/bower/bower.json-spec/issues/comments/115517062","html_url":"https://github.com/bower/bower.json-spec/issues/47#issuecomment-115517062","issue_url":"https://api.github.com/repos/bower/bower.json-spec/issues/47","id":115517062,"user":{"login":"donaldpipowitch","id":1152805,"avatar_url":"https://avatars.githubusercontent.com/u/1152805?v=3","gravatar_id":"","url":"https://api.github.com/users/donaldpipowitch","html_url":"https://github.com/donaldpipowitch","followers_url":"https://api.github.com/users/donaldpipowitch/followers","following_url":"https://api.github.com/users/donaldpipowitch/following{/other_user}","gists_url":"https://api.github.com/users/donaldpipowitch/gists{/gist_id}","starred_url":"https://api.github.com/users/donaldpipowitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donaldpipowitch/subscriptions","organizations_url":"https://api.github.com/users/donaldpipowitch/orgs","repos_url":"https://api.github.com/users/donaldpipowitch/repos","events_url":"https://api.github.com/users/donaldpipowitch/events{/privacy}","received_events_url":"https://api.github.com/users/donaldpipowitch/received_events","type":"User","site_admin":false},"created_at":"2015-06-26T05:12:50Z","updated_at":"2015-06-26T05:12:50Z","body":"> bower in fundamentally different than npm no matter what you do.\r\n\r\n> 2. npm does NOT do well with other file types. This could be addressed by another field (In my early comments).\r\n\r\nLooks like they don't differ _that_ much and we're allowed to add new fields to `package.json`. :)\r\n\r\n"}}