-
Notifications
You must be signed in to change notification settings - Fork 128
Description
Since resolving main in #43, we've thrown a wrench in the gears for build tools, most prevelantly 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.
These two proposals are my first shot at it. Your thoughts appreciated 🍉
Proposal 1: files flat list
filesis an array of all the files required to use the package. Filepaths may include globs.
filesdiffers frommainin thatmainonly lists single files per filetype, whereasfilesshould include every file.We recommend listing source files in
files, rather than compiled distribution files.
"files": [
"js/motion.js",
"js/run.js",
"js/walk.js",
"sass/motion.scss",
"sass/run.scss",
"sass/walk.scss",
"img/motion.png",
"img/walk.png",
"img/run.png",
"fonts/icons.woff2",
"fonts/icons.woff"
]Most likely you would list globs for multiple files of the same type.
"files": [
"js/*.js",
"sass/*.scss",
"img/*.*",
"fonts/*.*"
]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?
We 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.
Proposal 2: asset-type object
Taking from #21
filesis an object listing all the files required to use the package.filesare listed as arrays for each type of asset.
scripts: Script files like JavaScript.jsor CoffeeScript.coffeestyles: Style files like CSS.css, Sass.scss, or LESS.lessimages: ...fonts: ...datatemplates- (Others — we'd have to determine this spec)
Filepaths may include globs. yada yada yada ....
"files": {
"scripts": [
"js/motion.js",
"js/run.js",
"js/walk.js",
],
"styles": [
"sass/motion.scss",
"sass/run.scss",
"sass/walk.scss",
],
"images": [
"img/motion.png",
"img/walk.png",
"img/run.png",
],
"fonts": [
"fonts/icons.woff2",
"fonts/icons.woff"
]
}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.
Fun fact: recommended way back in 2013 bower/bower#935 (comment)
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.
Currently, I prefer Proposal 1. Easier for authors and for Bower spec.